Quote:
but is there an easier way to do it other than this?
No, As far as I know. Extracting the integral part is simple: just assign the double to an integer variable. However, transforming the decimal part to an integer is less obvious. After all, there should be a reason the
modf function exists.