Robert Newson writes:

> Does it happen on all negative exact powers of 2, ie:
>
>     -(2^x) <> -(2^x) + 0
>
> for x = 0, 1, 2, 3, ... (ie -1, -2, -4, -8, -16, etc)?

Youre right. Take the program:

for i=0 to 16:print i!-i=(-i+0)

The results are:

Smsq/e 3.00     Qdos JM/JS/Minerva 1.98
0 1                                  0 1
1 0                                  1 1
2 0                                  2 1
3 1                                  3 1
4 0                                  4 1
5 1                                  5 1
6 1                                  6 1
7 1                                  7 1
8 0                                  8 1
etc

>  > Is this a bug?
>
> Naahhhh, just a feature...

It does mean that unless one takes suitable care, programs will not behave
the same on different machines.

> I'm no fp expert (fp dummy is probably the best description), but is it a
> normalisation bug (based on -8 failing, but -9 working)?  [In my very
> limited experience of fp I vaguely remember that the mantissa should be
> normalised so that a one is implied to the left of it, and the exponent is
> offset - so that zero is recognised by (mantissa =) exponent = 0.  Thus,
> exact powers of 2 should have a zero mantissa - excepting sign bit?]

Thats right, so the result of the addition -1+0 does, for some reason not
get normalised in Smsq.

Per



Reply via email to