emacs-devel
[Top][All Lists]
Advanced

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

Possible bug in `expt'. (was: calc: E command hangs Emacs.)


From: Michaël Cadilhac
Subject: Possible bug in `expt'. (was: calc: E command hangs Emacs.)
Date: Fri, 21 Sep 2007 13:49:20 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux)

"Robert J. Chassell" <address@hidden> writes:

> Please don't confuse us even when the original title is wrong!
> As a first sentence in the body of your message please write
>
>     The following is Emacs Lisp, not Emacs Calc mode even though the
>     title talks about Emacs Calc mode

Well, you know, the `References' field of my previous message is here if
you need context.  The body of the text was all you needed, and it was
just pointing out a bug in the (expt) function, but sorry for the
misleading subject.

> In the body of your message, you attributed the Emacs Lisp to Yu Jie,
> which I think is correct:

Why, not quite.  Yu Jie is quoted with `>', not `>>'.

>     "yu jie" <address@hidden> writes:
>
>     >> (let ((x -1))
>     >>   (while (condition-case nil
>     >>        (message "1.Expt is %e" (expt 10.0 x))
>     >>           (error nil))
>     >>     (message "1.`x' is now %d" (setq x (* 2 x))))
>     >>   (message "2.`x' is now %d" (setq x (/ x 2)))
>     >>   (while (condition-case nil
>     >>        (message "3.Expt is %e" (expt 10.0 x))
>     >>           (error nil))
>     >>     (message "3.`x' is now %d" (setq x (1- x))))
>     >>   (+ x 2))

That expression leads to a weird behavior on Yu's computer.  In fact, it
never gets out the first loop, and `x' reaches 0 without any error.

> That expression is for Emacs Lisp, not Emacs Calc.

> In Emacs Calc mode, E computes the exponential, i.e., `e' raised to the
> power of a number you have given it.

And this function uses (expt), which is buggy.

Hope everybody understands the matter now.

-- 
 |   Michaël `Micha' Cadilhac       |  21 seems like a good value: half of   |
 |   http://michael.cadilhac.name   |  of 42 and just old enough to drink!   |
 |   JID/MSN:                       |   Why would you want to change it?     |
 `----  address@hidden  |          -- Stefan Monnier        -  --'

Attachment: pgpvqJ0hDezjv.pgp
Description: PGP signature


reply via email to

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