lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 11/28/10 1:28 PM, Patrick Rapin wrote:
This sort of problems, not directly related to Lua but to the IEEE 754
floating point standard, comes up regularly to the list.
Wouldn't be possible to find a more generic solution?

1) Switch to Decimal Floating Point:

2) Cram Goldberg down the throat of everyone who asks:
"What Every Computer Scientist Should Know About Floating Point Arithmetic"

Is that generic enough? :-)

Oddly, Decimal Floating Point works very well on 32-bit embedded systems without floating point units (like ARM or MIPS). A decimal floating point library is generally no slower (and often faster) than a corresponding binary floating point library and converting to/from text requires way less code, less working memory, less uncertainty and is generally faster to boot.