From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fmath%2Ffmax.html | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 devdocs/c/numeric%2Fmath%2Ffmax.html (limited to 'devdocs/c/numeric%2Fmath%2Ffmax.html') diff --git a/devdocs/c/numeric%2Fmath%2Ffmax.html b/devdocs/c/numeric%2Fmath%2Ffmax.html new file mode 100644 index 00000000..899bbddd --- /dev/null +++ b/devdocs/c/numeric%2Fmath%2Ffmax.html @@ -0,0 +1,56 @@ +

fmax, fmaxf, fmaxl

Defined in header <math.h>
float       fmaxf( float x, float y );
+
(1) (since C99)
double      fmax( double x, double y );
+
(2) (since C99)
long double fmaxl( long double x, long double y );
+
(3) (since C99)
Defined in header <tgmath.h>
#define fmax( x, y )
+
(4) (since C99)
+1-3) Returns the larger of two floating point arguments, treating NaNs as missing data (between a NaN and a numeric value, the numeric value is chosen).
+4) Type-generic macro: If any argument has type long double, fmaxl is called. Otherwise, if any argument has integer type or has type double, fmax is called. Otherwise, fmaxf is called.

Parameters

+ +
x, y - floating point values

Return value

If successful, returns the larger of two floating point values. The value returned is exact and does not depend on any rounding modes.

+

Error handling

This function is not subject to any of the error conditions specified in math_errhandling.

+

If the implementation supports IEEE floating-point arithmetic (IEC 60559),

+

Notes

This function is not required to be sensitive to the sign of zero, although some implementations additionally enforce that if one argument is +0 and the other is -0, then +0 is returned.

+

Example

#include <stdio.h>
+#include <math.h>
+ 
+int main(void)
+{
+    printf("fmax(2,1)    = %f\n", fmax(2,1));
+    printf("fmax(-Inf,0) = %f\n", fmax(-INFINITY,0));
+    printf("fmax(NaN,-1) = %f\n", fmax(NAN,-1));
+}

Output:

+
fmax(2,1)    = 2.000000
+fmax(-Inf,0) = 0.000000
+fmax(NaN,-1) = -1.000000

References

See also

+ + +
+
(C99)
checks if the first floating-point argument is greater than the second
(function macro)
+
(C99)(C99)(C99)
determines smaller of two floating-point values
(function)
C++ documentation for fmax
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/math/fmax +

+
-- cgit v1.2.3