Money type

bachmeier no at spam.net
Wed Jan 1 20:09:45 UTC 2020


On Wednesday, 1 January 2020 at 18:16:01 UTC, Vitaly Livshic 
wrote:
>  Thanks Steve, JN.
>
>  JN, BigInt is big integer. It cannot works with fractional 
> numbers. It is sadly, that wide-spread languages have no 
> convinient money type. This is abnormal.
>  Hope, D will have fixed point type either as built-in type or 
> library.

https://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

> It cannot works with fractional numbers.

Nothing can give you a better answer if your fraction is 176/100. 
You can always convert from int to some other type without losing 
precision on the initial calculations if you're in a situation 
where you want to calculate the per-unit cost for 37 units that 
cost a total of $500.17.



More information about the Digitalmars-d mailing list