C++ Math fmax()30 Aug 2024 | 2 min read The function returns the maximum value between two numbers. Conditions:Consider two numbers 'x' and 'y'. If(x>y): It returns 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 maximum value is calculated. Return valueIt returns the maximum value between two numbers. Example 1Let's see a simple example. Output: Values of x and y are :3.3,6.9 Maximum value is :6.9 In this example, value of y is greater than the value of x. Therefore, fmax() function returns the value of y. Example 2Let's see a simple example when one of the value is nan. Output: Values of x and y are :1.3,nan Maximum value is :1.3 In this example, value of y is nan.Therefore, fmax() function returns the value of x. Next TopicC++ Math Functions |
C++ Math lround() This function is used to round off the given value and cast to long integer. Syntax Suppose a number is 'x'. Syntax would be: long int lround(data_type x); Parameter x: The value which can be either float or double. Return value It returns the rounded value of x. The return type...
1 min read
C++ Math llrint() The function rounds off the given value using current rounding mode and returns the value of type long long int. Syntax Suppose a number is 'x'. Syntax would be: long long int llrint(data_type x); Parameter x: The value which is to be rounded. Return value It returns the rounded value of...
1 min read
C++ Math isfinite() The function determines the value whether it is finite or not. It should not be NaN or infinite value. If the number is finite, it returns 1 otherwise 0. Note: A finite value is a value that is neither NAN nor infinite. Syntax Suppose a number is...
2 min read
C++ Math exp() The function computes the exponential e raised to the power given number. Suppose a number is x: exp() = ex Syntax Consider a number 'x'. Syntax would be: float exp(float x); double exp(double x); long double exp(long double x); double exp(integral x); Parameter x: The value whose exponential value is to be calculated. Return value It...
1 min read
C++ Math isgreaterequal() The isgreaterequal() function determines whether the value of first argument is greater or equal to the value of second argument. If the first argument is greater or equal to the second argument then it returns 1 otherwise 0. Note: If one or both the arguments...
2 min read
C++ Math isgreater() The isgreater() function determines whether the value of first argument given in function is greater than the value of second argument. If the first number is greater, it returns 1 otherwise 0. Note: If one or both the arguments of a function are NAN then...
2 min read
C++ Math fabs() It computes the absolute value of a given number. Suppose a number is 'x': fabs(x) = |x|; Syntax float fabs(float x); double fabs(double x); int fabs(int x); Parameter x: The value whose absolute value is to be determined. Return value It returns the absolute value of x. Example 1 Let's see the simple example...
1 min read
C++ Math pow() This function is used to find the power of a given number. Consider a base 'b' and exponent 'e'. Power=be Syntax Its syntax would be : double pow(double b, double e); float pow(float b, float e); long double pow(long double b, long double e); promoted pow(type1 b, type2 e); Note: If...
1 min read
C++ Math fma() The function computes the expression x*y+z without losing its precision in any intermediate result. Suppose numbers are x,y and z: fma(x,y,z) = x*y+z; Syntax float fma(float x, float y, float z); double fma(double x, double y, double z); long double fma(long double x, long double y, long double z); double fma(type1...
1 min read
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
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