summaryrefslogtreecommitdiff
path: root/lib/libm/ctanl.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libm/ctanl.c')
-rw-r--r--lib/libm/ctanl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libm/ctanl.c b/lib/libm/ctanl.c
new file mode 100644
index 00000000..a410db0e
--- /dev/null
+++ b/lib/libm/ctanl.c
@@ -0,0 +1,17 @@
+#include "__complex.h"
+
+long double complex ctanl(long double complex z)
+{
+ long double d = cosl(2.0L * creall(z)) + coshl(2.0L * cimagl(z));
+
+ if (fabsl(d) < 0.25L) {
+ d = ctansl(z);
+ }
+
+ if (d == 0.0L) {
+ return HUGE_VALL + HUGE_VALL * (long double complex)I;
+ }
+
+ return sinl(2.0L * creall(z)) / d +
+ (sinhl(2.0L * cimagl(z)) / d) * (long double complex)I;
+}