PackageDescription: SYSBUG-timesTwoPower


SYSBUG -times Two Power

Last published: August 31, 2015 by 'nice'

Defines 0 Classes
Extends 4 Classes


#timesTwoPower: is multiplying a floating point by a power of two, so is generally exact.
But it might be inexact in case of underflow.
Two consecutive inexact rounding operations can lead to an incorrect rounding (known as "double rounding problem")
It is thus vital that the first operation be exact if ever we have to decompose timesTwoPower: in two operations.

This package provides an override that cares of having the first exponent shift exact.

Note: beware if you think of using the primitive, ldexp is buggy in Windows
http://stackoverflow.com/questions/32150888/should-ldexp-round-correctly

The primitive can be verified with following snippet (and is apparently using the broken ldexp library in 8.0.1 for windows):
self assert: (2.75d primitiveTimesTwoPower: -1074) = (3.0d primitiveTimesTwoPower: -1074).