lua-users home
lua-l archive

Re: Float numbers equality.

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


2013年8月12日 Andrew Starks <andrew.starks@trms.com>:
> Any library function offered would be used exclusively by people too
> inexperienced to know that they can't solve their problem through an
> abstraction provided by an opaque library.
That is very well put.
The only library function I might be prepared to support, would go
something like this:
math.near(x,y[,ballpark])
 Returns `true` if `x` can be considered to be so near to `y` that the
 difference between them could well be explained solely by the effect
 of roundoff error, given that `x` and `y` are expected to be of the
 same sort of size as the positive quantity `ballpark`, which has the
 default value 1.
I.e. the name would stress that `x` and `y` are not equal; the
documentation would be riddled with vague terms, except for
"roundoff error" appearing explicitly; and the tolerance, though
not constant, would not automatically depend on `x` or `y`.

AltStyle によって変換されたページ (->オリジナル) /