Consultor Eletrônico



Kbase P80755: MODULO operator returns the wrong result
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   17/05/2004
Status: Unverified

SYMPTOM(s):

MODULO operator returns the wrong result

MOD operator generates incorrect results when using DECIMAL expression and/or base values

175 MODULO 17.5 returns a value of 13 rather than the correct result of 0

CAUSE:

As stated in the Progress documentation, the MODULO operator accepts INTEGER expression and base values.

FIX:

Expected behaviour. Use INTEGER datatypes for the expression and base values of the MODULO function.

However, to generate the correct result, use the following calculation:

x - (x / y) * y