Incorrectly calculating of percentages

Bug #1465680 reported by Maxim Taranov
38
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Calculator
Won't Fix
Medium
Unassigned

Bug Description

When adding or subtracting the percentage taken from 1, but not from the number entered.

Related branches

Revision history for this message
Yuly Nesterov (inpr1se) wrote :

Same problem.

Revision history for this message
Danielle Foré (danrabbit) wrote :

OP, can you post a sample equation? I'm unsure I understand how to reproduce the problem.

Changed in pantheon-calculator:
status: New → Incomplete
Revision history for this message
Maxim Taranov (png2378) wrote :

For example, "100+25%=100.25" or "100+100%=101".

Revision history for this message
Marvin Beckers (embik) wrote :

I still do not understand this bug report, sorry. "100 + 25% = 100.25" is expected behaviour. 25% IS 0.25 - if you want to add 100% and 25%, type in "100% + 25%".

Revision history for this message
Leonid Semenov (s3rious) wrote :

Marvin, nope. This in not completely true.
25% is 0.25 only if it’s a 25 percent of 1.
But I’m not expect it should be percentage of 1, I’m expect if be percentage of previous calculation.

Look at the Wolfram, it does calculation completely right. http://www.wolframalpha.com/input/?i=100+%2B+5%25
It took 100, get 5% of 100 (5) and sum it.

More coplexly. http://www.wolframalpha.com/input/?i=100+%2B+50+%2B+5%25
It took 100, add 50 to 100, and sum the 150 and 5% of 150 (7.5).

Got it?

Revision history for this message
Marvin Beckers (embik) wrote :

Well, looks like every other calculator is working that way, thanks for finally clarifying that bug report. I honestly did not know about that before. Marking this bug accordingly.

Changed in pantheon-calculator:
status: Incomplete → Confirmed
importance: Undecided → Medium
Revision history for this message
Leonid Semenov (s3rious) wrote :

Marvin, Nope.
Google calculates almost fine. It can calculate simple stuff, but fails on complex.

Here:
https://www.google.com/search?newwindow=1&q=100%20%2B%2050%20%2B%205%25&rct=j

It calcs like this: 100 + (50 + 5%), but it should do it this (100 + 50) + 5%.

Also windows calc do it fine, and os x too, but just because them are "step-by-step" calculators.

Revision history for this message
Marvin Beckers (embik) wrote :

Okay, stop confusing me now. Is this bug valid to you or not?!

Revision history for this message
Leonid Semenov (s3rious) wrote :

Marvin. Totally valid.

Revision history for this message
Brandon (brandonbocklund) wrote :

I don't think this is valid.

    Google gives the following calculations:
        10 + 5 - 10% = 14.5
        10 - 10% + 5 = 14

    Wolfram Alpha gives the following:
        10 + 5 - 10% = 13.5
        10 - 10% + 5 = 13.5

    web2.0calc.com gives the following:
        10 + 5 - 10% = 13.5
        10 - 10% + 5 = 14

    Excel gives the following:

        =10 + 5 - 10% = 1490% = 14.9
        =10 - 10% + 5 = 1490% = 14.9

    I don't have a Ti calculator on hand, but I'm not sure if it would interpret the % anyways.

Revision history for this message
Leonid Semenov (s3rious) wrote :

Brandon, it seems web2.0calc.com is only valid one.
Second calculation must be interpreted like a (10 - 10%) + 5, when 10% is 10% out of 10.

I've does not really understand why wolfram calc the (10% + 5) with higher priority, but thats wrong.

Revision history for this message
Brandon (brandonbocklund) wrote :

It seems to me that it's an unsafe assumption to use % as anything other than a decimal (e.g. 10% = 0.10).

E.g.

x - 10% is interpreted as x - x*10%, because 10% should always be assumed as 10% of 1 mathematically. Just like x is really x*1.

Revision history for this message
Djax (parnold-x) wrote :

Mathematically exact it is like Brandon said.

But for most use cases maybe the other behavior is useful when it is not leading to false results.

Revision history for this message
xapantu (xapantu) wrote :

Ok, let's sum up:

10 + 10% = 11
10 + (10% + 5%) = 10 + (15%) = 11.5 OR 10 + (10% + 5%) = 10 + (10% * 1 + 5%) = 10 + (0.1+5%) = …
(10 + 10%) + 5% = …

10 + 10% = 10 + 1*10% = 10.1

Seriously, 10% = 0.1, period.

Suggestions welcomed, but as far as I can see, what is proposed here is not possible.

People got to learn maths, sorry :P

Changed in pantheon-calculator:
status: Confirmed → Opinion
status: Opinion → Won't Fix
Revision history for this message
Lewis Goddard (lewisgoddard) wrote :
Revision history for this message
lexsurkov (lexsurkov) wrote :

I offer in case of entering the expression of 10-10%, a message 'not a valid expression ". If I need to subtract 10% I have to write a 10-10 / 100. I think that this is correct and understandable.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.