help-octave
[Top][All Lists]
Advanced

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

floating point precision question


From: Piotr Isajew
Subject: floating point precision question
Date: Tue, 18 Jan 2011 13:04:39 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi,

I've been trying to use Octave (3.2.4) for some very simple
computations, and noticed a strange behaviour when
incrementing/comparing floating point numbers. In short:


octave:150> 0.15 == (0.10 + 0.05)
ans = 0

why?

An even better test is:

octave:1> A=0.15
A =  0.15000
octave:2> B=(0.10+0.05)
B =  0.15000
octave:3> A==B
ans = 0
octave:4> save /tmp/test A B
octave:5> A==B
ans = 0
octave:6> load /tmp/test A B
octave:7> A==B
ans =  1

Is there any setting I could use to obtain better precision here?


reply via email to

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