Integer arithmetic operators (idiv, imod)
Help Contents
Logo and Mathematics
Mathematical operators
Integer arithmetic operators (idiv, imod)
Integer arithmetic operators (idiv, imod)
There are only two integer arithmetic operators in Logo - idiv and imod.
The first one is used to find how much times a number can 'fit' into another number.
The second one calculates the remainder.
The effect of integer arithmetic operators can be easily demonstrated with a couple of examples:
print 10 idiv 3.14 ; 3
print 10 imod 3.14 ; 0.58
print 3*3.14 + 0.58 ; 10
The instructions above calculate that 3.14 fits 3 times in 10, but there is a remainder, which is 0.58.