Talk:Floating point arithmetic

From C64-Wiki
Jump to navigationJump to search

If the exponent ist stored as E+129, the biggest exponent representable is 255-129=126, the smallest one 0-129=-129. This is somewhat at odds with what is said later in the article about -128 as an exponent, but that could be corrected. My problem is: I have a book on C64 programming that claims that FLPT/MFLPT exponents E are in the range -128 <= E <= 127, and consequently the normed mantissae M in the range .5 <= M < 1.0. But this wiki article's interpretation is also self-consistent in that it says M is twice as large as that, but the exponents are one less (leading to the same results after conversion to a decimal string). Is there a way to decide which is true, or are both interpretations correct (or even both wrong)? --217.226.91.240 17:24, 17 February 2015 (CET)

The representation with an exponent bias of 128 is more common just for the imagination if you transfer it into decimal representation (keeping the notion of a symmetric number range with equal sized negative and positive value groups). If the bias value for the exponent corresponds to the mantissa value (or compensates for it) they have all the same binary representation for the same value:
exponent bias (hex.)  mantissa bits                                 mantissa value
$01              . <-   1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx       2^-128
...
$80                   0.1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx       2^-1
$81                    1.xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx       2^0
$82                    1x.xx xxxx xxxx xxxx xxxx xxxx xxxx xxxx       2^1
...
$A0                     1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx.      2^31
...
$FF                     1xxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx -> .  2^126
The mantissa can be placed on 255 "exponential" positions and the bias ties the base value on the leading bit of the normalized mantissa.
--JohannKlasek (talk) 20:05, 4 March 2015 (CET)