w_cabs.c 249 B

123456789101112131415161718
  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 cabs(struct complex z)
  13. {
  14. return hypot(z.x, z.y);
  15. }