Treating the abusive unsigned syndrome

bearophile bearophileHUGS at lycos.com
Fri Nov 28 00:35:55 PST 2008


Some of the purposes of a good arithmetic are:
- To give the system programmer freedom, essentially to use all the speed and flexibility of the CPU instructions.
- To allow fast-running code, it means that having ways to specify 32 or 64 bit operations in a short way.
- To allow programs that aren't bug-prone, both with compile-time safeties and where they aren't enough with run-time ones (array bounds, arithmetic overflow among not-long types, etc).
- Allow more flexibility, coming from certain usages of multi-precision integers.
- Good CommonLisp implementations are supposed to allow both fast code (fixnums) and safe/multiprecision integers (and even untagged fixnums).


Andrei Alexandrescu:
> But if we really start down that path, infinite-precision integrals are 
> the only solution. Because when you multiply two longs, you'd need 
> something even longer and so on.

Well, having built-in multi-precision integer values isn't bad. You then need ways to specify where you want the compiler to use fixed length numbers, for more efficiency.

Bye,
bearophile



More information about the Digitalmars-d mailing list