w_cabs.c 472 B

123456789101112131415161718192021222324
  1. /*
  2. * cabs() wrapper for hypot().
  3. *
  4. * Written by J.T. Conklin, <[email protected]>
  5. * Placed into the Public Domain, 1994.
  6. */
  7. #include "cdefs-compat.h"
  8. //__FBSDID("$FreeBSD: src/lib/msun/src/w_cabs.c,v 1.7 2008/03/30 20:03:06 das Exp $");
  9. #include <complex.h>
  10. #include <float.h>
  11. #include <openlibm.h>
  12. #include "math_private.h"
  13. DLLEXPORT double
  14. cabs(double complex z)
  15. {
  16. return hypot(creal(z), cimag(z));
  17. }
  18. #if LDBL_MANT_DIG == 53
  19. __weak_reference(cabs, cabsl);
  20. #endif