I wonder how I can get the fraction part of a float number. For example, I want to get the integer 75 of the float 56.75. Something like,
frac(56.75) = 75
Thanks in advance.
Printable View
I wonder how I can get the fraction part of a float number. For example, I want to get the integer 75 of the float 56.75. Something like,
frac(56.75) = 75
Thanks in advance.
Here's a rather hackish way....That should work for numbers with 2 after the decimal point....Code:int frac(double a)
{
int b;
b = floor(a);
b = (a-b) * 100;
return b;
}