C++ Math modf()
This function is used to divide a number into integral and fractional part.
For example :
Suppose a number is 'x' and 'ptr' is the pointer to an integral part.
x: The value which is to be broken into two parts i.e(fractional and integral part).
ptr: It is the pointer to an object where the integral part of x is stored.
It returns the integral part of x.
Let's see a simple example
Value of x is : 18.26 integral part of x is :18 fractional part of x is :0.26
In this example, modf() function breaks a number into fractional and integral part. Fractional part is 0.26 and integral part is 18.
Let's see a simple example when the value of x is negative.
Value of x is : -78.34 integral part of x is :-78 fractional part of x is :-0.339996