We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

Nope, you won't have to do any explicit conversion. Decimal integers are represented as binary under the hood. You'll want to look into the bitwise operators, they can be used on integers and are a useful way to manipulate the underlying bits.

I was actually struggling with this problem because I thought that I had to convert from decimal to binary. I didnt know I could simply use var03=var01^var02; he he...

There is no such thing as decimal integers. Decimal values are NOT integers, they are called floating point values and are stored in memory through approximation unlike integers which are exact values.

This is very important to understand and remember because this is exactly the reason why you never ever ever use decimal/floating point variables to store or calculate values of high precision such as currency because the approximations which are floating point values can result in arithmetic error when many calculations are performed.

The reason I'm leaving this comment is not to be arrogant but to make a point that there is a fundamental difference in the way integers are stored in memory and if you want to save yourself hours of wasted time looking for devious bugs, read up about these differences.

Actually, the 'integers' passed in from stdin aren't binary integers or decimal integers. They're a string of ASCII characters, which -do- need to be converted.

Depending on language, you very well might need to do explicit conversion to get actual integers.

Remember, the dude said he was new to programming, you need to be careful how you answer such questions. =P

## Maximizing XOR

You are viewing a single comment's thread. Return to all comments →

Nope, you won't have to do any explicit conversion. Decimal integers are represented as binary under the hood. You'll want to look into the bitwise operators, they can be used on integers and are a useful way to manipulate the underlying bits.

I didn't know that. Thanks jberlage.

I was actually struggling with this problem because I thought that I had to convert from decimal to binary. I didnt know I could simply use var03=var01^var02; he he...

There is no such thing as decimal integers. Decimal values are NOT integers, they are called floating point values and are stored in memory through approximation unlike integers which are exact values.

This is very important to understand and remember because this is exactly the reason why you never ever ever use decimal/floating point variables to store or calculate values of high precision such as currency because the approximations which are floating point values can result in arithmetic error when many calculations are performed.

The reason I'm leaving this comment is not to be arrogant but to make a point that there is a fundamental difference in the way integers are stored in memory and if you want to save yourself hours of wasted time looking for devious bugs, read up about these differences.

decimal means base 10

Thanks teamdebo. I didn't quite catch what you mean there since I'm new to all this stuff. but still it's nice to know that you are trying to help me.

Actually, the 'integers' passed in from stdin aren't binary integers or decimal integers. They're a string of ASCII characters, which -do- need to be converted.

Depending on language, you very well might need to do explicit conversion to get actual integers.

Remember, the dude said he was new to programming, you need to be careful how you answer such questions. =P