This is an old revision of the document!


Floating point support

Summary of the discussion in 2004 (without IEEE 754-2008 knowledge of course):

  1. An agreed floating point number format
  2. 6502 conversion routines from int ↔ float and back
  3. 6502 routines to support + - * / < > ⇐ >= == != operators
  4. changes of the compiler, assembler and linker
  5. 6502 ASCII ↔ FP conversion functions (e.g. for scanf/printf)
  6. A 6502 math library (pow(), exp(), sin(), cos(), … the works)

32 vs. 48 bit

               32 bit                        48 bit
  -----------------------------------------------------------------------
    "Standard" (whatever that's      Better precision.
    worth).
                                     Will meet the ISO C requirements.
    Needs slightly less memory and
    is faster.                       Format can be optimized for 6502.
    Compiler can use native
    fp routines. But: Limits
    number of host platforms.
    Doesn't meet ISO C               Needs slightly more memory and is
    requirements.                    slower.
    Less precision.                  Compiler needs fp library. But:
                                     will work on all host platforms.
    Binary format is given and
    we have to live with that.       Implementation needs more code, so
                                     programs have a larger memory
                                     footprint.
    Is suboptimal. wrt exponent      could be made optimal wrt.
    processing (8 bit covered in     exponent processing
    2 bytes)

Conclusion

  • support the ISO C standard: IEEE 32 bit format

The C standard allows setting errno, raising an exception, or just ignoring the condition for most operations. The standard does not require NaNs and infinite values, so it may be an option not to implement them, because this removes all corresponding checks in the math functions resulting in smaller code size. The TMS320 DSP has this behaviour and it's quite convenient.

IEEE 754-2008 IEEE 754 test suite

cc65/roadmap.1320431962.txt.gz · Last modified: 2011-11-04 19:39 by polluks
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki