C++ Math fmin()30 Aug 2024 | 2 min read The function returns the minimum value between two numbers. Conditions:Consider two numbers 'x' and 'y'. If(x SyntaxNote: If any argument has an integral type, then it is cast to double. If any other argument is long double, then it is cast to long double.Parameter(x,y): Values among which the minimum value is to be calculated. Return valueIt returns the minimum value between two numbers. Example 1Let's see a simple example. Output: Values of x and y are :1.1,2.1 Minimum value is :1.1 In this example, value of x is less than the value of y.Therefore, fmin() function returns the value of x. Example 2Let's see a simple example when one of the value is nan. Output: Values of x and y are :10.1,nan Minimum value is :10.1 In this example, value of y is nan. Therefore, the value of x is returned. Next TopicC++ Math Functions |
C++ Math exp2() The function computes the base - 2 exponential function of a given number. Suppose a number is 'x': exp2(x) = 2<sup>x</sup> Syntax float exp2(float x); double exp2(double x); long double exp2(long double x); double exp2(integral x); Parameter x: It is the value of the exponent. Return value It returns, 2 raised to the power x....
1 min read
C++ Math log2() The function computes the base 2 logarithm of a given number. Suppose a number is 'x': log2(x) = log2x; Syntax float log2(float x); double log2(double x); long double log2(long double x); double log2(integral x); Note: The return_type can be float, double or long double. Parameter x: The value whose logarithm is to be...
2 min read
C++ Math lrint() The function rounds off the given value using current rounding mode and returns the value of type long int. Syntax Suppose a number is 'x'. Syntax would be: long int lrint(data_type x); Parameter x: The value that can be float, double or long double. Return value It returns the...
2 min read
C++ Math cos() The function is used to find the cosine of an angle expressed in terms of radian. Syntax Consider a radian 'x'. Syntax would be: float cos(float x); float cos(double x); float cos(long double x); double cos(integral x); Note: If the value passed is an integer type, then it is cast to...
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 atan2() The function finds the inverse tangent of a coordinate. Suppose the coordinate is (x,y): atan2(y,x) = tan-1(y/x); Syntax Suppose the coordinate is (x,y). Syntax would be: float atan2(float y, float x); double atan2(double y, double x); long double atan2(long double y, long double x); Promoted atan2(Arithmetic1 y, Arithmetic x ); Parameter y: It represents...
2 min read
C++ Math isunordered() The isunordered() function checks whether the value of first argument can be meaningfully compared with the second argument. If the first argument cannot be meaningfully compared with the second argument (i.e one or both are NAN), it return 1 otherwise 0. Syntax Consider two numbers 'x'...
1 min read
C++ Math acos() This function computes the inverse cosine of a number in radian. acos(x) = cos -1x Syntax Suppose a number is x. Syntax would be: float acos(float x); double acos(double x); long double acos(long double x); double acos(integral x); Note: If the value passed is an integer type, then it is cast to...
2 min read
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
sqrt() in C++ In C++, the sqrt() function is used to calculate the square root of a non-negative value. It belongs to the library and produces a double-type result. This function is accessed through the header. It is specified in the header file. It calculates the positive...
4 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