all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* calc: E command hangs Emacs.
@ 2007-09-18  1:14 yu jie
  2007-09-18 14:16 ` Michaël Cadilhac
  0 siblings, 1 reply; 7+ messages in thread
From: yu jie @ 2007-09-18  1:14 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

M-x calc <RET>
1<RET>
E
----------->here minibuffer reads: "loading xxxxx...." and Emacs has no
response to any keystrokes.

[-- Attachment #2: Type: text/html, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calc: E command hangs Emacs.
  2007-09-18  1:14 calc: E command hangs Emacs yu jie
@ 2007-09-18 14:16 ` Michaël Cadilhac
       [not found]   ` <42b562540709181923t54c3876of89a0c3322b459cc@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Michaël Cadilhac @ 2007-09-18 14:16 UTC (permalink / raw)
  To: yu jie; +Cc: bug-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

"yu jie" <yujie052@gmail.com> writes:

> M-x calc <RET>
> 1<RET>
> E
> ----------->here minibuffer reads: "loading xxxxx...." and Emacs has no
> response to any keystrokes.

I just can't reproduce it.  Please provide some more information on your
system, emacs version, if it does the same with emacs -Q, etc. or send
this bug report via M-x report-emacs-bug.

-- 
 |   Michaël `Micha' Cadilhac       |  Un certain Blaise Pascal              |
 |   http://michael.cadilhac.name   |    etc... etc...                       |
 |   JID/MSN:                       |  -- Prévert (Les paris stupides)       |
 `----  michael.cadilhac@gmail.com  |                                   -  --'

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calc: E command hangs Emacs.
       [not found]   ` <42b562540709181923t54c3876of89a0c3322b459cc@mail.gmail.com>
@ 2007-09-19 15:01     ` Michaël Cadilhac
       [not found]       ` <42b562540709191805tdbc3da4xf0f8d0cc2456cada@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Michaël Cadilhac @ 2007-09-19 15:01 UTC (permalink / raw)
  To: yu jie; +Cc: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 1537 bytes --]

"yu jie" <yujie052@gmail.com> writes:

>> On 9/18/07, Michaël Cadilhac < michael@cadilhac.name> wrote:
>>
>> "yu jie" <yujie052@gmail.com> writes:
>> > M-x calc <RET>
>> > 1<RET>
>> > E
>> > ----------->here minibuffer reads: "loading xxxxx...." and
>> > ----------->Emacs has no response to any keystrokes.

>>     I just can't reproduce it.  Please provide some more information
>> on your system, emacs version, if it does the same with emacs -Q,
>> etc. or send this bug report via M-x report-emacs-bug.

> Hi, Michael:
>      Thanks for your kind reply. Here's system infomation
>
> ====
> In GNU Emacs 23.0.50.1 (i386-mingw-nt5.1.2600)
> of 2007-09-19 on KEVIN-DESKTOP
> Windowing system distributor `Microsoft Corp.', version 5.1.2600
> configured using `configure --with-gcc (3.4)'
> ====
>
> I tried to calculate e^1 but failed.

Thanks for the information.  Does it still happen if you launch Emacs
without any config file (with emacs -Q)?

Maybe you can help debugging further using gdb, or if Emacs does respond
to C-g, by using M-x toggle-debug-on-quit RET before hitting C-g and
forwarding us the backtrace ?

Can someone here reproduce this bug under Windows?

-- 
 |   Michaël `Micha' Cadilhac       |  It isn't feasible for me              |
 |   http://michael.cadilhac.name   |          to browse a web site.         |
 |   JID/MSN:                       |                                        |
 `----  michael.cadilhac@gmail.com  |          -- RMS                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

_______________________________________________
help-gnu-emacs mailing list
help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calc: E command hangs Emacs.
       [not found]           ` <42b562540709201741s28d34896h9c6a69b8db676794@mail.gmail.com>
@ 2007-09-21  9:25             ` Michaël Cadilhac
       [not found]               ` <E1IYgkh-000069-ME@fencepost.gnu.org>
       [not found]               ` <42b562540709232026s650e98ebgbeb780881565c0fa@mail.gmail.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Michaël Cadilhac @ 2007-09-21  9:25 UTC (permalink / raw)
  To: yu jie; +Cc: emacs-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 885 bytes --]

"yu jie" <yujie052@gmail.com> 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))

> *Message*:
> 1.Expt is 1.000000e+000
> 1.`x' is now 0
> 1.Expt is 1.000000e+000
> 1.`x' is now 0
> 1.Expt is 1.000000e+000
> 1.`x' is now 0
> 1.Expt is 1.000000e+000
> Loading debug...done
> Entering debugger...

Thanks a lot.  As I read the pow(3) man page, the fact that it triggers
a ERANGE error is not documented, so it doesn't seem standard.

IMO, we should check by hand if an (under|over)flow is triggered.

Can you please try the following patch?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: floatfns.patch --]
[-- Type: text/x-patch, Size: 753 bytes --]

--- floatfns.c	26 Jul 2007 07:27:51 +0200	1.94
+++ floatfns.c	21 Sep 2007 11:22:16 +0200	
@@ -454,7 +454,7 @@
      (arg1, arg2)
      register Lisp_Object arg1, arg2;
 {
-  double f1, f2;
+  double f1, f2, f3;
 
   CHECK_NUMBER_OR_FLOAT (arg1);
   CHECK_NUMBER_OR_FLOAT (arg2);
@@ -500,8 +500,11 @@
   else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
     domain_error2 ("expt", arg1, arg2);
 #endif
-  IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2);
-  return make_float (f1);
+  IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
+  /* Check for overflow in the result.  */
+  if (f1 != 0.0 && f3 == 0.0)
+    range_error ("expt", arg1);
+  return make_float (f3);
 }
 
 DEFUN ("log", Flog, Slog, 1, 2, 0,

[-- Attachment #1.1.3: Type: text/plain, Size: 344 bytes --]


Thanks again.

-- 
 |   Michaël `Micha' Cadilhac       |  Would someone please DTRT with this,  |
 |   http://michael.cadilhac.name   |        then ACK?                       |
 |   JID/MSN:                       |          -- Richard Stallman           |
 `----  michael.cadilhac@gmail.com  |                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Possible bug in `expt'. (was: calc: E command hangs Emacs.)
       [not found]               ` <E1IYgkh-000069-ME@fencepost.gnu.org>
@ 2007-09-21 11:49                 ` Michaël Cadilhac
  0 siblings, 0 replies; 7+ messages in thread
From: Michaël Cadilhac @ 2007-09-21 11:49 UTC (permalink / raw)
  To: bob; +Cc: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1965 bytes --]

"Robert J. Chassell" <bob@rattlesnake.com> 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" <yujie052@gmail.com> 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?     |
 `----  michael.cadilhac@gmail.com  |          -- Stefan Monnier        -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calc: E command hangs Emacs.
       [not found]               ` <42b562540709232026s650e98ebgbeb780881565c0fa@mail.gmail.com>
@ 2007-09-24  6:49                 ` Michaël Cadilhac
  2007-10-01  9:17                   ` Michaël Cadilhac
  0 siblings, 1 reply; 7+ messages in thread
From: Michaël Cadilhac @ 2007-09-24  6:49 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1264 bytes --]

"yu jie" <yujie052@gmail.com> writes:

> On 9/21/07, Michaël Cadilhac <michael@cadilhac.name> wrote:
>>
>> >> (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))
>>
>> > *Message*:
>> > 1.Expt is 1.000000e+000
>> > 1.`x' is now 0
>> > 1.Expt is 1.000000e+000
>> > 1.`x' is now 0
>> > 1.Expt is 1.000000e+000
>> > 1.`x' is now 0
>> > 1.Expt is 1.000000e+000
>> > Loading debug...done
>> > Entering debugger...
>>
>> Thanks a lot.  As I read the pow(3) man page, the fact that it triggers
>> a ERANGE error is not documented, so it doesn't seem standard.
>>
>> IMO, we should check by hand if an (under|over)flow is triggered.

> Hi,
> it works.:)

We can then consider installing the following patch which fixes an
overflow of expt (namely that (expt 10.0 256) yields 0) on some system
that implement pow(3) without an ERANGE error (e.g., Cygwin).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: floatfns.patch --]
[-- Type: text/x-patch, Size: 753 bytes --]

--- floatfns.c	26 Jul 2007 07:27:51 +0200	1.94
+++ floatfns.c	21 Sep 2007 11:22:16 +0200	
@@ -454,7 +454,7 @@
      (arg1, arg2)
      register Lisp_Object arg1, arg2;
 {
-  double f1, f2;
+  double f1, f2, f3;
 
   CHECK_NUMBER_OR_FLOAT (arg1);
   CHECK_NUMBER_OR_FLOAT (arg2);
@@ -500,8 +500,11 @@
   else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor(f2)))
     domain_error2 ("expt", arg1, arg2);
 #endif
-  IN_FLOAT2 (f1 = pow (f1, f2), "expt", arg1, arg2);
-  return make_float (f1);
+  IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
+  /* Check for overflow in the result.  */
+  if (f1 != 0.0 && f3 == 0.0)
+    range_error ("expt", arg1);
+  return make_float (f3);
 }
 
 DEFUN ("log", Flog, Slog, 1, 2, 0,

[-- Attachment #1.1.3: Type: text/plain, Size: 327 bytes --]


-- 
 |   Michaël `Micha' Cadilhac       |  Le docteur : Je panse donc j'essuie,  |
 |   http://michael.cadilhac.name   |  Le voleur aillant trop avoué :        |
 |   JID/MSN:                       |     J'épenche donc je fuis.            |
 `----  michael.cadilhac@gmail.com  |                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: calc: E command hangs Emacs.
  2007-09-24  6:49                 ` calc: E command hangs Emacs Michaël Cadilhac
@ 2007-10-01  9:17                   ` Michaël Cadilhac
  0 siblings, 0 replies; 7+ messages in thread
From: Michaël Cadilhac @ 2007-10-01  9:17 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 960 bytes --]

michael@cadilhac.name (Michaël Cadilhac) writes:

> We can then consider installing the following patch which fixes an
> overflow of expt (namely that (expt 10.0 256) yields 0) on some system
                                      Read -256.
> that implement pow(3) without an ERANGE error (e.g., Cygwin).
>
>
> --- floatfns.c	26 Jul 2007 07:27:51 +0200	1.94
> +++ floatfns.c	21 Sep 2007 11:22:16 +0200	

> +  IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2);
> +  /* Check for overflow in the result.  */
> +  if (f1 != 0.0 && f3 == 0.0)
> +    range_error ("expt", arg1);
> +  return make_float (f3);

Installed.

-- 
 |   Michaël `Micha' Cadilhac       |  Perhaps we should start               |
 |   http://michael.cadilhac.name   |     making protest releases            |
 |   JID/MSN:                       |   before doing a fall release.         |
 `----  michael.cadilhac@gmail.com  |          -- David Kastrup         -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-10-01  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-18  1:14 calc: E command hangs Emacs yu jie
2007-09-18 14:16 ` Michaël Cadilhac
     [not found]   ` <42b562540709181923t54c3876of89a0c3322b459cc@mail.gmail.com>
2007-09-19 15:01     ` Michaël Cadilhac
     [not found]       ` <42b562540709191805tdbc3da4xf0f8d0cc2456cada@mail.gmail.com>
     [not found]         ` <876425n5gg.fsf@cadilhac.name>
     [not found]           ` <42b562540709201741s28d34896h9c6a69b8db676794@mail.gmail.com>
2007-09-21  9:25             ` Michaël Cadilhac
     [not found]               ` <E1IYgkh-000069-ME@fencepost.gnu.org>
2007-09-21 11:49                 ` Possible bug in `expt'. (was: calc: E command hangs Emacs.) Michaël Cadilhac
     [not found]               ` <42b562540709232026s650e98ebgbeb780881565c0fa@mail.gmail.com>
2007-09-24  6:49                 ` calc: E command hangs Emacs Michaël Cadilhac
2007-10-01  9:17                   ` Michaël Cadilhac

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.