fmaxmag
Return an input parameter with a larger absolute value. Otherwise, the function behaves like fmax(x, y).
Interface Definition
C interface:
float fmaxmagf(float x, float y);
double fmaxmag(double x, double y);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
y |
|
Floating-point value of the input data. |
Input |
Return Value
The input parameter (x or y) whose absolute value is larger is returned. If |x| > |y|, the return value is x; if |y| > |x|, the return value is y. Otherwise, the function behaves like fmax(x, y).
- If both x and y are NaN, the return value is +NaN.
- If x is NaN and y is any non-NaN value, the return value is y.
- If x is any non-NaN valueN and y is NaN, the return value is x.
Dependencies
C: "km.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // typical usage printf("fmaxmag(1.0, 2.0) = %.15f\n", fmaxmag(1.0, 2.0)); printf("fmaxmag(3.0, 2.0) = %.15f\n", fmaxmag(3.0, 2.0)); // special handling printf("fmaxmag(NAN, -NAN) = %.15f\n", fmaxmag(NAN, -NAN)); printf("fmaxmag(NAN, -INFINITY) = %.15f\n", fmaxmag(NAN, -INFINITY)); result /* * fmaxmag(1.0, 2.0) = 2.000000000000000 * fmaxmag(3.0, 2.0) = 3.000000000000000 * fmaxmag(NAN, -NAN) = nan * fmaxmag(NAN, -INFINITY) = -inf * */ |
Parent topic: Miscellaneous Functions