newton_guima newton_guima - 8 months ago 28
Objective-C Question

Get the Decimal part out of a float number

I need to get the decimal part out of a float number, for example:

float x = 18.30;

i need a way to get the '.30' in another float.. so i will have a float equals to 18.30 and another one equals to .30

Any ideas?


I'm not sure if there is a function doing exactly the way you want but you can use this:

x - floor(x)