Mod - internal error

Monkey Forums/Monkey Bug Reports/Mod - internal error

DruggedBunny(Posted 2013) [#1]
Mark, just ran into this (can you guess what I'm doing?)...

Function Main ()
	Print 1.0 Mod 2.0
End



G:/Development/Monkey/temp.monkey<3> : Internal error
Monkey Runtime Error : G:/Development/Monkey/temp.monkey<3> : Internal error

(null)
STOPPED



I assume it should only accept integers, though interestingly, BlitzMax doesn't complain.


DruggedBunny(Posted 2013) [#2]
Also, the program doesn't exit afterwards, so even if you correct it, you get the same error again.


DruggedBunny(Posted 2013) [#3]
... and this doesn't even print anything:

Function Main ()

	Print 360 Mod 360 ' Seems to happen for any zero remainder, eg. 720

End



DruggedBunny(Posted 2013) [#4]
Actually, that last one comes from the fact that Print won't print zero!

Function Main ()
	Print 0
End

' Result: Not a sausage!



marksibly(Posted 2013) [#5]
Nice find, it's a bug in the const expression evaluator - fixed for next release. Monkey does do float mod ala bmx, but it looks like there's a bug in the cpp version of that too, also now fixed.

The print wont print 0 bug is already fixed for next release - it relates to another fix where preceding '0's had to be stripped off int literals to precent some targets interpreting them as octals - alas, it stripped off a few too many, ie: all of them!

> Also, the program doesn't exit afterwards, so even if you correct it, you get the same error again.

In debug mode on c++ targets, you need to 'stop' the program before you can rerun it.


DruggedBunny(Posted 2013) [#6]
Can you also tweak the Mod docs I just sent you, then -- I assumed integer-only and said so!