Forum Migration Notice
We're transitioning to a more modern community platform by the end of this year. Learn about the upcoming changes and what to expect.

Convert Float into Integer

Hello everyone
 

Can anyone please tell me how to convert float number into integer number in RAPID (RobotStudio).

 

For Example if ==> nPassOffs_Y:= ((2-1)/4) = 0.25 then i only need the 0. I jsut want to drop the decimal part. IS THAT Possible in RAPID?

 

Thanks in advance

 

 

Ahmad  
????

Comments

  • Hi Ahmad,
     

    Use the Truncate function:

    nPassOffs_Y:= Trunc((2-1)/4);

     

    or

    nPassOffs_Y:=Trunc(nPassOffs_Y);

     

    BR,

     

    Shane

     
  • Thanks Shane for your help

     

    I will try that

     

    thanks agian

     

    Ahmad
    ????
  • you can use "trunc" to convert to interger (or use "Round" if you need a rounded number) .
     

    Or you can also use DIV for integer division.

     

    nPassOffs_Y:= ((2-1) DIV 4)