xref: /netbsd-src/lib/libm/compat/compat_cabs.c (revision 6c9a28baebd9820bb9d0c8cd3c72ead5845cfe02)
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 
8 #include <sys/cdefs.h>
9 #if defined(LIBM_SCCS) && !defined(lint)
10 __RCSID("$NetBSD: compat_cabs.c,v 1.3 2017/05/13 02:58:03 maya Exp $");
11 #endif
12 
13 #include "../src/namespace.h"
14 #include <math.h>
15 
16 struct complex {
17 	double x;
18 	double y;
19 };
20 
21 double cabs(struct complex);
22 __warn_references(cabs, "warning: reference to compatibility cabs()")
23 
24 double
cabs(struct complex z)25 cabs(struct complex z)
26 {
27 
28 	return hypot(z.x, z.y);
29 }
30