help-octave
[Top][All Lists]
Advanced

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

Re: Calculation issue with octave (data unexpectedly go to zero at some


From: Ben Abbott
Subject: Re: Calculation issue with octave (data unexpectedly go to zero at some point)
Date: Thu, 27 Feb 2014 19:25:21 -0500

On Feb 27, 2014, at 7:21 PM, Dmitri A. Sergatskov <address@hidden> wrote:

> On Thu, Feb 27, 2014 at 6:13 PM, Brian Kaczynski <address@hidden> wrote:
> 2014-02-28 1:03 GMT+01:00 Dmitri A. Sergatskov <address@hidden>:
> It could be  that there is a bug in mod:
> 
> octave:20> mod(0.2, 0.2)
> ans = 0
> octave:21> mod(0.4, 0.2)
> ans = 0
> octave:22> mod(0.6, 0.2)
> ans =  0.20000                                  # ??????????????
> 
> octave:23> mod(0.8, 0.2)
> ans = 0
> 
> 
> In general it seems like a really bad idea to call mod with non-integer 
> arguments.
> 
> 
> I used to assume that at least X has to be integer in mod(X,Y).
> In any case it could be a matlab in-compatibility. I think it all stem from
> 
> octave> fix(0.6/0.2)
> ans =  2
> 
> I have a strong suspicion that Matlab returns 3 here.
> 
> Dmitri.

I had the same expectation. However, when I tested Matlab it gave the same 
result as Octave.

Ben




reply via email to

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