Course of Raku / Essentials / Numbers

Floating-point numbers

In the previous section, we saw that numbers such as 1.5 are rational numbers. To make a number that corresponds to a double number in C++, use scientific notation:


In this case, Raku creates instances of the Num data type and stores the data as an IEEE number internally.

Built-in constants

There are a few constants listed below that you can use straight ahead. They are the numbers of the Num type. Both ASCII and Unicode variants are available:

pi π 3.141592653589793
tau τ equals to 2 * π
e 𝑒 2.718281828459045

Course navigation

Numbers / Rational numbers   |   Numbers / Operations with numbers

💪 Or jump directly to the exercises to this section.