MPIR lib
bearophile
bearophileHUGS at lycos.com
Mon Jun 28 15:18:46 PDT 2010
Steven Schveighoffer:
> What's wrong with d2's bigint that Don has written?
MPIR is "not invented here" :-) Moving part of the development of a very tricky part of code full of long asm routines (see their amount of code finely tuned for different CPUs) to someone else that has more resources and dedication is sometimes positive. It frees Don to do something else for D, allows to use potentially less buggy code (because more people use the same lib), and MPIR contains several good numerical algos and numeric types that are missing in Don's bigint.
By the way, even if MPIR gets a Boost licence some work can be useful to adapt it to D, because in D I'd like the multi-precision integrals to be very efficient even when they are used with numbers about 32 bits long or less, so in some programs they can be a replacement of normal integers. This can be done using an union with a tag and switching to normal integer operations when numbers are small (in this case zero memory is allocated on the heap to keep such numbers). I don't know if MPIR is already performing this optimization, I think it is not (I have asked this small-number optimization in Don's bigints too in past, and I think he likes this idea).
Bye,
bearophile
More information about the Digitalmars-d
mailing list