blob: b2592484c2398b2b19939ea051d2a7198d507d50 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
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 <complex.h>
9#include <math.h>
10
11double cabs(double _Complex z)
12{
13 return hypot(__real__ z, __imag__ z);
14}
15libm_hidden_def(cabs)
16
17libm_hidden_proto(cabsf)
18float cabsf(float _Complex z)
19{
20 return (float) hypot(__real__ z, __imag__ z);
21}
22libm_hidden_def(cabsf)
23
24#if defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ && !defined __NO_LONG_DOUBLE_MATH
25libm_hidden_proto(cabsl)
26long double cabsl(long double _Complex z)
27{
28 return hypotl(__real__ z, __imag__ z);
29}
30libm_hidden_def(cabsl)
31#endif