[ANSI-Smalltalk] Agenda items...

Andres Valloud andres.valloud at gmail.com
Mon Dec 3 14:29:24 GMT 2007


Ok, so it is a problem of the representation of the mantissa.  Now, if I am
interpreting this right, we agree that in the binary representation of a
double the exponent has an offset.  According to Table 1 in

http://babbage.cs.qc.edu/courses/cs341/IEEE-754references.html

which I find quite handy and is noted to be "Copyright 1985 by The Institute
of Electrical and Electronics Engineers, Inc", the exponent bias is +1023.
That means that the actual exponent zero is represented as 1023.  Now, an
exponent representation of 2047 does not correspond to an actual exponent
because it is used to signal -NaN, indeterminate, -infinity and things like
that.  Therefore, the maximum exponent representation that corresponds to an
actual exponent is 2046.  Since the exponent is biased by 1023, this means
the maximum exponent that can be represented is 1023.

In other words, I think emax should be 1023 because, mantissa representation
choices aside, it is the maximum exponent that can be represented in a
double.  Note that this is so regardless of whether we choose to write
mantissas in LIA or in IEEE, because we still agree that 2^1023 is a double
while 2^1024 is not.

As such I can't help concluding the following.

IMO, whether we choose to *represent* double mantissas one way or the other
is a separate problem than that of the description of the characteristics of
the floating point binary representation.

Therefore, IMO, emin/emax should be independent of the way in which the
mantissas are interpreted, leaving the choice of interpretation to the user.

Thanks,
Andres.


On Dec 3, 2007 1:41 AM, Paolo Bonzini <paolo.bonzini at lu.unisi.ch> wrote:

>
> > However, I do not think 2^1024 is a double.
>
> No, it is not.
>
> > Is this just a
> > representation of mantissa issue, as opposed to "what is the actual
> > value in the binary representation of the double"?
>
> The binary representation of the double has an offsetted exponent,
> emin/emax clearly don't use it.  The point is that both emax_IEEE and
> emax_LIA are the highest value of the exponent that you can put in a
> floating number written sign*mantissa*2^exponent without overflowing the
> binary representation; however:
>
> - in IEEE 2^k is represented with mantissa = 1, exponent = k, so you can
> represent 2^emax_IEEE.  Therefore, emax_IEEE is the highest integer
> (1023) such that 2^emax_IEEE does not overflow.
>
> - in LIA 2^k is represented with mantissa = 0.5, exponent = k + 1, so
> you cannot represent 0.5*2^(emax_LIA + 1) without overflowing the
> exponent.  Therefore, emax_LIA is the lowest integer (1024) such that
> 2^emax_LIA overflows.
>
> Alternatively, if you have a number s_IEEE * m_IEEE * 2^e_IEEE (with
> mantissa in [1,2) as per IEEE rules), you can convert it to obey LIA
> rules by putting:
>
>     s_LIA = s_IEEE
>     m_LIA = m_IEEE / 2
>     e_LIA = e_IEEE + 1  (to balance the above).
>
> This results in emax and emin being shifted by one compared to what IEEE
> says.
>
> 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/20071203/4746d446/attachment.htm


More information about the ANSI-Smalltalk mailing list