s_fdim.c 426 B

123456789101112131415161718
  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. double fdim(double x, double y)
  9. {
  10. int c = __fpclassify(x);
  11. if (c == FP_NAN || c == FP_INFINITE)
  12. return HUGE_VAL;
  13. return x > y ? x - y : 0.0;
  14. }
  15. libm_hidden_def(fdim)