[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #41894] mod output ML incompatible
From: |
Juan Pablo Carbajal |
Subject: |
[Octave-bug-tracker] [bug #41894] mod output ML incompatible |
Date: |
Tue, 18 Mar 2014 10:41:15 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.149 Safari/537.36 |
URL:
<http://savannah.gnu.org/bugs/?41894>
Summary: mod output ML incompatible
Project: GNU Octave
Submitted by: juanpi
Submitted on: Tue 18 Mar 2014 10:41:14 AM GMT
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Matlab Compatibility
Status: None
Assigned to: None
Originator Name: juanpi
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
In the mailing list we have a report about MOD. The matlab implementation
indeed corrects the result when roundoff error generates an answer different
than expected. Example follows
Gamma = 1.62e7;
duration = 10/Gamma;
dt = 0.0025/Gamma;
t = 0:dt:duration;
y = mod (t, 0.2/Gamma);
find (y==0,3,'first')
octave
1 241 401
Matlab r2008b
1 81 161
Reading the help of mod in matlab it says that the result of MOD
is x - n.*Y with n = floor(x./Y). If Y is not an integer and the quotient x./Y
is within roundoff error of an integer, then n is that integer.
So indeed matlab is giving a result considering roundoff error, I assume they
do something like
function m = mod_ml(x,y)
if fix(y) != y
err = abs (x./y - round(x./y)) < sqrt (eps);
m = mod (x,y);
m(err) = 0;
endif
endfunction
We could issue a warning as well.
This bug is related to bug #32924
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?41894>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Octave-bug-tracker] [bug #41894] mod output ML incompatible,
Juan Pablo Carbajal <=