Re: [cc65] float and double support - libraries?

Date view Thread view Subject view

From: Ullrich von Bassewitz (
Date: 2003-03-07 11:43:20

On Thu, Mar 06, 2003 at 03:07:47PM -0800, Greg Long wrote:
> Which is a VERY good point...although I would submit that if they both
> have the same precision, it's silly to have both other than for
> compatability reasons.  Therefore I would suggest a double should indeed
> have 64 bits in the interest of, "while we're at it."

I see absolutely no reason to support 64 bit floating point on a 6502
platform. While there are places where having floating point is a must, if one
wants to do high precision calculations, it's definitely better to use a PC.

Handling 64 bit is absolutely, really big, fat and slow on a 6502. And because
the default promotions of the language promote to double (and not to float!),
even a program using just floats will do most calculations in double
precision, leading to bloat and slow programs. Plus, this would need larger
changes in the compiler, because passing 32 bit data types around is already
implemented, but 64 bit is not.

"while we're at it" is rarely a good reason to add something, especially if
we're talking about very limited target platforms, where every byte and every
cycle counts.

> IEEE compliant float and double support, 32bit each, with the double
> code written in mind that it could be expanded to 64bits.
> Let's not worry aobut math.h yet...just basic add, subtract, multiply,
> divide support would be a good starting point.

These routines are not really difficult to write, the tricky part is to make
them fast. The support needed in the compiler is more work.



Ullrich von Bassewitz                        
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.

Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-03-07 11:43:28 CET