octave-maintainers
[Top][All Lists]
Advanced

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

problems with comparisons between floating point


From: Roberto Porcù
Subject: problems with comparisons between floating point
Date: Sat, 28 Dec 2013 21:12:20 +0000

Dear all,
I'm having some troubles with comparisons between floating point numbers:
in my code, the test   
s(end) == tspan(counter)
sometimes fails while it should not fail because the two numbers are really equal.

So I tried to replace it with the comparison:

abs(s(end)-tspan(counter)) / (max(abs(s(end)),abs(tspan(counter)))) < 8*eps

but  this sometimes fails too, because the number 8 seems to be not adequate.

Could anybody give me a help?
Thanks in advance

Roberto P.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]