Re: [cc65] Floating point support?

From: Spiro Trikaliotis <ml-cc651trikaliotis.net>
Date: 2004-09-28 06:58:39
Hello,

* On Mon, Sep 27, 2004 at 11:39:21PM +0200 Sidney Cadot wrote:
 
> Ok. If it's a given that we are going to support just one FP-type (and
> now that I think about it this makes a lot of sense), I would agree
> that indeed the natural choice is between a 4-byte and a roll-your-own
> 6-byte type.

One argument against an own 6-byte format: Compatibility... What if I
want to use the output of the compiled program on another machine? Only
IEEE 754 4 byte and 8 byte types are compatible on a wide range of
machines. Furthermore, many implementations before IEEE 754 suffered
from some minor drawbacks because the people implementing them were not
good mathematicians, and did not know what is not so optimal. IEEE 754
tried to circumenvent these problems.

> As to the Turbo Pascal type, it looks like this (assuming you are
> using a fixed width font ;-)):
[...]
> Compared to the IEEE formats, the sign bit is in a different place -
> but there is much to be said for this scheme

AFAIR, IEEE 754 does *not* tell use the format of the FP values! It only
defines the "blocks" we have to define (sign, fractional part,
exponent), and how these are handled. It does not define if LSB first or
MSB first is used, or the order of the blocks!

BTW: Mantissa != fractional part! If we have a normalized IEEE FP value,
than it's mantissa m is in the range 1 <= m < 2. Anyway, the fractional
part f is f = m - 1.

Only if the value is denormalized, than 0 <= m < 1, and f = m. IEEE only
stores the fractional part.


> (the exponent byte now being in a separate byte).

Which is a big advantage on an 8 bit machine.

 
> On a related note: do you have strong feelings about whether or not to
> fully support IEEE-754 notions such as Not-A-Number, Infinity,
> rounding modes?

I fear it will get too complicated if these are fully supported.
Furthermore: Does C have a "clean" interface to even use these? I
always thought C has some problems with +/- NaN, +/- Infty, and so on.

Regards,
   Spiro.

-- 
Spiro R. Trikaliotis
http://www.trikaliotis.net/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Sep 28 06:58:49 2004

This archive was generated by hypermail 2.1.8 : 2004-09-28 06:58:58 CEST