[ANSI-Smalltalk] Agenda items...

Andres Valloud andres.valloud at gmail.com
Wed Nov 14 01:25:38 GMT 2007


Paolo,

The ones I found are fmax:

fmax
    "The largest value allowed by the characterized
    floating point object representation.  The answer
    should be equal to

    (1 - (self radix raisedTo: self precision negated))
        * (self radix raisedTo: self emax + 1)

    Note the ANSI spec says

    (1 - (self radix raisedTo: self precision negated))
        * (self radix raisedTo: self emax)

    but this is not correct"


and fminDenormalized

fminDenormalized
    "The minimum denormalized value allowed by the
    characterized floating point object representation.
    The answer should be equal to

    self radix raisedTo: self emin - self precision + 1

    Note the ANSI spec says

    self radix raisedTo: self emin - self precision

    but this is not correct"


I took a look at #precision, and I think in your case #epsilon fails because
Double>>precision is 52 and Float>>precision is 23.  However, both of those
can use an implicit bit in the mantissa, and thus (unless they're
denormalized) they actually use 53 and 24 significant bits, respectively.
If precision is implemented like that, then it seems to me that epsilon
should work.

Thanks,
Andres.


On Nov 13, 2007 1:08 AM, Paolo Bonzini <paolo.bonzini at lu.unisi.ch> wrote:

> Andres Valloud wrote:
> > I replied from my home account and thus I think the message went to the
> > bit bucket... but I meant to say this is fantastic.  I added an item to
> > the meta, and also created the errata page mentioning two off by one
> > problems in the float protocol.
>
> Could you be more specific?  I only knew of the one in #epsilon.
>
> st> 2.0d timesTwoPower: 1 - FloatD precision  "ANSI definition"
> 0.0000000000000004440892098500627
> st> FloatD epsilon    "dividing by two..."
> 0.0000000000000002220446049250313
> st> (1.0d + FloatD epsilon) = 1.0d    "...is still ok"
> false
>
> Paolo
>
> _______________________________________________
> ANSI-Smalltalk mailing list
> ANSI-Smalltalk at lists.openskills.org
> http://lists.openskills.org/cgi-bin/mailman/listinfo/ansi-smalltalk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openskills.org/pipermail/ansi-smalltalk/attachments/20071113/eb36cf7e/attachment.htm


More information about the ANSI-Smalltalk mailing list