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: Dmitri A. Sergatskov
Subject: Re: Calculation issue with octave (data unexpectedly go to zero at some point)
Date: Thu, 27 Feb 2014 18:21:51 -0600

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.
--





reply via email to

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