Menu

#4652 complexify fails on rats

None
open
nobody
5
2025-12-20
2025-12-20
No

The complexify function in ellipt.lisp incorrectly returns Lisp rationals:
~~~
:lisp (complexify 2/3) => 2/3 <<< WRONG
<<< should be ((RAT SIMP) 2 3)
:lisp (complexify (complex 0 2/3)) => similar
<<< should be ((MTIMES SIMP) ((RAT SIMP) 2 3) $%I)
~~~
Lisp rationals do not work correctly in Maxima. For example, ($bfloat 2/3) => error.
I don't know whether complexify can ever be called with a Lisp rational argument, but it should defensively check for it, maybe just explicitly testing for integerp or floatp instead of realp.

Discussion


Log in to post a comment.