Options

integer and remainder part

ImreImre Member Posts: 10
Hello,

I can not find the next functions .....

1. integer part, example int(2.33) = 2

2. remainder part, example mod(9/5) = 4

Thanks in advance

Imre

Comments

  • Options
    DenSterDenSter Member Posts: 8,304
    1:
    MyInt := ROUND(2.33,1,'<');
    MESSAGE(FORMAT(MyInt));
    
    Will show a message with the number 2

    2:
    MyInt := 9 MOD(5);
    MESSAGE(FORMAT(MyInt));
    
    will show a message with the number 4
  • Options
    krikikriki Member, Moderator Posts: 9,090
    Or also:

    1 : MESSAGE('%1', 2.33 DIV 1);
    2 : MESSAGE('%1', 2.33 MOD 1);

    (for no.2 the solution of Denster is the same as the one I put, but like this both things are together)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Options
    DenSterDenSter Member Posts: 8,304
    Sure, you can always combine separate statements together. I just wanted to show that the MOD returns an Integer, and that you need to use FORMAT to translate that into a text value. Sometimes combining them doesn't work, so I always just do the multi-step version.
Sign In or Register to comment.