Roundingoff N decimal place microc PIC float values

Please check the frequently asked questions before posting to the forum.
Post Reply
Author
Message
sallu.salmankhalid
Posts: 6
Joined: 20 Nov 2012 13:08

Roundingoff N decimal place microc PIC float values

#1 Post by sallu.salmankhalid » 07 Dec 2012 12:05

Hi,

I am using microc for PIC to write a program a display some values in Graphic Lcd. It involves some calculations in float data type. The problem is that i want to round off those values to 2 decimal points I dont know the procedure to do it. I consulted help but could not find anything. I am using graphics lcd library that comes with microc for KS108.

example suppose i am calulating x and y and z are some float values.

float y = 3.44456,z = 5.4890;

x = y + z;

I want the answer to be 2 numbers after decimal (rounding off the rest) in this case 8.93

thanxs.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Roundingoff N decimal place microc PIC float values

#2 Post by filip » 10 Dec 2012 11:36

Hi,

I believe you have been answered you here :
http://www.mikroe.com/forum/viewtopic.php?f=88&t=51799

Regards,
Filip.

Post Reply

Return to “mikroPascal FAQ”