summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartynas Venckus <martynas@cvs.openbsd.org>2015-07-16 13:42:07 +0000
committerMartynas Venckus <martynas@cvs.openbsd.org>2015-07-16 13:42:07 +0000
commita4a953a7b9252757346ba945169ea098751f6bfe (patch)
tree6972aa1a4cebdd4c6986245c82f14636cfd4b1ea
parent486c2b0566bb358e74fba997c24ae803c277cc6e (diff)
Adapt previous to extended-precision, and fix single-precision constants.
-rw-r--r--lib/libm/src/s_cacoshl.c4
-rw-r--r--regress/lib/libm/complex/complex.c22
2 files changed, 19 insertions, 7 deletions
diff --git a/lib/libm/src/s_cacoshl.c b/lib/libm/src/s_cacoshl.c
index 67a2362c273..39ac1db9f2f 100644
--- a/lib/libm/src/s_cacoshl.c
+++ b/lib/libm/src/s_cacoshl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_cacoshl.c,v 1.1 2011/07/08 19:25:31 martynas Exp $ */
+/* $OpenBSD: s_cacoshl.c,v 1.2 2015/07/16 13:42:06 martynas Exp $ */
/*
* Copyright (c) 2008 Stephen L. Moshier <steve@moshier.net>
@@ -51,6 +51,6 @@ cacoshl(long double complex z)
{
long double complex w;
- w = I * cacosl(z);
+ w = clogl(z + csqrtl(z + 1) * csqrtl(z - 1));
return (w);
}
diff --git a/regress/lib/libm/complex/complex.c b/regress/lib/libm/complex/complex.c
index 133cfafe017..bcf58496b2b 100644
--- a/regress/lib/libm/complex/complex.c
+++ b/regress/lib/libm/complex/complex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: complex.c,v 1.1 2015/07/16 13:29:11 martynas Exp $ */
+/* $OpenBSD: complex.c,v 1.2 2015/07/16 13:42:06 martynas Exp $ */
/*
* Written by Martynas Venckus. Public domain
@@ -17,12 +17,17 @@
floorf((__real__ (f)) * PREC) == floorf((r) * PREC) && \
floorf((__imag__ (f)) * PREC) == floorf((i) * PREC) \
)
+#define testl(f, r, i) ( \
+ floorl((__real__ (f)) * PREC) == floorl((r) * PREC) && \
+ floorl((__imag__ (f)) * PREC) == floorl((i) * PREC) \
+)
int
main(int argc, char *argv[])
{
double complex r, z4 = -1.1 - 1.1 * I;
- float complex rf, z4f = -1.1 - 1.1 * I;
+ float complex rf, z4f = -1.1F - 1.1F * I;
+ long double complex rl, z4l = -1.1L - 1.1L * I;
r = cacosh(z4);
assert(test(r, 1.150127, -2.256295));
@@ -32,11 +37,18 @@ main(int argc, char *argv[])
assert(test(r, -0.381870, -1.071985));
rf = cacoshf(z4f);
- assert(testf(rf, 1.150127, -2.256295));
+ assert(testf(rf, 1.150127F, -2.256295F));
rf = casinhf(z4f);
- assert(testf(rf, -1.150127, -0.685498));
+ assert(testf(rf, -1.150127F, -0.685498F));
rf = catanhf(z4f);
- assert(testf(rf, -0.381870, -1.071985));
+ assert(testf(rf, -0.381870F, -1.071985F));
+
+ rl = cacoshl(z4l);
+ assert(testl(rl, 1.150127L, -2.256295L));
+ rl = casinhl(z4l);
+ assert(testl(rl, -1.150127L, -0.685498L));
+ rl = catanhl(z4l);
+ assert(testl(rl, -0.381870L, -1.071985L));
return (0);
}