s_fmin.c 497 B

12345678910111213141516171819202122232425
  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. #ifdef __STDC__
  9. double fmin(double x, double y)
  10. #else
  11. double fmin(x,y)
  12. double x;
  13. double y;
  14. #endif
  15. {
  16. if (__fpclassify(x) == FP_NAN)
  17. return x;
  18. if (__fpclassify(y) == FP_NAN)
  19. return y;
  20. return x < y ? x : y;
  21. }
  22. libm_hidden_def(fmin)