Why does D language do not support BigDecimal type?

spir denis.spir at gmail.com
Tue Mar 12 14:42:27 UTC 2019


On 12/03/2019 10:31, Boqsc via Digitalmars-d-learn wrote:
> Please attach quick working examples for every sentence you write or it's just a 
> waste of time. People want to see the results and direct actions first before 
> anything else, it's more efficient communication. We are in the subforum of 
> Dlang learn, after all.
> 
> Do not write "For Example".

Then you may help people helping you by giving examples of your own use cases, 
first.

> I'm interested in writing a simple game prototype and I imagine that I would 
> like to include some item parts in decimal. (100.00) To keep everything simple I 
> would like to make my code as clean and simple as possible.

 From this single example, you don't need "fractal" (decimal or binary) numbers 
at all, just plain ints. Look up "fixed point arithmetics" on wikipedia, the 
article is rather good. It's easy and clean in comparison, at least if you only 
need simple operations. (That's how, by the way, monetary/financial software is 
or at least used to be implemented.)

diniz


More information about the Digitalmars-d-learn mailing list