C++ Math modf()This function is used to divide a number into integral and fractional part. For example : SyntaxSuppose a number is 'x' and 'ptr' is the pointer to an integral part. Parameterx: 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. Return valueIt returns the integral part of x. Example 1Let's see a simple example Output: 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. Example 2Let's see a simple example when the value of x is negative. Output: Value of x is : -78.34 integral part of x is :-78 fractional part of x is :-0.339996 Next TopicC++ Math Functions |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India