AHands
|
10
|
 |
|
01-04-2005 06:16 AM ET (US)
|
|
Edited by author 01-04-2005 07:16 AM
You realize the problem is an imcompatibility between binary and decimal right? One tenth (1/1010) works out to: 0.0001100110011001100... (try it long hand on a whiteboard)
It's perfectly precise for eigths for example, but not for tenths (or hundreths). IEEE floating point is great for engineering, but...ah...suboptimal for accounting. Just as decimal is lousy for sevenths, binary is lousy for decimal. If only the Mohenjo Daro had ignored their thumbs we could've all been raised on octal, bitwise shifts and rotates would be easy to grasp...
I don't think thats why Wall Street prices stocks in eigths, but I think its why they'll run into more trouble than they expect if they ever try to switch to decimals. The problem is far from limited to MySQL.
Doing your storage and math in pennies and only converting to dollars when you want to print/display is the best way to go. It's fast and precise.
|