w_hypot.c 865 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* @(#)w_hypot.c 1.3 95/01/18 */
  2. /*
  3. * ====================================================
  4. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  5. *
  6. * Developed at SunSoft, a Sun Microsystems, Inc. business.
  7. * Permission to use, copy, modify, and distribute this
  8. * software is freely granted, provided that this notice
  9. * is preserved.
  10. * ====================================================
  11. */
  12. /*
  13. * wrapper hypot(x,y)
  14. */
  15. #include "fdlibm.h"
  16. #ifdef __STDC__
  17. double hypot(double x, double y)/* wrapper hypot */
  18. #else
  19. double hypot(x,y) /* wrapper hypot */
  20. double x,y;
  21. #endif
  22. {
  23. #ifdef _IEEE_LIBM
  24. return __ieee754_hypot(x,y);
  25. #else
  26. double z;
  27. z = __ieee754_hypot(x,y);
  28. if(_LIB_VERSION == _IEEE_) return z;
  29. if((!finite(z))&&finite(x)&&finite(y))
  30. return __kernel_standard(x,y,4); /* hypot overflow */
  31. else
  32. return z;
  33. #endif
  34. }