in reply to Re^2: bug in Perl compilation?
in thread bug in Perl compilation?
That's so weird!! I thought this was all standardized.
Anybody know any way to make this portable across all the platforms?
When dealing with reals, you usually need to compare within a tolerance.
a == b
is equivalent to
a - b == 0
and to
|a - b| <= 0
With a tolerance, it becomes
|a - b| <= tol
Tolerance can be absolute
(e.g. tol = 0.0001)
or relative
(e.g. tol = a * 0.05)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing Reals with a Tolerance
by ruoso (Curate) on Dec 22, 2005 at 15:52 UTC | |
by ikegami (Patriarch) on Dec 22, 2005 at 16:34 UTC |