-->
Page 1 of 2

Wrong math for negative numbers

PostPosted: Tue Dec 09, 2014 4:53 pm
by sancho
Code: Select all> print(1000%10000)
1000

That's OK.
However:
Code: Select all> print(-1000%10000)
9000

Does not seem very good...

Re: Wrong math for negative numbers

PostPosted: Tue Dec 09, 2014 11:32 pm
by zeroday
same result from lua 5.1.4 in pc
maybe a feature?

Re: Wrong math for negative numbers

PostPosted: Wed Dec 10, 2014 12:53 am
by sancho
To me it seems more like a bug in both ;)
Can you kindlh advice where can I file a bug for pc version of lua?

Re: Wrong math for negative numbers

PostPosted: Wed Dec 10, 2014 12:59 am
by sancho
Sorry, I stand corrected. Your result is right. I checked the algorithm for modulo function and the result is ok.
Sorry for wasting your time...