fminmag
Return a 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. y is returned for|x| > |y| while x is returned for |y| > |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 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("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 handling 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