Hacker News new | ask | show | jobs
by gowld 1224 days ago
Or Fixed Point numbers .
1 comments

Don't Fixed Point numbers add more issues? Let's assume you have a machine that accepts 8-bits fixed-point numbers, with 6 bits for integers and 2 for decimals. For simplicity, let's use decimal digits. If you must represent the number 2.013, the resulting number would be +00002.01 So you cut the third decimal digit and wasted 4 bits with useless zeros. At the same time, if you represented the same number in 8 bits floating point, you would have all the digits.
Depends what you track. Fixed point is great for money. Floating point is not. Using an integer cents is easier than both.