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 724114 - Gnome-Calculator gives wrong answer for 0^0
Gnome-Calculator gives wrong answer for 0^0
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-11 13:29 UTC by elita astrid angelina lobo
Modified: 2014-03-15 19:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sets 0^0 as undefined or indeterminate (799 bytes, patch)
2014-02-11 15:01 UTC, elita astrid angelina lobo
none Details | Review
sets 0^0 as indeterminate or undefined (800 bytes, patch)
2014-02-11 15:28 UTC, elita astrid angelina lobo
needs-work Details | Review
Corrected patch : Sets 0^0 as undefined . (596 bytes, patch)
2014-02-12 17:46 UTC, elita astrid angelina lobo
needs-work Details | Review
patch for setting 0^0 as undefined with required changes in indentation. (596 bytes, patch)
2014-02-13 11:20 UTC, elita astrid angelina lobo
needs-work Details | Review
Patch for 0^0 error (931 bytes, patch)
2014-02-19 05:21 UTC, elita astrid angelina lobo
committed Details | Review

Description elita astrid angelina lobo 2014-02-11 13:29:01 UTC
Although the value of 0^0 is still an ambiguity , but many have been able to prove that 0^0 is indeterminate or undefined considering the fact that zero is neither a positive or negative number.Gnome-Calculator gives 0^0=1 which I believe was set as per previous conventions. Respected Maintainer, please consider my patch if you think that 0^0 is indeterminate and raising it as an error would probably be appropriate as per general math conventions.
Comment 1 Michael Catanzaro 2014-02-11 14:50:45 UTC
My TI agrees that 0^0 is an error.

> Respected Maintainer, please
> consider my patch

Could you attach it to this bug using the Add an attachment link below?
Comment 2 elita astrid angelina lobo 2014-02-11 15:01:16 UTC
Created attachment 268794 [details] [review]
sets 0^0 as undefined or indeterminate
Comment 3 elita astrid angelina lobo 2014-02-11 15:28:54 UTC
Created attachment 268802 [details] [review]
sets 0^0 as indeterminate or undefined

Sir, I apologize for having submitted a wrong patch earlier. I have attached the correct patch below. Kindly review it and let me know if i need to make any further changes in the patch. thankyou
Comment 4 PioneerAxon 2014-02-12 14:19:09 UTC
Review of attachment 268802 [details] [review]:

The patch looks good.
Can you please fix the issue before the patch is accepted?

Thank you.. :)

::: src/number.vala
@@ +888,3 @@
     public Number xpowy (Number y)
+    {   
+        

You shouldn't be modifying lines that doesn't contribute anything in solving a bug.
Comment 5 Michael Catanzaro 2014-02-12 15:12:48 UTC
Review of attachment 268802 [details] [review]:

::: src/number.vala
@@ +910,3 @@
+        mperr(_("Zero raised to zero is undefined"));
+        return new Number.integer(0);
+        }

Also, try to follow the style of the surrounding code:

* Place a space between the if and the opening parenthesis
* Place spaces around the == operator
* Indent the entire body of the if statement by four spaces
* Use a C-style /* comment */ rather than a //
* Place a space before each opening parenthesis in a function call (except for the underscore function, that's fine as-is)
Comment 6 elita astrid angelina lobo 2014-02-12 17:46:02 UTC
Created attachment 268945 [details] [review]
Corrected patch : Sets 0^0 as undefined .

Sir, I have made the required changes in the patch as you suggested.Kindly review the patch I have attached below.
Comment 7 PioneerAxon 2014-02-13 07:03:49 UTC
Michael,
Thank you for that. :)

Elita,
You don't need to be formal at all. Please, make yourself home. :)

One more thing. When you upload a new patch, please mark the older one as obsolete, so that it is not shown in the attachment list thereafter.
Comment 8 PioneerAxon 2014-02-13 07:05:54 UTC
Review of attachment 268945 [details] [review]:

::: src/number.vala
@@ +916,3 @@
+            /* Translators: Error displayed when attempted to raise 0 to  power of zero */
+            mperr(_("Zero raised to zero is undefined"));
+            return new Number.integer(0);

As Michael pointed out, you should add a space before opening parenthesis of a function call.
i.e. mperr (_("...")); instead of mperr(_("..."));

Also, when you fix this, remove double space from translator comment. It's not critical.
Comment 9 elita astrid angelina lobo 2014-02-13 11:20:09 UTC
Created attachment 268997 [details] [review]
patch for setting 0^0 as undefined with required changes in indentation.

 I am not quite sure about which double space were you exactly referring to but I have made the necessary changes. Please let me know if I have yet missed out something. Thankyou.
Comment 10 PioneerAxon 2014-02-18 05:16:47 UTC
Review of attachment 268997 [details] [review]:

Hi,

The patch looks good. However it can not be applied to repository as it is not generated using git format-patch.
Steps to generate a git patch are :
1. Add the changed files to staging using "git add <filenames>"
2. Commit the changes using "git commit" and add a descriptive useful title of patch.
3. You can generate the patch for last commit using "git format-patch HEAD~1".

It will generate the file with name "0000-<commit message>.patch". Upload that patch to bugzilla so that I can apply the patch.

Also, make sure you have set up your name and email to git.

Thank you.. :)
Comment 11 elita astrid angelina lobo 2014-02-19 05:21:59 UTC
Created attachment 269662 [details] [review]
Patch for 0^0 error
Comment 12 Michael Catanzaro 2014-02-21 15:23:36 UTC
Thanks! I reworded the commit message a bit. I'll also announce the string change, since we're in the string change announcement period.