nesdev.com
http://forums.nesdev.com/

Decimal floating-point library
http://forums.nesdev.com/viewtopic.php?f=5&t=11123
Page 1 of 1

Author:  tepples [ Thu Mar 27, 2014 3:38 pm ]
Post subject:  Decimal floating-point library

"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

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/