Boriel Basic Forum
mod with type float - Printable Version

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



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

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 - 2012-02-29

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.