Home > Community > Forums > Custom IC SKILL > Converting float number to integer

## Email

Recipients email * (separate multiple addresses with commas)

Message *

 Send yourself a copy

## Subscribe

Intro copy of the newsletter section here, some intro copy of the newsletter. Instruction of how to subscribe to this newsletter.

First Name *

Last Name *

Email *

Company / Institution *

 Send Yourself A Copy

# Converting float number to integer

Last post Wed, Aug 12 2009 5:29 PM by kbhow. 4 replies.
 Started by Vignesh054 12 Aug 2009 02:47 AM. Topic has 4 replies and 1757 views
• #### Wed, Aug 12 2009 2:47 AM

• Vignesh054
• Joined on Fri, Sep 26 2008
• Posts 20
• Points 515
Converting float number to integer
 Hi,I have a variable and after calculation it is in the float format. But i want that in integer format. Eg: i did a=10/3 ; a=3.33I want to change now the a to 3. Is this possible?Please help me.Thanks,Vignesh T K
• Post Points: 35
• #### Wed, Aug 12 2009 2:53 AM

• kbhow
• Joined on Thu, May 7 2009
• Penang, Pulau Pinang
• Posts 120
• Points 2,045
Re: Converting float number to integer
 Hi Vignesh, Try round(float_number) Regards, How
• Post Points: 20
• #### Wed, Aug 12 2009 3:04 AM

Re: Converting float number to integer
 Or floor(). It depends on how you want to do the rounding. There's also ceiling() if you want to round up.Regards,Andrew
• Post Points: 5
• #### Wed, Aug 12 2009 3:06 AM

• skillUser
• Joined on Fri, Sep 19 2008
• Austin, TX
• Posts 2,593
• Points 16,035
Re: Converting float number to integer
 Hi Vignesh,Also the fix() function can be used to truncate the fractionpart. Be aware that fix(3.51) will return 3 but round(3.51)will return 4.Regards,Lawrence.
• Post Points: 20
• #### Wed, Aug 12 2009 5:29 PM

• kbhow
• Joined on Thu, May 7 2009
• Penang, Pulau Pinang
• Posts 120
• Points 2,045
Re: Converting float number to integer
 Hi Lawrence, I didn't notice that fix() will works on this condition. Cool, i really learn a lot from you and andrew. Regards, How
• Post Points: 5