cent and ucent?

bearophile bearophileHUGS at lycos.com
Sat Jan 28 18:58:38 PST 2012


Daniel Murphy:

> It's much more likely that phobos will get something like Fixed!128 in 
> addition to BigInt. 

Integer numbers have some proprieties that compilers use with built-in fixed-size numbers to optimize code. I think such optimizations are not performed on library-defined numbers like a Fixed!128 or BigInt. This means there are advantages of having cent/ucent/BigInt as built-ins.

Alternatively in theory special annotations are able to tell the compiler that a user-defined type shares some of the characteristics of integer numbers, allowing the compiler to optimize better at compile-time. But I think not even the Scala compiler is so powerful.

Bye,
bearophile


More information about the Digitalmars-d mailing list