Forum
mod with type float - Printable Version

+- Forum (https://www.boriel.com/forum)
+-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12)
+--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11)
+---- Forum: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15)
+---- Thread: mod with type float (/showthread.php?tid=436)



mod with type float - britlion - 02-27-2012

This seems to work backwards, giving division instead of remainder.

Code:
dim i as float
For i = 1 to 255
print int i
if i mod 22=0 then
pause 1
pause 0
cls
end if

next i

If you change the dim i as float to dim i as uinteger, it works perfectly, pausing each screen.


Re: mod with type float - boriel - 02-29-2012

Will check it. "Mod" is not implemented in ROM (in fact is an operation not supposed for floats, but many compilers implement it, and so ZX Basic must Tongue).
As you point out, It's mostly likely I "inverted" the result, returning the quotient, not the remainder.