As title states, if I have a float, I need to get the fraction part as an integer, how do I do it?
I was thinking:
is there any better/smarter way?
update:
I forgot to mention, the float has format like: X.YZ so there are at most two digits after decimal point.
You use the modf function:
double integral;
double fractional = modf(some_double, &integral);
refer this fractional part of NSDecimalnumber
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With