[ANSI-Smalltalk] Agenda items...

Paolo Bonzini paolo.bonzini at lu.unisi.ch
Mon Dec 3 09:41:00 GMT 2007


> 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



More information about the ANSI-Smalltalk mailing list