MOD

Modulus (MOD) operator returns the remainder from integer division when the integer part of the left operator is divided by the integer part of the right operator.

MOD is a reserved word. You cannot use it as a 4GL identifier.

The right operand for MOD can neither include exponentiation or modulus operators nor can it be zero.

 

Any operand of MOD that is not of the INTEGER or SMALLINT data type is first converted to BIGINT by truncation before its (= this operand's) conversion to DECIMAL for evaluation. Any fractional part is discarded.

 

This example shows the values of y and z, both of which are rounded for the calculation. The resultant y value is then divided by the resultant z value to give a integer remainder (2) returned by the operator:

MAIN

DEFINE y, z FLOAT

LET y = 11.83

LET z = 3.97

DISPLAY "The remainder of the integer division of ", y USING "&&.&&"," and ", z USING "&.&&"," is: ", y MOD z USING "<"

CALL fgl_getkey()

END MAIN

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.