# Convert Float into Integer

**URL:** <https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032>\
**Category:** Robot Controller\
**Created:** [September 10, 2009, 2:36am UTC](https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032 "2009-09-10T02:36:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Ahmad](https://tech-community.robotics.abb.com/u/Ahmad)\
**Post date:** [September 10, 2009, 2:36am UTC](https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032/1 "2009-09-10T02:36:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Wolf\_Tech](https://avatars.discourse-cdn.com/v4/letter/w/ad7895/32.png) [@Wolf\_Tech](https://tech-community.robotics.abb.com/u/Wolf_Tech)\
**Post date:** [September 10, 2009, 3:37am UTC](https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032/2 "2009-09-10T03:37:39Z")

</div>

Hi Ahmad,

Use the Truncate function:  
nPassOffs\_Y:= Trunc((2-1)/4);

or  
nPassOffs\_Y:=Trunc(nPassOffs\_Y);

BR,

Shane

---

<div class="post-metadata">

**Author:** ![Ahmad](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Ahmad](https://tech-community.robotics.abb.com/u/Ahmad)\
**Post date:** [September 10, 2009, 4:44am UTC](https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032/3 "2009-09-10T04:44:13Z")

</div>

Thanks Shane for your help

I will try that

thanks agian

Ahmad

---

<div class="post-metadata">

**Author:** ![Rulv](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@Rulv](https://tech-community.robotics.abb.com/u/Rulv)\
**Post date:** [September 18, 2009, 9:49pm UTC](https://tech-community.robotics.abb.com/t/convert-float-into-integer/3032/4 "2009-09-18T21:49:13Z")

</div>

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)
