help-octave
[Top][All Lists]
Advanced

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

Double Arithmatic Problems


From: goehle
Subject: Double Arithmatic Problems
Date: Wed, 30 Sep 2015 07:59:01 -0700 (PDT)

Hi all,

I'm getting differences in double arithmetic when comparing the same
operations between Octave 4.0.0 for Windows (the standard gui installer) vs
Matlab R2014a for Windows and Octave 3.8.2 for Debian Linux.  

I'm using the following sequence of commands

format hex
f = inline("x^4-7*x^3+9*x^2+27*x-54",'x')
x0 = 4.5
x1 = 5.5
x2 = x1 - f(x1) * (x1-x0) / (f(x1) - f(x0))
x3 = x2 - f(x2) * (x2-x1) / (f(x2) - f(x1))

On all three systems I get 
x2 = 8542a15028141140
But for Matlab R2014a and Octave 3.8.2 for Debian I get 
x3 = 40107939df4b95c9
And for Octave 4.0.0 I get
x3 = 40107939df4b95ca
(Notice the a vs. 9 at the end.)  This is a small difference but its
building up to unexpected consequences when running some numerical methods. 
I don't know enough about floating point architecture to know if 4.0.0 is
more or less accurate than the other two or if it should be the same.  

If they are supposed to be different, is there something that can be done so
that they are the same?  Its causing some issues in my classes because
students are getting different answers and behaviour on different systems.  

Thanks. 

Geoff. 




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Double-Arithmatic-Problems-tp4672702.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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