Re: Floating point precision problem



"David Webber" <dave@xxxxxxxxxxxxxxxxxxx> wrote in message
news:esVut90zFHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
> If you are testing the result with something like
>
> if( result==98655827.0032 )
>
> and finding it false instead of true, then again you need to employ a
> numerical mathematician who will know that anyone who does that sort of
> thing with floating point should be shot, and will replace it by
>
> if( abs(result-98655827.0032) < some_appropriate_small_number )

Or, more generally, using a comparison function that uses a relative error
(tolerance) instead of an absolute one.


.



Relevant Pages

  • Re: New version of John Hayes tester
    ... >>> with FSENSITIVITY you can do either relative ... >> When a nearness comparison is made, ftester does both absolute nearness ... > a valid nearness test is not possible. ... magnitude as the tolerance, eps. ...
    (comp.lang.forth)
  • Re: The Bet
    ... the absolute value with the same percentage tolerance. ... within my percentage threshold. ... I gave you both the tolerance of the 12x12x3 inch plate in both microinches ... That is not what informational entropy means. ...
    (talk.origins)
  • The Tolerance of Intolerance
    ... The Tolerance of Intolerance ... The practice of the atheists/evolutionists is to demand tolerance for ... their views to the absolute intolerance of anything of the Christian. ...
    (alt.religion.christian)
  • Re: relative error for zero input
    ... Express an absolute error like sqrt^2)? ... If xo is nonzero, as indicated below, then the relative error is infinite. ...
    (sci.math)
  • Re: New version of John Hayes tester
    ... with FSENSITIVITY you can do either relative ... When a nearness comparison is made, ftester does both absolute nearness ... we perform the following relative nearness tests: ... Using an absolute nearness test, with a matching tolerance, also fails. ...
    (comp.lang.forth)