Fraction hackers...

Dwight Hughes dwighth at ipa.net
Wed Sep 15 05:45:14 UTC 1999


The standard Squeak Floats are IEEE-754 double-precision (64 bit).
FloatArrays use IEEE 32 bit format. See the class comment in Float for
more info. Notice that there are two basic ways to create Fractions from
Floats: Float>>asApproximateFraction and Float>>asTrueFraction.
Float>>asFraction uses #asApproximateFraction - and that is what you
want if you want 0.2 asFraction = (1/5) to be true.

-- Dwight

DisneyLogic at disneyblast.com wrote:
> 
> >[Florin Mateoc]  Well, guess what:
> >
> >               '(1/2)' + 0.5    breaks
> >               (1/2) + '0.5'    1.0
> >
> >               '(1/2)' * 0.5            breaks
> >               (1/2) * '0.5'            0.25
> >
> >       and so on...
> >
> >       Plus , between
> >               '(1/2)' = 0.5   "false"
> >               (1/2) = '0.5'   "true"
> >       IMHO the second result is "truer" than the first one, so maybe we
> >should fix the first one instead of falsifying the second one if we care for
> >simmetry (I agree, simmetry is good)
> 
> Is there some source or standard upon
> which the Squeak flonum arithmetic is based
> upon, like IEEE?  Trying to define the
> "same as" or even the "near to" predicate
> for flonums is a tricky business.
> 
> Thx,  --jtg
> 
> [snip]





More information about the Squeak-dev mailing list