![]() |
In C, the nextafter() is a standard library function that is used to find the next representable floating-point value after a given number in the direction of another specified number. In this article, we will learn how to use the nextafter() function in C and its variant for different floating point types. Syntax of nextafter() in Cdouble nextafter(double x, double y); ParametersThe nextafter() function in C takes two parameters:
Return Value
Variants of nextafter in CThe nextafter() function comes in three variations, catering to different floating-point types: nextafterf() for floatfloat nextafterf(float x, float y); nextafterl() for long doublelong double nextafterl(long double x, long double y); Examples of nextafter() in CExample 1: Program to demonstrate how to use the nextafter() function
Output The next representable value after 1.00 towards 2.00 is: 1.0000000000000002 Time Complexity: O(1) Example 2: Program to demonstrate the use of the variants of the nextafter() function
The next representable value after 1.00 towards 2.00 is: 1.0000000000000002 Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
C Language |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 20 |