1994-03-01 20:14:34 +03:00
|
|
|
/*
|
|
|
|
* cabs() wrapper for hypot().
|
1999-07-02 19:37:33 +04:00
|
|
|
*
|
1994-03-01 20:14:34 +03:00
|
|
|
* Written by J.T. Conklin, <jtc@wimsey.com>
|
|
|
|
* Placed into the Public Domain, 1994.
|
|
|
|
*/
|
|
|
|
|
1997-10-09 15:34:16 +04:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
#if defined(LIBM_SCCS) && !defined(lint)
|
2007-08-11 01:20:35 +04:00
|
|
|
__RCSID("$NetBSD: compat_cabs.c,v 1.2 2007/08/10 21:20:35 drochner Exp $");
|
1997-10-09 15:34:16 +04:00
|
|
|
#endif
|
|
|
|
|
2007-08-11 01:20:35 +04:00
|
|
|
#include "../src/namespace.h"
|
1994-03-01 20:14:34 +03:00
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
struct complex {
|
|
|
|
double x;
|
|
|
|
double y;
|
|
|
|
};
|
|
|
|
|
2007-02-23 01:08:17 +03:00
|
|
|
double cabs(struct complex);
|
|
|
|
__warn_references(cabs, "warning: reference to compatibility cabs()");
|
1997-10-09 15:34:16 +04:00
|
|
|
|
1994-03-01 20:14:34 +03:00
|
|
|
double
|
2007-02-23 01:08:17 +03:00
|
|
|
cabs(struct complex z)
|
1994-03-01 20:14:34 +03:00
|
|
|
{
|
2007-02-23 01:08:17 +03:00
|
|
|
|
1994-03-01 20:14:34 +03:00
|
|
|
return hypot(z.x, z.y);
|
|
|
|
}
|