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

Date view Thread view Subject view

From: Piotr Fusik (P.Fusik_at_elka.pw.edu.pl)
Date: 2003-03-07 17:10:44


On Fri, 7 Mar 2003, Ullrich von Bassewitz wrote:

> 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.
>
I don't think we need fast FP routines. Small are better.
FP arithmetic is generally much slower than integer, especially on 6502.
I you need a fast program, switch to fixed point numbers.

APPLE ][ routines are not IEEE-compliant.

I started writing IEEE-compliant 32-bit floats 6502 routines (integer
conversion, comparision). Sign and 7 bits of exponent in A, lsb of
exponent in X, mantissa in X, sreg and sreg+1.

The problem is what routines are needed?

char->float conversion is smaller and faster than long->float, but this
way we will get many routines: signed char -> float, unsigned char -> float,
int -> float, unsigned -> float, long -> float and unsigned long -> float
(and as many float -> ... routines).

The comparision is a bit tricky - there are signed 0s, infinites and NaNs.
Optimizing single comparision operator routines isn't probably the good
way - there should be some common code for comparision. Note that some
optimizations are not legal for IEEE floats (e.g. !(a>=b) is not
neccessarily (a<b)).

Piotr

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de 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 17:12:40 CET