``

prev Menu next

Difference between Full BASIC and Microsoft BASIC

MOD-operator and the MOD-function

MOD(a,b) is used to find the remainder of a divided by b on Full BASIC.
If a and b are both positive integers, a MOD b in Microsoft BASIC and MOD(a,b) coincides.
However, if a is negative or if a or b is not an integer, those do not coincide.
For Example,
`(-1)MOD 3 = -1
MOD(-1,3)= 2
`

If you want to the result that coincide with the MOD operation of Microsoft BASIC, use REMAINDER(a,b).
For Example, `REMAINDER(-1,3) = -1`

While the MOD operation of Microsoft BASIC rounds the operands into integers, MOD functions and REMAINDER functions have the domain of the real numbers.
For example,
`4.71 MOD 3.14 = 5 MOD 3 = 2
MOD(4.71, 3.14) = 1.57
`

Refer to Suppli