MPIR lib

Steven Schveighoffer schveiguy at yahoo.com
Mon Jun 28 15:27:46 PDT 2010


On Mon, 28 Jun 2010 18:18:46 -0400, bearophile <bearophileHUGS at lycos.com>  
wrote:

> 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).

OK, I thought you meant we should discard the current bigint in favor of  
some other implementation.  I wasn't aware that D2's bigint still had  
missing features (I haven't used it).

-Steve


More information about the Digitalmars-d mailing list