3 ms·
If you don't have decimal types, then use fixed point. Or in simpler terms store cents (as integers) not dollars (as floats). Then add a decimal point when you
by ars 14y ago
If you don't have decimal types, then use fixed point. Or in simpler terms store cents (as integers) not dollars (as floats).
Then add a decimal point when you display.
If you are dealing with stocks or interest I suggest storing tenths, or hundreds of a cent to avoid rounding errors.