Lau wrote:
> I'd dare...

Ah well. That's ok, too ;-)

> Although I would guess that no "official" documentation might state
> categorically that numbers are supposed to be normalised, it has to
> be done.

Okay.

> It's not just relevant to "comparison for exact equality". If 
> un-normalised values are allowed to creep into calculations, accuracy is 
> lost.

Well, in this case all calculations are done using 64bit precision
(80bit IEEE). That's 33 bits to waste ;-)

> Negation of an IEEE value merely inverts the sign bit. IEEE in fact has
>   negative zeroes, which it is quite careful about!
> Negation of a QDOS value always has to check for the (irritating) case 
> of negating $8000000.

In my case I get $40000000 as a normalised positive value and after
negation this turns into the problematic $C0000000. I now just test
for this special case. Next QPC will have it.

> Both IEEE and Minerva (and I think that means SMS as well, as I believe
> TT used my code)

IIRC not, only in graphics.

> They are there to improve accuracy when "tiny" values crop up in
> calculations.

The conversion routines try to built denormalised values, too, when
the exponent can't handle the IEEE result. Wonder whether this ever
resulted in anything but 0 in practise ;-)

> I thought I'd mention - when I was developing the Minerva arithmetic
> routines, I actually tested them against IEEE calculations (and my 
> extended precision calculator). I ran thousands of comparisons where I 
> generated nasty patterns of bits for mantissas (etc), including all the 
> exact powers of two and ones that differed from them by least 
> significant bits and so on. It took quite a while before I convinced 
> myself that my arithmetic was "perfect" (i.e. barring cases where 
> results could not be represented, the IEEE result matched the Minerva 
> result bit for bit, even on non-exact divisions and square roots!).

Frankly, although I've passed all the "higher mathematics" stuff for
the SE branch in University I wouldn't dare writing anything like that
myself. Kudos to both you and TT.

Cheers, Marcel (actually not too fond of real mathematics. I can
do percent calculations and program a VCR, though!)

Reply via email to