[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Floating point inaccuracies
- From: <jgiors@...>
- Date: Tue, 30 Nov 2010 11:58:32 -0700
> -------- Original Message --------
> Subject: Re: Floating point inaccuracies
> From: <jgiors@threeeyessoftware.com>
> Date: Tue, November 30, 2010 9:10 am
> To: lua-l@lists.lua.org
>
<... snip ...>
> I don't think changes to the number comparison operators can be
> justified as a language default. However, since the __eq, __lt, and __le
> metamethods can be overridden for numbers[*], it might be nice to create
> a simple Lua library which implements epsilon comparison capability. I
> don't know if there is anything like that currently available -- some
> quick searches didn't turn up anything.
>
> John Giors
> Independent Programmer
> Three Eyes Software
> jgiors@ThreeEyesSoftware.com
> http://ThreeEyesSoftware.com
>
> [*] This is another strike against the proposal -- users can already
> implement the proposed feature in Lua itself.
Addendum: this cannot be done in pure Lua unless the debug library is
used to set the metatable (which means it is a not so "nice" solution).
The global setmetatable() only allows changing the metatable of tables,
not numbers.
John Giors
Independent Programmer
Three Eyes Software
jgiors@ThreeEyesSoftware.com
http://ThreeEyesSoftware.com