Money type

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Jan 1 20:20:14 UTC 2020


On Wednesday, 1 January 2020 at 19:01:36 UTC, Steven 
Schveighoffer wrote:
> That is what I use. Fixed point with a factor of power of 10. 
> In other words, a fixed point number with 2 decimal places 
> would be sufficient for such currency. When doing math on such 
> types, you just need to deal with the underlying numbers, and 
> it works fine.

You don't need fixed point, just store cents in 64 bit floating 
point and you get at least the same accuracy as a 53 bit integer 
fixed point.



More information about the Digitalmars-d mailing list