Numbers in langur are decimal floating point. Langur uses Mike Cowlishaw's decimal C library, via the Go wrapper library

number literals

Numbers in base 10 may be specified without qualification, such as 100 or 123.456.

Number literals may use underscores for visual clarity (such as 3_000_000), but cannot start with an underscore.

E-notation may be used, but always requires a + or - after the e.

Rounding defaults to round-half-even. Later revisions will likely allow you to specify a different rounding mode.

basex notation

Integer literals may use basex notation, such as 16xFF or 2x1010_0010 or -4x123.

Any base from 2 to 36 may be used, using the ASCII alphabet for digits higher than 9 (uppercase or lowercase).

At this time, basex notation is only available for integers within the range of a signed 64-bit int.

math operators

+ add
- subtract
x multiply
/ divide
\ integer divide
rem remainder
mod modulus
^ exponent (right-associative)
^/ root (right-associative)

Only integer roots and exponents may be calculated in the current implementation, but the left-hand operand can be a floating point number.

The root operator is very flexible, but when the result uses the full precision available (34 digits), the last few digits should be taken as an approximation at this time.

Remainder (rem) and modulus (mod) are not the same operator, but for positive operands will return the same result.

Also see the operators page.


The following constants are available by using the keyword.

pi Archimedes' constant
phi the Golden Ratio
e Euler's number
n2 natural logarithm of 2
n10 natural logarithm of 10

So, to calculate the circumference of a circle with radius of 7, you could use the following.

# 2𝛑r 2 x pi x 7 # result == 43.98229715025710533847700736591304