Skip to content
Math Notes Documentation
Open Math Notes

Numbers & operators

Math Notes evaluates expressions with the usual arithmetic operators, plus a set of word operators, number scales and rounding phrases that read like English.

Operators#

Operator Meaning
+ Add
- Subtract
* Multiply
/ Divide
^ Power
% Remainder
! Factorial
( ) Group
(4 / 2) ^ 2
returns 4
10 % 3
returns 1

Many more functions and operators are available — see the mathjs documentation. The reference lists the function aliases Math Notes adds.

Word operators#

Calculations can use words instead of symbols:

8 times 9
returns 72
2 plus 3
returns 5
10 minus 3
returns 7
6 multiplied by 7
returns 42
10 divided by 2
returns 5
10 over 2
returns 5
3 mul 4
returns 12

with and without combine and subtract durations:

2 hours with 30 minutes
returns 2 hours 30 minutes
2 hours without 30 minutes
returns 1 hour 30 minutes

Number scales#

A repeated k multiplies by a thousand: 2k is 2,000, 1kk is 1,000,000, 1kkk is 1,000,000,000.

2k
returns 2,000
1kk
returns 1,000,000
1kkk
returns 1,000,000,000

Percentages#

Use of, on and off with %.

20% of 10
returns 2
5% on 30
returns 31.5
6% off 40
returns 37.6
50 as a % of 100
returns 50
5% of what is 6
returns 120

A percentage can be added to or taken from a value and chained with more terms, and it can be negative.

50 + 10% + 1
returns 56
-20% on 50
returns 40

Rounding#

Round a result with a phrase at the end of the line, or call round, ceil or floor directly. Rounding works with units and currencies too.

1/3 to 2 dp
returns 0.33
π to 3 digits
returns 3.142
5.5 rounded
returns 6
5.5 rounded up
returns 6
5.5 rounded down
returns 5
37 to nearest 10
returns 40
$490 rounded to nearest hundred
returns US$ 500
21 rounded up to nearest 5
returns 25
0.534 to nearest 16th
returns 9/16

A step can carry its own unit, and a duration written in several units is rounded in the smallest one. Units and currencies round to a fraction too.

2 hours 17 minutes to nearest 15
returns 2 hours 15 minutes
47 cm to nearest 5 cm
returns 45 cm
2.3 in to nearest 16th
returns 37/16 in

Number bases#

Convert a whole number with in, to or as: 255 in hex is 0xff, 255 to bin is 0b11111111, 255 as octal is 0o377, 0x9F31 to decimal is 40,753 and 5300 in sci is 5.3e+3. The bit operators <<, >>, &, |, ^| and ~ are exact for whole numbers well past 32 bits.

Constants and functions#

pi and π are available, along with the standard mathjs functions and these aliases:

Alias Meaning
ln Natural logarithm
fact Factorial
arcsin, arccos, arctan Inverse trigonometric functions
root(n, x) The x-th root of n
fact(5)
returns 120
ln(e)
returns 1
root(8, 3)
returns 2

See Lists & sequences for sum, mean and the other aggregate functions, and Reference for the full table.