Preliminary submission - std.rational and std.typelist

bearophile bearophileHUGS at lycos.com
Mon Feb 11 19:03:39 PST 2013


Arlen:

> Rational doesn't support BigInt because the necessary math 
> functions do not
> support BigInt.  And if you are going to have Rational support 
> BigInt, you
> are most likely going to need BigFloat, which is something we 
> don't have.

I have used Rationals with BigInts several times, and so far I 
didn't need bigfloats...


> I personally do not like BigInt because it is incomplete, and 
> because it is
> reinventing the wheel.  I much rather see Phobos provide an 
> interface to
> GMP, MPFR, or some other arbitrary precision arithmetic 
> library, similar to
> what you see with Haskell and Python.

CPython defines its own multi-precision numbers.

But I have not yet understood why D isn't using GMP as Haskell 
does. Maybe Don knows this answer.

In theory Open Source is meant to give a huge help to code reuse, 
in practice you see wheel reinvention all the time. D should use 
bigints from GMP, a garbage collector developed in conjunction 
with Rust and Mono developers, the back-end (that supports 32 bit 
Windows exceptions) on LLVM, etc.

Thankfully Phobos uses Curl :o)

Bye,
bearophile


More information about the Digitalmars-d mailing list