[Thread Prev][Thread Next][Index]

Re: [ferret_users] Function MOD : strange behavior



Hi Olivier,

On Wed, Aug 26, 2020 at 5:45 PM Olivier Marti <olivier.marti@xxxxxxxxxxxx> wrote:

yes? LIST MOD(lon    ,360), MOD(lon-360,360), MOD(lon-720,360), MOD(lon+360,360)
[ . . . ]
            EX#1   EX#2   EX#3   EX#4
1    /  1:   36.0 -324.0 -324.0   36.0

[ . . . ] 

The result of EX#2 and EX#3 puzzles me. From what I remember from my math studies, the MOD function should return a result in the interval [0,360[. All EX#s should print the same result than EX#1 and EX#4.

Is this a bug or a feature ? If this is a feature, it should be at last documented. And another MOD function with the "correct" behaviour would be strongly appreciated ;-)

This Q&A session

https://stackoverflow.com/questions/11720656/modulo-operation-with-negative-numbers

explains why
[Thread Prev][Thread Next][Index]