Money type

Steven Schveighoffer schveiguy at
Wed Jan 1 16:18:07 UTC 2020

On 1/1/20 10:41 AM, Vitaly Livshic wrote:
> Good day.
> I came from Java world, where 'double' type inadequate for money 
> calculation. BigDecimal serves for it. This is ugly type, but gives 
> precise results.
> Which type I must use for money in D?

I generally used a fixed-point type. Recently, I was going to use a 
project in called fixed, but the string-based constructor 
uses a conversion to double first, negating the precision of a fixed 
point type.

Another developer is making a new fixed point type here:

But it's not completely ready yet.


More information about the Digitalmars-d mailing list