w_cabs.c 253 B

1234567891011121314151617181920
  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 <math.h>
  8. struct complex {
  9. double x;
  10. double y;
  11. };
  12. double
  13. cabs(z)
  14. struct complex z;
  15. {
  16. return hypot(z.x, z.y);
  17. }