Bug 1487723 - gnome calculator doesn't handle negative numbers being raised to the power of
Summary: gnome calculator doesn't handle negative numbers being raised to the power of
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-calculator
Version: 26
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Ray Strode [halfline]
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-01 18:11 UTC by Andy P
Modified: 2018-05-29 12:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-29 12:23:50 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Andy P 2017-09-01 18:11:32 UTC
Description of problem: -2 squared = -4 and -2 cubed = -8 and -2 x -2 = 4 but the desktop calculator handles -2 x -2 correctly (+4), -2 squared incorrect (-4)
 


Version-Release number of selected component (if applicable):


How reproducible:
Always


Steps to Reproduce:
1. enter -2 x -2 = (ie, press minus, then 2, then times button, then minus then 2 then =) 
2. enter minus 2 then the x squared button then = button
3. enter minus 2 then xy button then 2 button then = button


Actual results:
1. gives 4
2. give -4
3. gives -4


Expected results:
1. should be 4
2. should be 4
3. should be 4

Additional info:
it looks like x squared button and xy button handle negative numbers wrong. I put high severity because a calculator shouldn't give the wrong result to simple math problems.

Comment 1 Andy P 2017-09-02 05:59:45 UTC
I've just realised that if I put parentheses around the -2 , so that it looks like (-2) x squared then it works as expected.

I still think this is a bug because:
-2 xy 3 gives the correct -8 answer

the behaviour between
-2 x2 =
-2 xy 3 =
appears to act differently

(-2) xy 3 =
gives the same answer as
-2 xy 3 =

I think it fair to assume simple people doing simple math would expect the calculator to behave as they would expect.

I've checked lots of different software calculators and half of them get this wrong and half get this right. Several hardware calculators that I have ALL behave as I would expect. Some calculators automatically put in parentheses for you, some have a separate +- button for negative numbers which I assume is to get around this issue.

I also note that
-2**2 or -2**3 in python3 works as your calculator and gives the wrong answer and (-2)**2 and (-2)**8 works as expected so I can see what is happening here but still feel that a simple calculator program should work as simple people would expect.

Comment 2 Fedora End Of Life 2018-05-03 08:03:59 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Fedora End Of Life 2018-05-29 12:23:50 UTC
Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26
is no longer maintained, which means that it will not receive any
further security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.