help-octave
[Top][All Lists]
Advanced

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

Re: Is this a numerical problem?


From: Lukas Reichlin
Subject: Re: Is this a numerical problem?
Date: Thu, 19 Aug 2010 11:32:45 +0200

Hi Jaroslav

Thanks for your quick reply. # a < -4 is meant as a comment about what I've 
learned at elementary school ;-) -4.0000...001 is smaller than -4 while 
-3.99999… is greater than -4. Anything different from that would wreck my world 
view, but hey, I'm willing to learn something new.

octave:18> a = 10 * rem (-12/5, 1)
a = -4.0000
octave:19> a < -4
ans = 0  # I'm expecting 1 here
octave:20> -4.001 < -4
ans =  1  # I agree :-)

Best Regards,
Lukas

BTW:
octave:22> a <= -4
ans = 0


On 19.08.2010, at 10:51, Jaroslav Hajek wrote:

> On Thu, Aug 19, 2010 at 10:39 AM, Lukas Reichlin
> <address@hidden> wrote:
>> Dear Octave community
>> 
>> I'm using Octave 3.2.4 from MacPorts on MacOSX 10.6.4 running on an Intel 
>> Core 2 Duo. I noticed a behaviour which seems strange to me. Does someone 
>> have a good explanation for the results below?
>> 
>> octave:60> a = (10 * rem (-12/5, 1))
>> a = -4.00000000000000  # a < -4
> 
> 
> Stop right there and ask yourself where you did that # a < -4 from.
> Surely you've tested it, right? :D
> 
> -- 
> RNDr. Jaroslav Hajek, PhD
> computing expert & GNU Octave developer
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz




reply via email to

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