fminmag
Return an input parameter with a smaller absolute value. Otherwise, the function behaves like fmin(x, y).
Interface Definition
C interface:
float fminmagf(float x, float y);
double fminmag(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 smaller is returned. If |x| > |y|, the return value is y; if |y| > |x|, the return value is x. Otherwise, the function behaves like fmin(x, y).
- If both x and y are NaN, the return value is +NaN.
- If x is NaN and y is any value but NaN, the return value is y.
- If x is any value but NaN and y is NaN, the return value is x.
Dependency
C: "km.h"
Example
C interface:
// typical usage
printf("fminmag(1.0, 2.0) = %.15f\n", fminmag(1.0, 2.0));
printf("fminmag(3.0, 2.0) = %.15f\n", fminmag(3.0, 2.0));
// special handing
printf("fminmag(NAN, -NAN) = %.15f\n", fminmag(NAN, -NAN));
printf("fminmag(NAN, -INFINITY) = %.15f\n", fminmag(NAN, -INFINITY));
result
/*
* fminmag(1.0, 2.0) = 2.000000000000000
* fminmag(3.0, 2.0) = 3.000000000000000
* fminmag(NAN, -NAN) = nan
* fminmag(NAN, -INFINITY) = -inf
* */
Parent topic: Miscellaneous Functions