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 |
C++ Math islessgreater() The islessgreater() fuinction determines whether the value of first argument is less than or greater than the value of second argument. If the value of first argument is less than or greater than the second argument then it returns 1 otherwise 0. Note: If one...
2 min read
C++ Math log() The function is used to find the natural logarithm (base-e logarithm) of a given number. Mathematically: Suppose 'x' is a given number: logex = log(x); Syntax float log(float x); double log(double x); long double log(long double x); double log(integral x); Parameter x: It is the value whose natural logarithm is to be calculated. Return...
2 min read
C++ Math cosh() The function finds the hyperbolic cosine of an angle given in radian. Mathematically, coshx = ex+ e-x/2 Syntax Suppose the hyperbolic angle is 'x': float cosh(float x); double cosh(double x); long double cosh(long double x); double cosh(integral x); Parameter x: The value of angle whose hyperbolic cosine is to be calculated. Return value It returns...
1 min read
C++ Vector hypot() This function finds the square root of the sum of the squares of two numbers. It stands for hypotenuse, is used to find the hypotenuse of a right angled triangle. Consider three numbers x,y and z : hypotenuse of a right angle triangle = √x2+y2 distance from...
1 min read
C++ Math asinh() The function computes the arc hyperbolic sine of an angle given in radian. Where, an arc of hyperbolic sine is the inverse of hyperbolic sine. sinh-1x = asinh(x); Syntax Suppose an angle given in radian is 'x': float asinh(float x); double asinh(double x); long double asinh(long double x); double asinh(integral x); Parameter x: The...
1 min read
C++ Math log10() The function computes the common algorithm (base 10) of a given number. Mathematically: Suppose a number is 'x': log10x = log10(x); Syntax float log10(float x); double log10(double x); long double log10(long double x); double log10(integral x); Note: The return_type can be float, double or long double. Parameter x: The value whose common logarithm is to...
2 min read
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
C++ Math fpclassify() The function returns the value of type int that matches one of the macro constants, depending on the value of x. value description FP_INFINITE Positive or negative infinity FP_NAN Not a Number FP_ZERO Value of zero. FP_SUBNORMAL Sub Normal value FP_NORMAL Normal value Syntax Suppose a number is x. Syntax would be: int fpclassify(float x); int fpclassify(double x); int fpclassify(long double...
1 min read
C++ Math tanh() The function computes the hyperbolic tangent of an angle given in radian. Mathematically, tanhx = ex -e-x/ ex+e-x Syntax Suppose the angle is 'x': float tanh(float x); double tanh(double x); long double tanh(long double x); double tanh(integral x); Parameter x: The value whose hyperbolic tangent is to be computed. Return value It returns the hyperbolic tangent...
1 min read
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