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
Next TopicC++ Math Functions
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week