Rational numbers in D

bearophile bearophileHUGS at lycos.com
Sat Jun 9 08:08:19 PDT 2012


SomeDude:

> I've never had any use for rational numbers as have 99% of 
> developers I believe. Maybe I'm overlooking something, but I 
> see only two possible usages of them: math packages and length 
> quotations in the english system. Because of this, I'd rather 
> see them in Deimos than in Phobos.

I have had to use Rational nunbers in D two or three times (once 
during simplification of expressions that contain operations 
among integer numbers, to not lose exact precision with floating 
point numbers). I have written a rationals module for D1 and 
later I have converted it to D2. So you see two persons that have 
implemented them.

It's a small module, that uses std.bigint, it's not a binding to 
C code, so putting it in Deimos is not necessary. I'd like a 
rationals module in Phobos.

Bye,
bearophile


More information about the Digitalmars-d mailing list