diff options
author | jofret | 2008-05-14 15:35:36 +0000 |
---|---|---|
committer | jofret | 2008-05-14 15:35:36 +0000 |
commit | 40729e999dcd8b0c8b4823b8381de0ec0006c9d8 (patch) | |
tree | 8b8ea4f205f272549eeccb99f20a31afed94bace /src/elementaryFunctions/acosh/zacoshs.c | |
parent | e74160538e479fc6b65b959e0203c20d57096ba5 (diff) | |
download | scilab2c-40729e999dcd8b0c8b4823b8381de0ec0006c9d8.tar.gz scilab2c-40729e999dcd8b0c8b4823b8381de0ec0006c9d8.tar.bz2 scilab2c-40729e999dcd8b0c8b4823b8381de0ec0006c9d8.zip |
acosh Release
WARNING : Results may differ from scilab when calling on real values less than 1.
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)); } |