w_hypotf.c 962 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* w_hypotf.c -- float version of w_hypot.c.
  2. * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
  3. */
  4. /*
  5. * ====================================================
  6. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  7. *
  8. * Developed at SunPro, a Sun Microsystems, Inc. business.
  9. * Permission to use, copy, modify, and distribute this
  10. * software is freely granted, provided that this notice
  11. * is preserved.
  12. * ====================================================
  13. */
  14. /*
  15. * wrapper hypotf(x,y)
  16. */
  17. #include <math.h>
  18. #include "math_private.h"
  19. float
  20. hypotf(float x, float y)
  21. {
  22. #if defined(__UCLIBC_HAS_FENV__)
  23. float z = (float) __ieee754_hypot((double) x, (double) y);
  24. if(__builtin_expect(!isfinite(z), 0)
  25. && isfinite(x) && isfinite(y) && _LIB_VERSION != _IEEE_)
  26. /* hypot overflow */
  27. return __kernel_standard_f(x, y, 104);
  28. return z;
  29. #else
  30. return (float) __ieee754_hypot((double) x, (double) y);
  31. #endif
  32. }