Stop to! rounding?

monarch_dodra monarchdodra at gmail.com
Wed Jul 3 01:23:35 PDT 2013


On Wednesday, 3 July 2013 at 06:18:28 UTC, Jonathan M Davis wrote:
> On Wednesday, July 03, 2013 08:11:50 Josh wrote:
>> Jonathan, do you know of any fixed point D library? If not, 
>> would
>> it be worth me making one for phobos?
>
> I am unaware of one, and I don't really know why anyone would 
> really want fixed
> point rather than floating point, so I don't know what use 
> cases it would be
> valid for or how much interest there would really be in adding 
> something like
> that to Phobos.
>
> - Jonathan M Davis

Said the man who then went on to state "I really don't like 
dealing
with floating point numbers." ;)

That said, fixed point types, and/or "decimal floating point 
types" are both very important features to specific domains: Just 
the same way certain fields (gaming) have weird requirements, so 
do certain other fields.

My brother in law writes financial apps, and in that field, using 
floating points type is *legally* forbidden.

My wife writes the embeded code for a machine here company 
manufactures. Ditto: no floating point types allowed. She's told 
me that their code is *riddled* with things like "mv = v * 1000": 
because they don't have a way to handle fractinal numbers.

Long story short, I think both would be a great addition to 
phobos/D. I'd personally really want to play with decimal floats: 
They are slower, less precise and have less range, but are more 
"exact" in base 10 than traditional floats. And when printed in 
Base 10, are *always* exact.


More information about the Digitalmars-d-learn mailing list