Skip to content

Percentages and functions

20% → 20%
20% of 80 → 16
80 + 20% → 96
80 - 20% → 64
20% off 150 → 120
what percent of 80 is 20 → 25%
twice 50 → 100
double 50 → 100
triple 50 → 150
half 80 → 40
half of 80 → 40
100 more than 40 → 140
30 less than 200 → 170
Function What it does
sqrt(x) Square root
abs(x) Absolute value
round(x), floor(x), ceil(x) Round to the nearest whole number, down, or up
log(x), ln(x) Base-10 and natural logarithm
sin(x), cos(x), tan(x) Sine, cosine and tangent, in degrees
min(x, y), max(x, y) The smaller or larger of two values
mod(x, y) The remainder of x ÷ y
sqrt(144) → 12
round(3.7) → 4
log(1000) → 3
sin(30) → 0.5
mod(17, 5) → 2

Write them with their prefix, and use them like any number:

0xFF → 255
0b1010 → 10
0o17 → 15
0xFF + 1 → 256

Show any number in another base with in:

255 in hex → 0xFF
10 in binary → 0b1010
255 in octal → 0o377
0xFF in decimal → 255