help-octave
[Top][All Lists]
Advanced

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

Numeric issue


From: JokerOne
Subject: Numeric issue
Date: Fri, 4 Jul 2014 02:46:22 -0700 (PDT)

Hi community,

I using Octave for quite a while now, however, apparently, I am not aware of
some numeric issues going on, which is where I like to ask you for help:

Basically, I noticed, that in the following dummy code, the results appear
strange to me:

clear all;
format long;

a   = [1.1:1.1:100];
a(50)                     % expected to be == 55
b   = 50*1.1;          % expected to be == 55

((a(50)-b) == 0)     % is 1
((a(50)-55) == 0)    % is 0 (!?)
ceil(a(50))              % expected to be == 55, but results in 56 ??
ceil(b)                    % same as above ??
ceil(55)                   % == 55, as expected

-->
ans =  55.0000000000000
ans =  1
ans = 0
ans =  56
ans =  56
ans =  55

also, 
"
a
"
results in:
[...]
 Columns 49 through 52:

   53.90000000000001   55.00000000000001   56.10000000000000  
57.20000000000000
[...]

with a strange result for 55 --> 55.00000000000001

I guess, all this is known to you experts. Do you have a good advice for me,
how to cope with such numeric issues, when exact results are important?

I am using Octave 3.8.1 on a Win7 machine, btw.

Any help is appreciated

Max




--
View this message in context: 
http://octave.1599824.n4.nabble.com/Numeric-issue-tp4665228.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

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