emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Calc Bug: calc-cplx.el:math-imaginary-i


From: Noam Postavsky
Subject: Re: Emacs Calc Bug: calc-cplx.el:math-imaginary-i
Date: Tue, 14 Aug 2018 23:24:44 -0400

On 10 August 2018 at 06:51, Erdnüß, Bastian (IPF)
<address@hidden> wrote:
> During code review I think I spotted a bug in the function
> math-imaginary-i at calc-cplx.el:271.
>
> Line 276 reads "(eq (nth 1 val) 0)" but I think it should read
> "(eq (nth 0 val) 1)", i.e. the length of the complex number in
> polar form should be one, instead of that the angle to the real
> axis should be zero.  The angle to the real axis will be taken
> care of in the following line.

(nth 0 val) would be the symbol `polar', so I think (eq (nth 1 val) 1)
is what was intended. And the Math-equal on the next line should be
checking (nth 2 val).

(defun math-imaginary-i ()
  (let ((val (calc-var-value 'var-i)))
    (or (eq (car-safe val) 'special-const)
    (equal val '(cplx 0 1))
    (and (eq (car-safe val) 'polar)
         (eq (nth 1 val) 0) ;;;;;;; line 276
         (Math-equal (nth 1 val) (math-quarter-circle nil))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]