[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floating point inaccuracies
- From: Louis Mamakos <louie@...>
- Date: Sun, 28 Nov 2010 17:43:02 -0500
On Nov 28, 2010, at 5:41 PM, Andrew Lentvorski wrote:
> 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: http://speleotrove.com/decimal/
>
> 2) Cram Goldberg down the throat of everyone who asks:
> "What Every Computer Scientist Should Know About Floating Point Arithmetic"
> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.6768
>
> 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.
>
> -a
>
and perhaps http://luaforge.net/projects/ldecnumber/