1*2fe8fb19SBen Gras /* 2*2fe8fb19SBen Gras * cabs() wrapper for hypot(). 3*2fe8fb19SBen Gras * 4*2fe8fb19SBen Gras * Written by J.T. Conklin, <jtc@wimsey.com> 5*2fe8fb19SBen Gras * Placed into the Public Domain, 1994. 6*2fe8fb19SBen Gras */ 7*2fe8fb19SBen Gras 8*2fe8fb19SBen Gras #include <sys/cdefs.h> 9*2fe8fb19SBen Gras #if defined(LIBM_SCCS) && !defined(lint) 10*2fe8fb19SBen Gras __RCSID("$NetBSD: compat_cabs.c,v 1.2 2007/08/10 21:20:35 drochner Exp $"); 11*2fe8fb19SBen Gras #endif 12*2fe8fb19SBen Gras 13*2fe8fb19SBen Gras #include "../src/namespace.h" 14*2fe8fb19SBen Gras #include <math.h> 15*2fe8fb19SBen Gras 16*2fe8fb19SBen Gras struct complex { 17*2fe8fb19SBen Gras double x; 18*2fe8fb19SBen Gras double y; 19*2fe8fb19SBen Gras }; 20*2fe8fb19SBen Gras 21*2fe8fb19SBen Gras double cabs(struct complex); 22*2fe8fb19SBen Gras __warn_references(cabs, "warning: reference to compatibility cabs()"); 23*2fe8fb19SBen Gras 24*2fe8fb19SBen Gras double cabs(struct complex z)25*2fe8fb19SBen Grascabs(struct complex z) 26*2fe8fb19SBen Gras { 27*2fe8fb19SBen Gras 28*2fe8fb19SBen Gras return hypot(z.x, z.y); 29*2fe8fb19SBen Gras } 30