PackageDescription: SYSBUG-FloatConversion


SYSBUG - Float Conversion

Last published: March 20, 2018 by 'nice'

Defines 0 Classes
Extends 7 Classes


There are bugs in
Integer>>asFloat, Integer>>asDouble
Fraction>>asFloat, Fraction>>asDouble.
because they do not honour IEEE default rounding mode (to nearest even).
Integer original algorithm accumulate round off errors.
Fraction original algorithm also (two inexact conversions and an inexact operation /).

One side effect of these bug is the inability to read base 10 floating point values correctly...
This package does correct all these methods.

It also adds the Squeak and Dolphin like asTrueFraction asApproximateFraction.
asTrueFraction is the Fraction exactly as represented in base 2 (binary) floating point form...
It is equivalent to VW7.7 asFraction, but with an accelerated implementation (if that ever matters...).

asApproximateFraction is a traditional continued fraction expansion.
Except this implementation of approximate is more exact than asRational,
in the sense that it would convert back to the original floating point value.
Helas, this is at the expense of Integer arithmetic... (less efficient than asRational).

This package should supersede SYSBUG-asRational, and asRational might well be defined as asApproximateFraction.
Since it is not heavily called to my knowledge, performance of asRational should not matter.
(It used to be called in old images because of hash code, but it is no more the case).

From nicolas cellier , any question, remarks, etc... go to this email.
LICENSE: (MIT), see copyright information