The Windows calculator percent sign works the same way as those cheap pocket calculators (which are often called four-function calculators even though they have around six function nowadays). What you first have to understand is that the percent key on those pocket calculators was not designed for mathematicians and engineers. It was designed for your everyday person doing some simple calculations. Therefore, the behavior of the key to you, an engineer, seems bizarrely counter-intuitive and even buggy. But to an everyday person, it makes perfect sense. Or at least that's the theory.

Let's look at it from the point of view of that everyday person. Suppose you want to compute how much a $72 sweater will cost after including 5% tax.¹ Pull out your handy pocket calculator² (or fire up Calc if you don't have a pocket calculator) and type

72 + 5% =

The result is 75.6, or $75.60, which is the correct answer, because 5% of 72 is 3.6. Add that to 72 and you get 75.6.

Similarly, suppose that sweater was on sale at 20% off. What is the sale price?

72 − 20% =

The result is 57.6 or $57.60. This is the correct answer, because 20% of 72 is 14.4. Subtract that from 72 and you get 57.6.

You can chain these percentage operations, too. For example, how much will you have to pay for that 20%-off sweater after adding 5% tax?

72 − 20% + 5% =

The result is 60.48. A mathematician or engineer would have calculated the same result via the equivalent computation:

72 × 0.80 × 1.05 =

Okay, now that we see how the calculator product designer intended the percent key to be used, let's look at what the calculator engineer it has to do in order to match the specification. When the user enters

Aha, the calculator engineer says, we can achieve this result by defining the percent key as follows:

When the user enters a value, an operator, a second value, and then the percent key, the first two values are multiplied and the product divided by 100, and that result replaces the second value in the ongoing computation.

Let's walk through that algorithm with our first example.

You type | Remarks |
---|---|

72 | First value is 72 |

+ | Operation is addition |

5 | Second value is 5 |

% | 72 × 5 ÷ 100 = 3.6 |

3.6 becomes the new second value | |

= | 72 + 3.6 = 75.6, the final result |

If you watch the display as you go through this exercise, you will even see the number 3.6 appear in the display once you press the % key. The percentage is calculated and replaces the original value in the ongoing computation.

This algorithm also works for the chained percentages.

You type | Remarks |
---|---|

72 | First value is 72 |

− | Operation is subtraction |

20 | Second value is 20 |

% | 72 × 20 ÷ 100 = 14.4 |

14.4 becomes the new second value | |

+ | 72 − 14.4 = 57.6, intermediate result |

57.6 is the new first value | |

Operation is addition | |

5 | Second value is 5 |

% | 57.6 × 5 ÷ 100 = 2.88 |

2.88 becomes the new second value | |

= | 57.6 + 2.88 = 60.48, the final result |

This even works for multiplication and division, but there is much less call for multiplying or dividing a number by a percentage of itself.

500 × 5 % =

The result of this is 12,500 because you are multiplying 500 by 5% of 500 (which is 25). The result of *of* 500. You're multiplying 500 by 5% of 500. (It appears that the authors of this Knowledge Base article didn't consult with the calculator engineer before writing up their analysis. The percent key is behaving as designed. The problem is that the percent key is not designed for engineers.)

What if you want to compute 5% of 500? Just pick a dummy operation and view the result when you press the percent key.

500 + 5 %

When you hit the percent key, the answer appears: 25. You could've used the minus key, multiplication key, or division key instead of the addition key. It doesn't matter since all you care about is the percentage, not the combined operation. Once you hit the % key, you get your answer, and then you can hit Clear to start a new calculation.

**Footnotes**

¹In the United States, quoted prices typically do not include applicable taxes.

²In my limited experiments, it appears that no two manufacturers of pocket calculators handle the percent key in exactly the same way. Casio appears to handle it in a manner closest to the engineering way. TI is closer to the layman algorithm. And when you get into cases like `1 ÷ 2 %`

`50`

, since 1/2 is equal to 50%? Or should it be `0.005`

since that is the numeric value of 0.5%? Should that answer appear immediately or should it wait for you to hit the equals sign? I don't know what the intuitive result should be either.

As a scientist/programmer, I don’t think I’ve ever used the % key on a calculator.

This is probably because when I’ve thought about it, I’ve never been able to guess what it could possibly do, or where it ought to be used in a calculation. "%" is a unit, not an operator. It’s like having a "kg" key for kilograms. What would that do?

Admittedly % is a dimensionless unit. I think my best guess has always been that "0.5 %" would convert to "50", effectively being a "multiply by 100" button. Similarly "2 %" would go to 200. But that’s so pointless that I never bothered trying it to find out.

Besides, turning "increase n by 20%" into "n × 1.2" in my head is simple and unambiguous, so I’d never bothered to see if that’s what it actually does.

Nice to learn something new though.

There is a % key on a calculator? I never even noticed it, as an engineer I always did did the conversion.

Jim

I’m amused in that I never even noticed the windows calculator had a percent key, because I’ve always immediately switched it to scientific mode, where, as far as I can tell, there is no percent key :)

I’ve never used the % key either. I also neither know how it works nor how it should work on most calculators.

I just pulled out my "scientific" Casio calculator to try it, which gives the following rather strange results.

These seems rather plausible to me:

100 × 5 % = 5

100 / 5 % = 2000

But I don’t really understand those:

100 + 5 % = 2100

100 – 5 % = 1900

100 + 1 % = 10100

Today I feel slightly less stupid. A few weeks back I was trying to teach a not very mathematical friend how to work out percentages on a calculator. I ended up showing her the engineers way, because I couldn’t for the life of me figure out what the magical % key was doing. Now I know!

I’m used to the way the % key works on "layman" calculators, and it kind of annoys me that most scientific calculators don’t have it. My trusty TI-85 graphic calculator that I’ve been using for the last decade and a half doesn’t have a % key, for example.

I’m probably used to it because I used to work retail, and we used those calculators to calculate tax rates and discounts all the time. I’m sure that’s the context it’s designed for, you carry it to the supermarket then you can see what 20% off actually means to the price.

I’ve seen some scientific calculators where the % key is used to change your decimal result (0.25) into a percentage (25%), basically it just multiplies by 100. That still doesn’t explain Andre’s results, though… I have no idea what his Casio is doing. (Unless it’s just busted. Or he’s pranking us with fake values.)

"

PingBack from […]

"

I’m sure this pingbacker’s is an evil bot. The target blog has absolutely no content. It points to random unrelated blogs. Every enty has the same structure.

The pingback probably provides page rank for the target blog, which itself must be used to give page rank to specific pages…

"

But I don’t really understand those:

100 + 5 % = 2100

100 – 5 % = 1900

100 + 1 % = 10100

"

10100 = (100 + 1) * 100, but I really cannot understand 100 + 5 % = 2100

Otherwise, the algorithm of the % function may be something like:

1) Compute the pending operation.

2) If it’s a multiplication, the result is divided by 100.

3) Else, the result is multiplied by 100.

Step (3) was designed with division in mind as the only operation it was designed for are multiplication and division.

Addition and substractions were ignored from the design.

Nice, these so-obvious-once-they-are-explained moments are why I keep reading your postings.

Ditto on the Karellen comment on never knowing intuitively how % unit should work in a calculation. Although I would have assumed that 50 + % would translate to 50%, so 0.5 (As in 20*50% = 10)

James Schend, Re: busted or pranking us, I’m getting the exact same results with a Casio fx-115MS

You could always read the manual. Casio’s percent key is um kind of weird. -Raymond]My Royal 4-function calculator gives the answer when you press the % key.

100 + 5 % (here the answer, 105, shows up)

100 x 5 % (here the answer 5 shows up)

If I type 100 + 5 % = I get 205.

500 * 5% = 12,500

It’s not the calculator’s fault the user is dumb.

"

Example 5: […]

Press: 300 + 500 % to give result of "160."

"

I would NEVER have guessed that. That is certainly the most counter-intuitive function I’ve seen.

@g: Wow. Did they do that intentionally? That has to be the most unintuitive thing ever.

They should just get rid of the percent key. It is not implemented the same across different brands (or even different models of the same brand) and there really isn’t a "correct" implementation, as each vendor has a different interpretation of what it should do. Either come up with an industry-wide standard, or (preferably) just get rid of it entirely.

This takes me back. About 10 years ago, I helped add a calculation field to a custom Visual Basic application. The user could enter an arithmetic expression (including percentages) and the field would display the result.

The senior developer implemented this by sending calc.exe the text string as keystrokes followed by CTRL-C, retrieving the result from the clipboard, and displaying it in our results field. (The Calculator window didn’t appear on screen when this happened, but if you looked fast enough, you could see the calc.exe process.) It worked, but I felt it was an ugly kludge.

A week or two after the new feature went into production…"This calculation field doesn’t work!" the customer screamed. "It gives the wrong results for percentages!"

The senior developer and I went on site. He demonstrated that if the exact same calculations were entered into the Windows calculator, they yielded the same result as the application. The customer was appeased, since Bill Gates wouldn’t write a calculator that was wrong.

The calculator on my Palm behaves exactly the same way, so it isn’t just a Microsoft convention. The % key also isn’t there in advanced mode.

I’m guessing this is probably intentional; anybody who needs more than the basic four functions on a calculator probably knows how to calculate a percentage without the button, and would likely be confused by the button’s behavior.

The Casio behaviour almost seems to be tailored toward students – primarily those in junior high or high school, but possibly university students in non-scientific streams, like business. The examples they give sound exactly like what I used to find in the pointless repetitive homework assignments. And thinking back, I seem to recall being forced to buy some particular Casio calculator along with the engineering books.

Which also kind of makes sense, if you think about it. Who really uses scientific calculators, other than students? Not scientists – they usually use domain-specific software or graphing calculators.

Thanks for the great post! Learn something new every day…

Although I don’t think I’ve ever seen anybody use the ‘%’ key on a calculator (maybe because I tend to hang out with scientists and engineers), I do remember back when I was at school having a few lessons on calculator usage. I think the teacher just told us "not to use" the ‘%’ key because, in her opinion, it was confusing.

I never noticed the % either because I always run calc in scientific mode. If you had asked me what it did before I read this article, I would have guessed it changed 15 to 1.15 and -15 to 0.85.

Here’s a weird one. Windows Calculator in Scientific mode. Enter 500 + 5% =. (Type the % as there’s no % button). The result is 1000. It appears to have discarded the 5%, while still showing ‘5’, and performed 500+=, which it considers equivalent to 500+itself. Keep pressing ‘=’ and it’ll add 500 each time. Very annoying if you happen to hit ‘=’ by mistake. This is why I use PowerToy Calculator instead.

Sorry am I going mad or are posts moving around or going missing on the main page?

Regarding that hucalc.pdf, he actually put his money where his mouth is an designed a prototype for tablet computers:

http://www.cs.swansea.ac.uk/calculators/see.html

"Here’s a weird one. Windows Calculator in Scientific mode. Enter 500 + 5% =. (Type the % as there’s no % button). The result is 1000."

Not weird because in scientific mode the % becomes the modulus operator. So you’re entering a malformed expression and the calculator is handling it as best it can:

500 + 5 mod = 500 + 500 = 1000

Now if you completed that expression, you’ll get the answer you expect:

500 + 5 % 2 = 501

Thank you Mr Chen. Learned a lot for the posting, we are humen but we are different, we can not design a feature (even the simplest one) to please everybody!

@John: It’s in the manual, and they seem to have designed it that way, so I guess it’s intentional. If words like "intentional", usually taken to imply something resembling a functioning brain, can be said to apply to someone who’d design something like that.

(I think Aaron’s guess as to why they did it is the nearest thing to a coherent explanation that’s possible.)

@asdf: Coo!

I wonder why calculator doesn’t also have sqrt in scientific mode?

"I wonder why calculator doesn’t also have sqrt in scientific mode?"

It does, in a roundabout way– you have to do it like:

Instead of pressing 9 <sqrt button>

You have to press 9 <x^y> .5

It’s slower, but it has the added bonus of being able to calculate other-ordered roots as well.

My trusty 15 years old HP 27S (S for "scientific") actually works in the "calc.exe" way:

100 + 5% = 105

It also calculates the % amount when you press the "%" key, so before hitting "=" you can see:

100 + 5

Funny thing is, I discovered this just a couple of months ago; earlier I kept doing it the old fashioned way, i.e. 100 x 1,05.

(Raymond, why not a comment in Swedish to refresh your language skills:)

Jag har sett kalkylatorer med procentknapp i mer än 30 år nu, men aldrig riktigt förstått hur det var tänkt att fungera. Förrän idag, tack för det inlägget!

Igor: To get a square root in Windows Calculator when in Scientific mode, check the [Inv] box and then click the [x^2] button.

(Or, on the keyboard, press I @.)

My el-cheapo Casio EL-330L treats the % as a special kind of =. Pressing "100+5%=" is 205… 100+5+100.

Very cool post. It’s made me look like I’m working on something important. :-)

In my opinion the design of CALC.EXE is still wrong.

The % should perform as "a special kind of = key" and not intorduce the assumption that the operation is "ongoing" (that’s the engineer thinking, exactly what you claim that should’t be there). Simply, % should *finish* the current operation. Now:

Let X, Y be numbers and @ operator.

When

X @ Y %

is entered

if @ is + the RESULT should be X + ( Y percent of X )

if @ is – the RESULT should be X – ( Y percent of X )

if @ is * the RESULT should be ( Y percent of X )

if @ is / the RESULT should be X / ( Y percent of X )

As far as I can remember, all the calculators I’ve used had that logic.

Rationale:

How would you, with your behaviour, key in "5 percent of 500 plus 25"?

With the algorithm I’ve described, you can simply type

500 * 5 % + 25 =

and get 50

That’s the scenario that the mentioned knowledge base article complains about, and declares the observed behaviour as the bug.

My Casio fx-115W does the same thing for addition and subtraction with the % key. Page 15 of the manual (http://ftp.casio.co.jp/pub/world_manual/edu/en/fx115W_991W_E.pdf) gives the following examples to explain what it’s doing:

Example 1: To calculate 12 % of 1500

Press: 1500 * 12 % to give result "180."

Example 2: To calculate what percentage of 880 is 660

Press: 660 / 880 % to give result of "75."

Example 3: To add 15% onto 2500

Press: 2500 * 15 % + to give result of "2875."

Example 4: To discount 3500 by 25%

Press: 3500 * 25 % – to give result of "2625."

Example 5: If 300 grams are added to a test sample originally weighing 500 grams, what is the percentage increase in weight?

(300 + 500) / 500 * 100 = 160 (%)

Press: 300 + 500 % to give result of "160."

Example 6: If temperature changes from 40 degrees to 46 degrees, what percentage did it rise?

(46 – 40) / 40 * 100 = 15 (5)

Press: 46 – 40 % to give result of "15."

This seems very counter-intuitive to me, and like others here, I would never use the percentage button in practice, because I’d never be quite sure what it does.

I also have a Casio calculator. I can confirm Andre’s results, and observe that the "obvious" conjecture that entering x [+ or -] y% replaces y% with 100x/y is refuted if you try some other values:

2000 + 5 % ==> 40100

2000 – 5 % ==> 39900

from which it appears (very bizarrely) that

x OP y % == 100 OP 100*x/y

when OP is + or -, but something entirely different happens for * and /. It’s hard even to imagine what sort of bug would produce this behaviour.

… Ah, all becomes clear (kinda) on reading the excellent document at http://www.uclic.ucl.ac.uk/harold/srf/hucalc.pdf which explains what the % key is supposed to mean on Casio’s calculators. Apparently x + y % means "the percentage increase when going from y to x+y" and x – y % means "the (negative) percentage increase when going from y to x-y". So, e.g., 2000+5% is 40100 because 2005 is 40100% of 5. Astonishing.

You can get sensible results for all four operations (well, in so far as dividing by a percentage can mean anything sensible) if you treat percentages as a different data type. The "%" key sets the is-percentage flag on the currently displayed value; multiplying by a percentage = multiplying by (that/100); adding or subtracting a percentage = multiplying it and adding to or subtracting from the value you started with. This works OK if your calculator handles arithmetic precedence and you stick a % into the middle of a calculation: 1 + 5 % * 20 will do 1+(5%*20) = 1+1 = 2. It works OK if you chain percentages (provided you say that multiplying by a percentage preserves the percent flag on the other factor): 5 % * 5 % = 0.25%. Presumably you’d either want to display a % sign when the end result of a calculation is a percentage, or else have percentages decay to ordinary numbers on display. Probably the latter.

(It’s probably actually better to have an is-fraction flag rather than an is-percentage flag, make % replace x with FRACTION(x/100), and display FRACTION(f) as 100*f. That makes all the other operations simpler.)

Raymond, your brain called – it wants those 2 hours of its life back.

Wish I had that much free time to write about fluff like this…

The topic was inspired by a customer question, believe it or not. Instead of spending 2 hours explaining it to the one customer, I figured I’d tell everybody. That way when the next customer asks, it’ll take me just 20 seconds. -Raymond]@ace: if you are going to redesign something, you have to do it correctly. You suggest the following:

When

X @ Y %

is entered

if @ is + the RESULT should be X + ( Y percent of X )

if @ is – the RESULT should be X – ( Y percent of X )

if @ is * the RESULT should be ( Y percent of X )

if @ is / the RESULT should be X / ( Y percent of X )

WHY treat * different than the other operators? THIS isn’t intiutive.

On the other hand there doesn’t appear to be a way to get JUST "5% of 500"

chrismbc wrote:

"

WHY treat * different than the other operators? THIS isn’t intiutive.

"

Obviously, division should be treated the same way than multiplication.

For example:

x*y% = x*y/100

x/y% = x/(y/100)

This is the way gcalctool and kcalc do it.

However, gcalctool interprets x+y% as x+y/100 and x-y% as x-y/100 while kcalc interprets x+y% as x+x*y/100 and x-y% as x-x*y/100 as Windows calc.exe does.

I think that the complex behavior of kcalc is the most intuitive one (respecting everyday persons and engineers expectations), while gcalctool’s behavior is the simpliest to understand: % meaning ‘hundredth’.

Anyway, I think the same as John: There’s no single "correct" way to implement the % operator. Implementations vary widely… Far more widely than I would’ve expected.

This is quite interesting, and serves to cement my belief that I’ve been right to never learn how to use the [%] key. I fear it would have warped my mind beyond possible recovery. Multiplying by a fraction seems so much easier.

My trusty Sharp EL-531GH has a pretty simple algorithm.

For additive operators (+ and -), % calculates the left hand side (using precedence) and multiplies it by the current value divided by 100. This new values replaces the current value onscreen. This is a bit like Windows calc.exe, albeit better (more affordance because you see it on screen).

For multiplicative operators (* and /), % divides the current value by 100. This means it correctly calculates 100 * 5%, and turns division into a ratio -> percentage calculation. What’s 34 / 56 as a percentage? ’34 / 56 %’ will get the answer.

"You have to press 9 <x^y> .5"

You can also do it by entering 9 Inv x^2 (or 9 i @ on keyboard).

Lol, I i didn’t know there is a percent-key either, cause i’m using the scientific mode… Never seen him there…:P

Quote: [The topic was inspired by a customer question, believe it or not. Instead of spending 2 hours explaining it to the one customer, I figured I’d tell everybody. That way when the next customer asks, it’ll take me just 20 seconds. -Raymond]

I hope you’ll read your disclaimer to the next customer. :)

"For additive operators (+ and -), % calculates the left hand side (using precedence) and multiplies it by the current value divided by 100. This new values replaces the current value onscreen. This is a bit like Windows calc.exe, albeit better (more affordance because you see it on screen)."

I’m not sure what’s different… calc displays it on screen too:

Type: 250 [Display: 250]

Type: + [Display: 250]

Type: 7.5 [Display: 7.5]

Type: % [Display: 18.75]

Type: = [Display: 268.75]

"That way when the next customer asks, it’ll take me just 20 seconds."

It takes 20 seconds to tell them there’s such a thing as a search engine…

Heh. Good move, Raymond.

Why isn’t this covered in the help file for calc?

LOL. I use the Windows Calculator regularly (always in scientific mode). I didn’t notice it doesn’t have a % key in sci mode. I never use the % key on any calculator.

PingBack from http://blog.teqedge.com/2008/01/15/trouble-in-microsoft-world-over-calculator/

Like a lot of teachers I have use the four-function calculator project as a way to introduce various

whose with casio forgot that you can use 5Xy4%, and 5(nth root of)4%. Not sure what they do. And also 5C4% and 5P4% works (not funny though)

PingBack from http://www.sanjuansoft.com/blog/2008/05/%e8%ae%a1%e7%ae%97%e5%b0%8f%e8%b4%b9%e7%9a%84%e6%96%b9%e6%b3%95/

PingBack from http://www.vbdotnetforums.com/vs-net-general-discussion/29752-organize-code-andalso-calculator-question.html#post87945