Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC Numerics / Part 2 - The PowerPC Numerics C Implementation
Chapter 10 - Transcendental Functions / Comparison Functions


fmin

You can use the fmin function to determine which is the smaller of two real numbers.

double_t fmin (double_t x, double_t y);
x
Any floating-point number.
y
Any floating-point number.
DESCRIPTION
The fmin function determines the lesser of its two arguments.

fmin(x,y) = x if x y
fmin(x,y) = y if y < x

If one of the arguments is a NaN, the other argument is returned.

EXCEPTIONS
When x and y are finite and nonzero, the result of fmin(x,y) is exact.

SPECIAL CASES
Table 10-3 shows the results when one of the arguments to the fmin function is a zero, a NaN, or an Infinity. In this table, x is a finite, nonzero floating-point number. (Note that the order of operands for this function does not matter.)
Special cases for the fmin function
OperationResultExceptions raised
fmin(+0,x) x if x < 0None
 +0 if x > 0 
fmin(-0,x) x if x < 0None
 +0 if x > 0 
fmin(±0,±0) +0None
fmin(NaN,x) x[23]None[24]
fmin(+ ,x) xNone
fmin(- ,x) - None

EXAMPLES
z = fmin(-INFINITY, -300,000);   /* z = -INFINITY because  is 
                                    smaller than any integer. */
z = fmin(NAN, -300,000);   /* z = -300,000 by definition of the 
                              function fmin. */

[23] If both arguments are NaNs, the first NaN is returned.
[24] If the NaN is a signaling NaN, the invalid exception is raised.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996