C++ Math nextafter()The nextafter() function represents the next representable value in a specific direction. Suppose two numbers are 'from' and 'to'. Therefore, the nextafter() function finds the next value of 'from' in the direction of 'to'. SyntaxNote: If any argument is long double, then the return type is long double. If not, the return type is double.Parameter( from, to): These are the floating point values. Return value
Example 1Let's see a simple example when the value of 'from' and 'to' are equal. Output: Values of from and to are:6.7, 6.7 6.7 In the above example, values of 'from' and 'to' are equal. Therefore, the function returns the value of 'from'. Example 2Let's see a simple example when 'from' and 'to' are of same type. Output: Values of from and to are:0, 6 4.94066e-324 In the above example, 'from' and 'to' are of same type but are unequal. The nextafter() function returns the value i.e 4.94066e-324 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