s_fmin.c 521 B

1234567891011121314151617181920212223242526
  1. /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
  2. *
  3. * Permission to use, copy, modify, and distribute this software
  4. * is freely granted, provided that this notice is preserved.
  5. */
  6. #include "math.h"
  7. #include "math_private.h"
  8. libm_hidden_proto(fmin)
  9. #ifdef __STDC__
  10. double fmin(double x, double y)
  11. #else
  12. double fmin(x,y)
  13. double x;
  14. double y;
  15. #endif
  16. {
  17. if (__fpclassify(x) == FP_NAN)
  18. return x;
  19. if (__fpclassify(y) == FP_NAN)
  20. return y;
  21. return x < y ? x : y;
  22. }
  23. libm_hidden_def(fmin)