all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: "Erdnüß, Bastian (IPF)" <bastian.erdnuess@kit.edu>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: Emacs Calc Bug: calc-cplx.el:math-imaginary-i
Date: Tue, 14 Aug 2018 23:24:44 -0400	[thread overview]
Message-ID: <CAM-tV-_UF8CkwbQjp4CC+QANrsUNjoZ929WPxZXf2x5PRNwEGg@mail.gmail.com> (raw)
In-Reply-To: <617a497c51d8458a877d6a8ba0781820@kit-msx-24.kit.edu>

On 10 August 2018 at 06:51, Erdnüß, Bastian (IPF)
<bastian.erdnuess@kit.edu> 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	other threads:[~2018-08-15  3:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5609bcdab92948b082877be552ce52c5@kit-msx-24.kit.edu>
     [not found] ` <20180809223951.GA26689@belanger-home>
2018-08-10 10:51   ` Emacs Calc Bug: calc-cplx.el:math-imaginary-i Erdnüß, Bastian (IPF)
2018-08-15  3:24     ` Noam Postavsky [this message]
2018-08-28 12:15       ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV-_UF8CkwbQjp4CC+QANrsUNjoZ929WPxZXf2x5PRNwEGg@mail.gmail.com \
    --to=npostavs@gmail.com \
    --cc=bastian.erdnuess@kit.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.