1. Haha, well I suppose morbidly geeky would fascinate me as well.

Thank you for the response ^_^, I'm wondering though..how/why floats store values like this? I would think an innaccuracy like this wouldn't go un-fixed if it was fixable.

2. It's not an error, it's a way for the computer to handle high precision decimal numbers. Internally the number is stored in such a way that it can be used for either very large numbers (many places to the left of the decimal) or very small numbers (many places to the right of the decimal).

Basically, the machine represents the numbers in exponential format for floats (one bit for the sign, 7-11 bits (depending on float or double) for another part, and the remaining bits for the mantissa) versus using the binary nature of storage for ints.

Whereas ints are represented like such:
00000000 = zero
00000010 = two
00000100 = four
00000101 = five
etc.

A float is stored with a very different method (rather complex and can vary from compiler to compiler) in such a way that while it is not exact, it holds a much broader range. Internally it looks more like

0 0100101 010010100101010010101000

if you were to break up the bits into the different parts. (some compilers store them in different orders, but the result is the same)

Most of this is academic, unless you want to get into compiler design or very advanced tricks and stuff. The main thing to remember is this: == with floats or doubles is most likely to be false, no matter what the values of the numbers, while != is most likely to be true with floats and doubles, no matter what the numbers.

Like any tool, you use them when appropriate and remember how to use them properly. floats and doubles are useful for representing money, temperature, and anything else that might have a fractional part, ints are useful for most other things.

3. >I'm wondering though..how/why floats store values like this?
Good stuff

4. for representing money, temperature,
Why?
Due to the inaccuracy of floating-point types, isn't it better to simply use a larger integer type and divide by a set amount to get the real answer?

i.e.
Code:
```float fNumber = 150.25;//normal, but possibly inaccurate
long long lNumber = 150250000;//just divide this by 6 and you can get the real value.  you can use == on the
long longs and just cast them to float and divide by 6 for output```

5. Fixed-point math is indeed popular, but 6 is a weird radix. You usually use powers of 2 or 10.

6. Thank you Jessycat and Prelude for your help I'm taking a look at that pdf right now infact.

What do you mean by radix?

7. radix == base, from what I remember of the docs on atoi() or itoa() (both nonstandard apparently.. *sigh*) or whatever

8. It was just an example; you can make it whatever you want (as long as it will fit in the variable).

9. atoi is standard, itoa is not. And yes, radix is the base of the number system. Decimal has radix 10, binary radix 2.

10. >>atoi is standard, itoa is not
Oh. Well, good to know at least one of them is usable

11. I use itoa a lot, and I really don't like all the compiler warnings I get.

My solution is just to rewrite it and call it my_itoa

12. i Just thought i'd take a shot at the initial problem:

Code:
```#include <iostream>

using namespace std;

int main()
{
{
cout<<"Correct!";
.......Whatever you want it to do.....
}
else{
cout<<"Wrong!";
}
return 0;
}```
i think the (strcmp) thing is right, im new to this too.

13. As explained before, this is terrible protection because you can view it in a hex editor or disassembler (hell, even notepad!)

14. Encryption is a very important aspect of computer programming. As prospective computer scientists we should strive to become encryption experts. Go here to learn more.

15. >My solution is just to rewrite it and call it my_itoa
Or you could use sprintf, or better yet, stringstreams. That would save you the trouble of potentially introducing unnecessary bugs by reinventing an existing solution.