newton_guima newton_guima - 1 year ago 80
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?

Answer Source

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

x - floor(x)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download