GNOME Bugzilla – Bug 724114
Gnome-Calculator gives wrong answer for 0^0
Last modified: 2014-03-15 19:10:35 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.
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?
Created attachment 268794 [details] [review] sets 0^0 as undefined or indeterminate
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
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.
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)
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.
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.
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.
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.
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.. :)
Created attachment 269662 [details] [review] Patch for 0^0 error
Thanks! I reworded the commit message a bit. I'll also announce the string change, since we're in the string change announcement period.