After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 157021 - Gcalctool can't do ^(1/3) for negative numbers
Gcalctool can't do ^(1/3) for negative numbers
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2004-11-01 11:26 UTC by Marco Pesenti Gritti
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.7/2.8



Description Marco Pesenti Gritti 2004-11-01 11:26:47 UTC
I typed the sequence:

27
(+/-)
^
3
(1/x)
=

the Gcalctool then show ERROR

To reproduce this on 5.5.0 I have to disable arithmetic precedence.
Comment 1 Marco Pesenti Gritti 2004-11-01 11:27:42 UTC
UPSTREAM

http://bugzilla.gnome.org/show_bug.cgi?id=157021
Comment 2 Rich Burridge 2004-11-02 18:07:08 UTC
Taking this back. I misread the description and thought the
problem was with the new arithmetic precedence mode.
The problem can be simply recreated with
27
+/-
x^y
3
=

Investigating...
Comment 3 Rich Burridge 2004-11-02 18:13:36 UTC
Here's the stack trace for the error:

t@1 (l@1) stopped in doerr at line 1214 in file "calctool.c"
 1214       if (!v->started) {
t@1 l@1 <3> where                                                            
current thread: t@1
=>[1] doerr(errmes = 0x75ae8 "Error"), line 1214 in "calctool.c"
  [2] mperr(), line 1966 in "mp.c"
  [3] mppwr2(x = 0xa0188, y = 0x9df10, z = 0xa0188), line 3365 in "mp.c"
  [4] do_calc(), line 476 in "functions.c"
  [5] process_item(button = 0x8c610), line 560 in "display.c"
  [6] button_proc(widget = 0x258d38, user_data = 0x1a), line 618 in "gtk.c"
...
Comment 4 Rich Burridge 2004-11-02 18:24:45 UTC
The problem is that the mppwr2() routine specifically checks that 
for x^y, x is not a negative number. 
Comment 5 Rich Burridge 2004-11-04 18:33:50 UTC
Changes have been added to fix this for non-arithmetic precedence mode.
for x ^ y, if x is negative and y is an integer, then the mppwr() MP
routine is used instead of mppwr2(). Added a new calc_xpowy() routine
in mpmath.c to do this calculation. Also added a show_error() routine
to functions.c to display the error in the status bar if the user
enters -X with non-integer Y.

Sami will be adding a similar change for arithmetic operator precdedence
mode, and after that we can close out this bug.

Comment 6 Rich Burridge 2004-11-04 20:53:28 UTC
Sami has checked in the other part of the fix.
I've bumped the version number in configure.in to
5.5.10, but I'm not going to generate a new tarball
to nearer the time of the next GNOME 2.9 "call for 
tarballs".