As noticed by Stathis Kamperis, the original implementation does not
always return the correct principal value (with real>=0). (eg cacosh(ccos(1.0I)) was -1) Replace by a more ground-up one which should do better.
This commit is contained in:
parent
143caecc0d
commit
aa89e1b426
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cacosh.c,v 1.1 2007/08/20 16:01:30 drochner Exp $ */
|
||||
/* $NetBSD: cacosh.c,v 1.2 2009/08/03 19:41:32 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -36,6 +36,10 @@ cacosh(double complex z)
|
||||
{
|
||||
double complex w;
|
||||
|
||||
#if 0 /* does not give the principal value */
|
||||
w = I * cacos(z);
|
||||
#else
|
||||
w = clog(z + csqrt(z + 1) * csqrt(z - 1));
|
||||
#endif
|
||||
return w;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cacoshf.c,v 1.1 2007/08/20 16:01:31 drochner Exp $ */
|
||||
/* $NetBSD: cacoshf.c,v 1.2 2009/08/03 19:41:32 drochner Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -36,6 +36,10 @@ cacoshf(float complex z)
|
||||
{
|
||||
float complex w;
|
||||
|
||||
#if 0 /* does not give the principal value */
|
||||
w = I * cacosf(z);
|
||||
#else
|
||||
w = clogf(z + csqrtf(z + 1) * csqrtf(z - 1));
|
||||
#endif
|
||||
return w;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user