C++ Math nextafter()30 Aug 2024 | 2 min read 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 |
math scalbn() function
C++ Math scalbn() The function computes the product of a given number and FLT_RADX raised to the power of exponent. Suppose a number is 'x' and exponent is 'n': scalbn(x,n) = x * ( FLT_RADX)n Syntax float scalbn(float x, int n); double scalbn(double x, int n); long double scalbn(long double x, int n); double...
1 min read
math signbit() function
C++ Math signbit() The function checks whether the sign of a given number is negative or not. If the sign of a number is negative, it returns 1 otherwise 0. The signbit() function can also be applied to infinite, NAN and zero value. Syntax Suppose a number is 'x'.Syntax would...
2 min read
math less() function
C++ Math less() The less() function determines whether the value of first argument is less than the value of second argument. If first argument is less than the second argument then it returns 1 otherwise 0. Note: If one or both the arguments are NAN, then the...
2 min read
math remquo() function
C++ Math remquo() The function finds the floating point remainder of numerator/denominator (rounded to the nearest integer value) and it also stores the quotient internally to the pointer passed in the parameter of the function. Syntax Suppose a numerator be 'n', denominator be 'd' and pointer 'p'. Syntax would...
1 min read
math isnan() function
C++ Math isnan() The function checks whether the number is a Not a Number or not. If the number is NaN, it returns 1 otherwise 0. Note: The NaN is a non-representable value for floating point elements such as square root of negative number or the result of...
1 min read
math log1p() function
C++ Math log1p() The function computes the natural logarithm of a given number plus one. Suppose a number is 'x': log1p(x) = log(1+x); Syntax float log1p(float x); double log1p(double x); long double log1p(long double x); double log1p(integral x); Note: The return_type can be float, double or long double. Parameter x: The value of which logarithm is to...
2 min read
math lgamma() function
C++ Math lgamma() The lgamma() function computes the logarithm of a gamma function of an argument passed to the function. Suppose a number is x: Syntax float lgamma(float x); double lgamma(double x); long double lgamma(long double x); double lgamma(integral x); Parameter x: It is a floating point value. Return value It returns the logarithm of a gamma...
2 min read
math tgamma() function
C++ Math tgamma() The tgamma() function computes the gamma function of an argument passed to the function. Suppose a number is x: Syntax float tgamma(float x); double tgamma(double x); long double tgamma(long double x); double tgamma(double x); Parameter x: It is a floating point value. Return value It returns the gamma function value of x. Parameter Return value x...
2 min read
math erfc() function
C++ Math erfc() The erfc() function computes the complementary error function value of a parameter passed to the function. Suppose a number is 'x': erfc(x) = 1-erf(x); Syntax float erfc(float x) ; double erfc(double x) ; long double erfc(long double x) ; double erfc(integral x); Parameter x: It is a floating point value. Return value It returns the...
2 min read
math trunc() function
C++ Math trunc() The function rounds off the given value towards zero and returns the nearest integral value whose magnitude is not greater than the given value. For example: trunc(3.8) = 3; Syntax Suppose a number is 'x'. Syntax would be : return_type trunc(data_type x); Note: return_type can be float,double or long double. Parameter x:...
1 min read
We request you to subscribe our newsletter for upcoming updates.

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