Value Types

The value types in Elixir represent numbers, names, ranges, and regular expressions.

Integers

Integer literals can be written as decimal (1234), hexadecimal (0xcafe), octal (0o765), and binary (0b1010).

Decimal numbers may contain underscores—these are often used to separate groups of three digits when writing large numbers, so one million could be written 1_000_000 (or perhaps 100_0000 in China and Japan).

There is no fixed limit on the size of integers—their internal representation grows to fit their magnitude.

 factorial(10000) ​# => 28462596809170545189...and so on for 35640 more digits...

(You’ll see how to write a function such as factorial in Modules and Named Functions,.)

Floating-Point Numbers

Floating-point numbers are ...

Get Programming Elixir ≥ 1.6 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.