diff options
Diffstat (limited to 'src/elementaryFunctions/acosh/zacoshs.c')
-rw-r--r-- | src/elementaryFunctions/acosh/zacoshs.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/elementaryFunctions/acosh/zacoshs.c b/src/elementaryFunctions/acosh/zacoshs.c index fb9b408c..44202226 100644 --- a/src/elementaryFunctions/acosh/zacoshs.c +++ b/src/elementaryFunctions/acosh/zacoshs.c @@ -10,9 +10,22 @@ * */ +// METHOD +// based on the formula : +// +// acosh(z) = sign(-imag(acos(z)) i acos(z) +// +// sign(x) = 1 if x >= 0 +// | -1 if x < 0 + #include "acosh.h" +#include "acos.h" + +#define localSign(x) x >= 0 ? 1.0 : -1.0 doubleComplex zacoshs(doubleComplex z) { - /* FIXME: Dummy... */ - return z; + doubleComplex acos_z = zacoss(z); + double sign = localSign(-zimags(acos_z)); + + return DoubleComplex(-sign * zimags(acos_z), sign * zreals(acos_z)); } |