The Trouble With Rounding Floats
lukfil writes "We all know of floating point numbers, so much so that we reach for them each time we write code that does math. But do we ever stop to think what goes on inside that floating point unit and whether we can really trust it?"
A fixed-point (or "decimal" types). see decimal in c#, BigInteger in Java, money/dec in SQL server, etc. Pay attention, and please tell me youre still in high school.
why run from Vincenzo?
Frankly, if you can't find out on your own, you have no business writing code. This is not rocket science.
"We returned the General to El Salvador, or maybe Guatemala, it's difficult to tell from 10,000 feet"
Seems to me the only full solution to round-off error would be to store the results of certain math operations as strings indicating the underlying mathematical/algebraic expressions (e.g. 1.0/3.0 == "1/3"), a la Matlab... but then, I'm no expert, perhaps there is a better way.
I'd love to have someone write me a check for $1/3. If I deposited it at an ATM for $0.33, would I get arrested? Would I read about it in the paper the next morning? BANK'S COMPUTER BLOWS UP, GOOFY CHECKED BLAMED.
Find free books.