View Single Post
erendorn's Avatar
Posts: 738 | Thanked: 983 times | Joined on Apr 2010 @ London
#3
float will give you approx 7 decimals of precision, always (hence asking for 8 digits is asking for trouble). It's very bad. Don't use floats unless you can control rounding errors, and don't have a choice (say, you are doing GPU calculations and need the x4 perf).
Use doubles (approx 16 decimals) if you are doing fractional calculations, or integers if you are dealing with real money.

Also, float are stored in binary, so there are no reason that you can write an arbitrary integer value as a float (there may be one above and one below, but none equal).
 

The Following 3 Users Say Thank You to erendorn For This Useful Post: