fix aversin() and acoversin()

In cases where the real value to the inverse versed sine and the
inverse coversed sine function produces a complex value, the
conversion from real to complex was incorrect.

Added c_to_q(COMPLEX *c, bool cfree) to make is easier to convert
a COMPLEX value that is real (imag part is 0) into a NUMBER and
optionally free the COMPLEX value.

The func.c code now uses c_to_q().

NOTE: There is a XXX bug marked in the f_aversin() and f_acoversin()
that still needs to be fixed.
This commit is contained in:
Landon Curt Noll
2023-09-05 16:09:22 -07:00
parent ed112997a7
commit 3abedd6713
8 changed files with 125 additions and 98 deletions

View File

@@ -24,7 +24,7 @@ EXAMPLE
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
; print acoversin(1), acoversin(-5), acoversin(2 + 3i)
0 1.40341337183925787843-2.49215996813383545614i -0.30760364953071124992-1.86416154415788242834i
0 1.57079632679489661923-2.47788873028847500481i -0.30760364953071124992-1.86416154415788242834i
LIMITS
0 < eps < 1

View File

@@ -24,7 +24,7 @@ EXAMPLE
1.0472 1.0471975512 1.047197551196598 1.04719755119659774615
; print aversin(0), aversin(-5), aversin(2 + 3i)
0 0.16738295495563874081+2.49215996813383545614i 1.87839997632560786916+1.86416154415788242831i
0 2.47788873028847500485i 1.87839997632560786916+1.86416154415788242831i
LIMITS
0 < eps < 1