Blog
Calculations - What mistakes can happen when we fail to use round brackets correctly in calculations?
What can go wrong when we fail to use brackets correctly in mathematical calculations? This post provides an example.
8 ÷ 2 x (2 + 2)What do you think is the answer to this question?
What answers do most people give to this question?
What answer does Power Apps give?
When we carry out this calculation in Power Apps, the result is 16 - which is strictly the correct answer.
Why is there so much confusion?
The reason for this confusion appears to stem from a misunderstanding of how to apply mathematical operations in the correct sequence.
Specifically, schools in the US commonly teach the order of operations using the acronym PEMDAS. This stands for "Parentheses Exponents Multiplication Division Addition Subtraction", and is abbreviated to "please excuse my dear aunt Sally".
However, in the UK, Australia, and other English speaking countries, schools use the acronym BODMAS instead. BODMAS stands for "Brackets Order Division Multiplication Addition Subtraction".
Notice how with PEMDAS, multiplication comes before division whereas with BODMAS, division comes before multiplication. Therefore, someone using the BODMAS acronym can more likely be inclined to perform the calculation like so, which will result in 1.
8 ÷ (2 x (2 + 2))
What's the correct way to apply mathematical orders of operation?
With both PEMDAS and BODMAS, multiplication and division, and addition and subtraction are either/or operations, and this is the point that confuses many.- Division is the same as multiplying a number by a fractional number
- Subtraction is the same as adding a negative number
Therefore in this example, multiplication does not take precedence over division, and division also does not take precedence over multiplication.
(8 ÷ 2) x (2 + 2)
Conclusion
Finally, we leave on another of Kyle's puzzles. Three app-builders go out for dinner. Each app builder orders a pizza for $10. When the bill arrives, each app builder puts in a $10 bill. The waitress then tells the group - "good news, we have a special offer where we offer 3 pizzas for $25". The waitress leaves and comes back with the change (5 $1 bills). Each app builder takes $1, and they leave the remaining $2 as a tip. Afterwards, the app builders calculate what they've paid. Each app builder has effectively paid $9, which amounts to $27 in total. They left a $2 tip to the waitress, bringing the total to $29. What happened to the remaining $1?
- Categories:
- formulas
- Apps - Migrating OnStart formula to use App.StartScreen/ Fixing existing apps that implement deep linking
- Walkthrough - Solving maths puzzles with Power Apps
- Formulas - Review of how to write formulas using natural language
- Formula - converting centimeters/meters to feet and inches, and vice versa
- Dates - 4 tips to make sure that dates display correctly in UK "dd mm yyyy" format
- Formulas - How to calculate the distance between 2 points
- SharePoint - How to Patch the 6 most complex data types
- Formulas - Generating Row Numbers - Part 2
- Data - How to access nested collections/tables
- Formulas - Show Running Totals
- Formulas - Generating Row Numbers