Skip to content
Varlig Guide
Varlig home

Numbers and notation

This page covers the ways you can write a number in a calc block: with thousands separators, with shorthand such as 45k, in scientific notation, as a fraction, in words, or in binary and hexadecimal. It also shows how to change the way an answer is displayed, for example as a fraction or a percentage. Reach for it when a number you typed isn’t read the way you meant, or when you want an answer in a different form.

Writing numbers

Decimal points and thousands separators

A full stop is the decimal point. You can group thousands with commas, spaces or underscores, whichever matches how you copied the number:

calc
£1,250 * 12 gives £15,000.00
1 250 * 12 gives 15,000
1_000_000 / 4 gives 250k
.5 * 38 gives 19

A few things to watch for:

  • A comma only groups thousands, and every group after it has three digits: 1,000 and 1,234,567 are numbers. It is never a decimal point, so 12,50 or 1,5 shows an error rather than a guess, and you can fix the line straight away. European-style numbers such as 1.234.567,89 are not recognised.
  • Space grouping needs groups of exactly three digits: 1 250 is fine, 12 50 is not a number.
  • The apostrophe is the feet symbol, so 1'000'000 doesn’t work as a separator.
  • A number can’t end in a decimal point: write 5 or 5.0, not 5..

Thousands separators work inside function calls and lists too, so you can paste figures straight in. A comma followed by exactly three digits carries on the number, and a comma followed by a space starts the next value:

calc
sum([£1,200, £800]) gives £2,000.00
max(1,000, 2,000) gives 2,000
sqrt(1,024) gives 32
[12,-51,4] gives [12, -51, 4]
max(1,000,2,000) gives Unsupported: ambiguous commas in 1,000,2,000: put a space after each comma between values (1,000, 2,000)

Values without spaces, as in [12,-51,4], split at every comma. When commas could mean either, as in the last line or sum(10,100), the error shows you how to write what you meant.

Large numbers and magnitude words

Shorthand and words for thousands, millions and more save typing out zeros:

calc
£45k / 12 gives £3,750.00
1.2 million / 4 gives 300k
£3bn / 1,000 gives £3M
Magnitude Accepted forms
Thousand 5k, 5K, 3 thousand
Million 2.5M, 1.2 million
Thousand million 3bn, 3G, 3 billion
Million million 2tn, 2T, 2 trillion

The shorthand must touch the number: 3bn works, 3 bn does not. A capital B after a number means bytes, not billions, so 3B is three bytes.

Large answers are shortened the same way. From 100,000 upwards a plain number shows as 250k, 2.5M or 8G. Money is shown in full below a million, as £350,000.00, and from there as £2.4M or £3B. The full value is still used in later lines. Reading results explains the display rules in detail.

Scientific notation

Write powers of ten with e or E, or spell out the multiplication with × 10^:

calc
2.5e-3 kg to g gives 2.5 g
1.5E3 m to km gives 1.5 km
6.02 × 10^23 gives 6.02e23

The exponent may itself have a decimal part: 1e2.0 is 100.

Fractions and maths symbols

A fraction such as 1/3 is kept exact while you work, so multiplying it back gives a whole number rather than 0.9999999999:

calc
1/3 * 3 gives 1
£60 * 3/4 gives £45.00

The Unicode fraction characters and the usual maths symbols work too, which helps when you paste a recipe or a formula:

calc
cups * 2 gives 3 cup
hours in minutes gives 135 min
2 × £4.50 gives £9.00
£18 ÷ 4 gives £4.50
144 gives 12
3² + 4² gives 25

(the true minus sign) is accepted wherever - is, and ² and ³ square and cube the number, name or bracket before them.

A fraction followed by of takes that share of an amount, whether it’s a plain number, money or a quantity with a unit:

calc
½ of 40 gives 20
3/4 of £60 gives £45.00
¾ of 2 kg gives 1.5 kg

Write a slash fraction without spaces, as in 3/4, so it’s read as one number.

Binary, octal and hexadecimal

Prefix a number with 0b for binary, 0o for octal or 0x for hexadecimal. Underscores can separate the digits.

calc
0b1010 to decimal gives 10
0o755 to decimal gives 493
0xFF + 1 gives 0x100

A result that started from a hexadecimal number stays in hexadecimal, as 0xFF + 1 shows. Use to decimal when you want an ordinary number back.

All notations at a glance

Notation Examples Notes
Decimal 42, 0.5, .5, 00042 A trailing dot (5.) is not accepted
Thousands grouping 1,234,567.89, 1 234 567.89, 1_000_000, 1_234.5_678 Comma and space groups have three digits
Scientific 1e6, 2.5e-3, 1.5E3, 6.02 × 10^23 The exponent may be fractional: 1e2.0 is 100
Magnitude words 5k, 2.5M, 3bn, 3G, 2tn, 2 trillion, 3 thousand See the table above
Binary 0b1010, 0b_1100_0001
Octal 0o755, 0o_755
Hexadecimal 0xFF, 0xCAFE_F00D Results stay in hexadecimal
Fractions 1/3, 3/10 Kept exact
Fraction characters , 1½ cups, ½ of 40 5.5, 1.5 cup, 20
Unicode symbols −5, 5 − 3, 2 × 3, 6 ÷ 3, √16, ,

Written numbers

You can write numbers and simple sums in words. This is handy when you are jotting something down the way you would say it, or pasting a sentence from elsewhere.

calc
twenty five hundred gives 2,500
one hundred and twenty five grams times four gives 500 g
one point five kilometres gives 1.5 km
three and a half hours in minutes gives 210 min
twelve times seven gives 84
double £80 gives £160.00
10 squared gives 100

Fraction words work with plain numbers, money and units:

calc
a quarter of 200 gives 50
half of 100 gives 50
three quarters of 200 g gives 150 g
two thirds of £90 gives £60.00
a tenth of £450 gives £45.00
one fifth gives 0.2

Percentages and currencies can be spelled out as well:

calc
fifteen percent of £80 gives £12.00
ten percent off £65 gives £58.50
five euros plus ten euros gives €15.00

Which words are recognised

  • Numbers: zero to nineteen, the tens twenty to ninety, hundred, thousand, million, billion and trillion, joined with spaces, hyphens or and (twenty-five, one hundred and twenty three). Hundreds compose, so twenty five hundred is 2,500.
  • Decimals: point followed by spoken digits (one point two five is 1.25).
  • Fractions: half, third, quarter or fourth, fifth, sixth, seventh, eighth, ninth and tenth, with their plurals (three quarters, two ninths).
  • Operators: plus, minus, times, multiplied by and divided by.
  • Multiplying and powers: double, twice and triple before a value, and squared or cubed after it. See Word-based mathematics.
  • A leading what is is optional: what is twelve times seven and twelve times seven give the same answer.

Pitfalls with written numbers

  • A fraction word can start a phrase with or without a, so quarter of 100 and a quarter of 100 are both 25. Before a month it’s a date instead: third of March is 3 March. quarter of an hour is 15 min as you’d expect.
  • pounds means the weight: forty pounds is 40 lb. For money, write £40 or forty GBP.
  • Mixed amounts such as twelve euros fifty don’t work. Write €12.50.

Constants

Constant Spellings Value
Pi pi, π, Pi 3.1415926536
Tau tau 6.2831853072 (τ is not recognised)
Golden ratio phi 1.6180339887
Euler’s number e, exp(1) 2.7182818285
calc
diameter = 30 cm
pi * diameter to 1 dp gives 94.2 cm
£1,000 * e^(5% * 10) gives £1,648.72

The last line grows £1,000 continuously at 5% a year for ten years.

If you define a name such as pi yourself, your value replaces the constant for the rest of the note. See names that clash with built-in words.

Implicit multiplication

You can leave out * between a number and a constant, a name or a bracket:

calc
2π gives 6.2831853072
2(£3.20 + £1.80) gives £10.00
(1 + 2)(3 + 4) gives 21
side = 4 m
2 side gives 8 m

Hold the pointer over side to confirm what happened: the hint says it was multiplied by 2 and suggests 2 * side if you’d like the line to spell it out. A plural name or a unit works the other way, because a number in front counts it. After servings = 3, 2 servings means two servings, so write the * when you want to multiply:

calc
servings = 3
2 servings gives 2
2 * servings gives 6

Powers are worked out first, as in maths, so formulas read the way you’d write them on paper. ² and ³ work on names too:

calc
x = 3
2x^2 gives 18
(2x)^2 gives 36
radius = 15 cm
pi radius² gives 706.8583470577 cm²
pi radius² in to 3 dp gives 0.071 m²

The one place to add the * yourself is before a function call. Write 2 * sqrt(9), not 2 sqrt(9).

Converting the display of a number

Add as, to, in or -> and a format word to show an answer in another form. The value itself doesn’t change, only how it is shown.

calc
0.375 as fraction gives
2.75 as fraction gives 2 ¾
£18 / £120 as % gives 15%
£60 / £48 as x gives 1.25x
0.00042 in scientific gives 4.2e-4
255 in hex gives 0xFF
10 to binary gives 0b1010
493 to octal gives 0o755
Target Example Result
fraction 0.75 as fraction ¾
fraction 1.75 as fraction, 22/7 as fraction 1 ¾, 3 1/7
%, percent, percentage 2 as %, 1/8 as % 200%, 12.5%
multiplier, x 1.5 as x 1.5x
scientific, sci 12345.6789 in sci 1.23456789e4
number, decimal, dec 0xff to decimal, 1e5 as number 255, 100k
hex, hexadecimal, base 16 255 in hex, -5 in hex 0xFF, -0x5
binary, bin, base 2 255 to binary 0b11111111
octal, oct, base 8 255 to octal 0o377
base 10 255 to base 10 255

Only bases 2, 8, 10 and 16 are available; 255 to base 7 shows no answer. hex(255) and bin(10) are function forms of the same conversions. There is no oct() function.

To round an answer rather than reformat it, see Rounding.

Putting it together

Saving for a house deposit, using shorthand for the price and percentage display for progress:

calc
# Saving for a deposit
house price = £285k gives £285,000.00
deposit = house price * 10% gives £28,500.00
saved = £11,400
saved / deposit as % gives 40%
remaining = deposit - saved gives £17,100.00
months = 18
remaining / months gives £950.00

£285k saves typing the zeros, and dividing two amounts of money gives a plain ratio that as % turns into a progress figure. Change saved as the pot grows and the monthly target updates below it.