In C, fmaximum_mag() returns the argument with the larger magnitude. fmaximum_mag(-5.0, 3.0) is -5.0 because 5 > 3 in size. It is a C23 / newer library API.
You pass two double values. The result is a double that keeps its original sign. Include <math.h>. On GCC, link with -lm and enable a C23 mode when needed. The page slug is fmaximum-mag; the C name uses an underscore.
Syntax
Pass both values. Start with this call.
C
fmaximum_mag(-5.0, 3.0);
Call
What it does
fmaximum_mag(-5.0, 3.0)
Returns -5.0 because |-5| is larger than |3|.
fmaximum_mag(2.0, -2.0)
Magnitudes are equal; the maximum of the two values is returned (+2.0).
Include <math.h>. On GCC, link with -lm. Spell the C function fmaximum_mag with an underscore. The tutorial URL uses hyphens: /c/math/function/fmaximum-mag.
Library declarations
C
double fmaximum_mag(double x, double y);
float fmaximum_magf(float x, float y);
long double fmaximum_magl(long double x, long double y);
Parameters
Parameter
Description
x
Required. First value. Compared by absolute size.
y
Required. Second value. Compared by absolute size.
Return Value
Return Value
Description
double
The argument with larger |value|. Equal magnitudes return the maximum of the two values. NaN propagates.