summaryrefslogtreecommitdiffstats
path: root/newlib/libm/complex/cabsl.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libm/complex/cabsl.c')
-rw-r--r--newlib/libm/complex/cabsl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/newlib/libm/complex/cabsl.c b/newlib/libm/complex/cabsl.c
new file mode 100644
index 000000000..091f2cd53
--- /dev/null
+++ b/newlib/libm/complex/cabsl.c
@@ -0,0 +1,18 @@
+/* Copyright (C) 2015 by Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <complex.h>
+#include <math.h>
+
+long double
+cabsl (long double complex z)
+{
+#ifdef _LDBL_EQ_DBL
+ return cabs (z);
+#else
+ return hypotl (creall (z), cimagl (z));
+#endif
+}