bigints

renoX renosky at free.fr
Wed May 7 04:28:34 PDT 2008


bearophile a écrit :
> When I talk about adding multiprecision integral numbers to D (mostly
> becasue using them avoids most integer bugs)

To *avoid* bugs or to *hide* bugs ?

IMHO, if there is an integer overflow it's because either your 
computations are wrong or the input validation isn't strict enough, 
using big integers can help hide the bugs but doesn't really prevent 
them (except in a few case)..

So IMHO the default should be normal int but which throw exception in 
case of overflow: this help find the bugs sooner instead of hiding the 
bugs..

But I agree that big ints should be also part of the language..

renoX

>, I usually add that the
> compiler can then use many tricks to speed them up, this simple post
> shows few examples of those tricks (so to be faster they may enjoy
> compiler support, as today D complex numbers have): 
> http://factor-language.blogspot.com/2008/04/performance-improvements.html
> 
> 
> With AST macros and multiprecision numbers D may look closer to a
> Lisp ;-)
> 
> Bye, bearophile



More information about the Digitalmars-d mailing list