in reply to Re^4: Getting different results with $var++ and $var += 1
in thread Getting different results with $var++ and $var += 1
I wish Perl had arbitrary precision integers, and could add/subtract/compare decimal numbers without losing precision.
Decimal floating point is certainly doable... I did it years ago on a Z80. It's not what you'd call cheap, run-time-wise -- though with a 64 bit processor and fast multiply/divide instructions, it's probably a whole lot less painful than it used to be.
If there isn't one already, I'd be amused to do a "DecFlt" equivalent of "BigInt". The first decision is whether to do that as big precision floating point, or indefinite precision fixed point.
From a scientific programming perspective, binary floating point is better than any other radix. IBM machines used to use radix 16, to save time and hardware during normalisation and alignment shifts. Unfortunately, that saving came at the cost of the wonderfully named "wobbling precision". With 24 bits of precision, radix 16 floating point results are good to +/- any one of 2^-24, 2^-23, 2^-22 or 2^-21, depending on the value of the leading base 16 digit !
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Getting different results with $var++ and $var += 1
by Corion (Patriarch) on Dec 04, 2008 at 09:26 UTC | |
by gone2015 (Deacon) on Dec 04, 2008 at 10:50 UTC |