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: Juan Pablo Carbajal
Subject: Re: Calculation issue with octave (data unexpectedly go to zero at some point)
Date: Fri, 28 Feb 2014 20:15:32 +0100

On Fri, Feb 28, 2014 at 7:33 PM, rchretien <address@hidden> wrote:
> @ Juan-Pablo : your "mod_ml" function seems to work perfectly (both on the
> much simplified and older version I posted and on the latest version of the
> code). I wait before becoming too enthusiastic (I have to perform further
> checkings tonight) but I think your function fixed the problem :) Now, is
> the problem I had before related to a bad usage of modulo or related to a
> bad coded modulo function ?

It is neither of them. It is a matter of convention. Matlab's version
of mod assumes that when x/y is almost an integer then it should be an
integer (and therefore mod returns zero). Octave's mod leaves this to
the user. so when you call mod with a real valued modulus, you should
be aware of round off issues.

The advantage of Matlab's convetion is that most user wont worry and
wont notice the problem. The advantage of Octave it that it gives you
an opportunity to learn, as it might be your case now :D.

The disadvantage of Matlab's function it that it might hide other
problems that happen to fall under this criteria. The disadvantage of
octaves is that user should be aware of what their are doing, which is
not always the case (included me!), since one can't be an expert on
everything.

Some people though may argument in favor of one or another, I think it
is almost a philosophical issue.

It is probable that due to compatibility with matlab we will change
mode to reproduce their criteria.


reply via email to

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