Decimal floating-point library

You can talk about almost anything that you want to on this board.

Moderator: Moderators

Post Reply
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Decimal floating-point library

Post by tepples »

"the determined Real Programmer can write Fortran programs in any language."
--Ed Post, Real Programmers Don't Use Pascal, 1982
http://www.pbm.com/~lindahl/real.programmers.html

This is a prototype of a base-100 floating point library that I plan to implement in 6502 assembly language. It treats a number as a 12-digit coefficient times 100 raised to a positive or negative power. The coefficient is stored as a sequence of six pairs of digits from 0 to 99.

Known limits as of today:
  • No sign bit (as my target application doesn't need negative and positive numbers in the same context)
  • No floating-point division or square root (likewise not needed for my app)
  • Ill-defined behavior on overflow during addition or multiplication when numbers exceed a quadragintillion (10^123)

Future:
  • Have some other smart people play with it to see what I messed up (that's you)
  • Rewrite in 6502 assembly, after which I'll have this topic moved to NESdev
  • Triangular and/or square roots, which I mentioned in a question on Stack Overflow
Download: floatypoint.py
Post Reply