MODULO Function behaves differently for decimal values

mprabu_p

New Member
Hi All,

I have run the following query in progress session

{mfdtitle.i}
display 78.75 modulo 26.25.

Result: 1

{mfdtitle.i}
display 78 modulo 26.
Result: 0

Anybody can explain why MODULO function behaves differently for decimal values...

I think for both the cases it should display 0 value.

Thanks
Regards
M.Prabu.
 

Casper

ProgressTalk.com Moderator
Staff member
Modulo expects integer values, so the values you entered are turned into integers and therefore you get 1, since int(78.75) = 79.

Code:
DEFINE VARIABLE i1 AS INTEGER     NO-UNDO.
DEFINE VARIABLE i2 AS INTEGER     NO-UNDO.
ASSIGN i1 = INT(78.75)
       i2 = INT(26.25).
MESSAGE i1 i2
    VIEW-AS ALERT-BOX INFO BUTTONS OK.
MESSAGE i1 MODULO i2
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

Casper.
 
Top