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