Print this page
*** 39,48 ****
--- 39,50 ----
* See fmaxf.c for a discussion of implementation trade-offs.
*/
#include "libm.h" /* for islessequal macro */
+ #include "fenv_inlines.h"
+ #include <stdio.h>
#include <sys/isa_defs.h>
double
__fmin(double x, double y) {
union {
*** 57,77 ****
/* if x is nan, replace it by y */
if (x != x)
x = y;
! /* if x is greater than y or x and y are unordered, replace x by y */
! #if defined(COMPARISON_MACRO_BUG)
! if (x != x || x > y)
! #else
! if (!islessequal(x, y))
! #endif
x = y;
/*
! * now x and y are either both NaN or both numeric; set the
! * sign of the result if either x or y has its sign set
*/
xx.d = x;
yy.d = y;
#if defined(_BIG_ENDIAN)
s = (xx.i[0] | yy.i[0]) & 0x80000000;
--- 59,74 ----
/* if x is nan, replace it by y */
if (x != x)
x = y;
! /* At this point, x and y are either both numeric, or both NaN */
! if (!isnan(x) && !islessequal(x, y))
x = y;
/*
! * set the sign of the result if either x or y has its sign set
*/
xx.d = x;
yy.d = y;
#if defined(_BIG_ENDIAN)
s = (xx.i[0] | yy.i[0]) & 0x80000000;