w_cabs.c 436 B

1234567891011121314151617181920212223
  1. /*
  2. * cabs() wrapper for hypot().
  3. *
  4. * Written by J.T. Conklin, <jtc@wimsey.com>
  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. double
  13. cabs(double complex z)
  14. {
  15. return hypot(creal(z), cimag(z));
  16. }
  17. #if LDBL_MANT_DIG == 53
  18. __weak_reference(cabs, cabsl);
  19. #endif