[Openmcl-devel] Wrong value of complex cosine
Waldek Hebisch
hebisch at math.uni.wroc.pl
Sat Jul 26 06:19:49 PDT 2008
In FriCAS I need to use Lisp cosine function for complex
arguments. But unfortunatly formula used by Closure CL 1.2-rc1
to comput imaginary part of the cosine is wrong: it has incorrect
sign (so, for example '(cos (complex 0.7 1.0))' gives wrong value).
The following patch fixes the problem:
--- openmcl/ccl/level-0/l0-float.lisp.bb 2008-07-04 11:31:37.000000000 -0400
+++ openmcl/ccl/level-0/l0-float.lisp 2008-07-04 11:35:12.000000000 -0400
@@ -702,7 +702,7 @@
(let* ((r (realpart x))
(i (imagpart x)))
(complex (* (cos r) (cosh i))
- (* (sin r) (sinh i))))
+ (- (* (sin r) (sinh i)))))
(if (typep x 'double-float)
(%double-float-cos! x (%make-dfloat))
#+32-bit-target
--
Waldek Hebisch
hebisch at math.uni.wroc.pl
More information about the Openmcl-devel
mailing list