Math Operations in iOS 12 Shortcuts
The Shortcuts app in iOS 12 includes dedicated actions for handling mathematical computations directly within automated workflows. From basic arithmetic and number formatting to advanced formula evaluation and statistical analysis, users can manipulate numeric data without relying on third-party scripts. Below is a comprehensive breakdown of the native math operations supported within iOS 12 Shortcut workflows.
Basic Arithmetic: The "Calculate" Action
The standard Calculate action performs fundamental two-variable operations. It accepts an input number, applies an operator, and computes the result against a secondary number or variable:
- Addition (+): Adds two numbers together.
- Subtraction (−): Subtracts the specified value from the input.
- Multiplication (×): Multiplies the input by another factor.
- Division (÷): Divides the input value by the specified divisor.
Complex Math: The "Calculate Expression" Action
The Calculate Expression action evaluates mathematical strings, allowing users to execute complex multi-step formulas in a single step. It parses expressions following the standard order of operations (PEMDAS/BODMAS) and supports:
- Parentheses for grouping:
(a + b) * c - Exponents and powers:
^ - Scientific notation and standard algebraic operators
- Common functions, including square roots, absolute values, and basic trigonometry.
Statistical Analysis: The "Calculate Statistics" Action
When working with a list or array of numbers, the Calculate Statistics action aggregates the data set using several statistical functions:
- Average: Calculates the arithmetic mean.
- Sum: Adds all numbers in the list together.
- Minimum: Returns the lowest value in the set.
- Maximum: Returns the highest value in the set.
- Median: Finds the middle value in the sorted list.
- Mode: Identifies the most frequently occurring value.
- Range: Computes the difference between the maximum and minimum values.
- Standard Deviation: Measures the amount of variation or dispersion within the data set.
Rounding and Formatting Numbers
Shortcut workflows also support fine-tuning numeric precision:
- Round Number: Rounds values to a designated decimal
place or whole number using three modes:
- Normal: Standard rounding (0.5 and up rounds up).
- Always Round Up: Ceiling function.
- Always Round Down: Floor function.
- Format Number: Adjusts how numbers appear, including decimal places, thousands separators, and currency-style formatting.
Random Number Generation
The Random Number action generates a pseudo-random integer or decimal value within a user-defined range by setting a specific minimum and maximum threshold.
Measurement Conversion
The Convert Measurement action handles unit conversions mathematically across categories such as length, temperature, mass, volume, speed, and duration, converting inputs accurately without requiring manual conversion ratios.