Marcel Kilgus writes:

> > In internal format, Exponent . Mantissa:
>
> > -1        = $800 . $C0000000
> > -1 + 0  = $801 . $80000000
>
> > which can be a flaming nuisance!
>
> You got the mantissas and exponents mixed up, $800 $80000000 is "-1"
> and $801 $C0000000 is "-1" but not your two. As Robert wrote this is a

Just checking whether everyone was paying attention. You obviously were ;)

> question of normalisation, however, QDOS FP values don't have the
> implied "1." he mentions (this is for example found in the IEEE
> standard, except the 80bit one which is a bit special in this
> respect). As far as I know normalisation is not required for QDOS FP
> values.

A "bit" special, eh. Nice pun.

<>
> Example: Epsilon = 0.000000001
>          IF (a - b) < Epsilon THEN PRINT "They are equal".
>
> In SuperBasic I believe this technique is already implied when using
> the "=" operator. But you cannot just compare the bytes of the two

The S*Basic "==" (double equals) works in this case.

> values (e.g. in assembler) because of the different representations a
> value can have (there's some rounding going on almost every time one
> uses FP).

So that means a hefty re-write of my old assembler float comparison
routine ;(  And anyone using SNG's diy stuff, based on the same
assumptions, is in for a surprise too. I just checked.)

> > Is this a bug?
>
> Point of view, I'd say no. The original SMSQ/E routines give the same
> result for both -1 and -1+0, it's the PC FPU (or the IEEE->QDOS
> translation) that gives something different on QPC. I could probably
> do some normalisation, which could solve your problem in THIS case,
> but other than that...

Bug or no bug, it is a compatibility issue, and one that may trash existing
programs. Are there any other likely pitfalls?

Thanks for your comprehensive reply!

Per




Reply via email to