Skip to content

Commit

Permalink
Pareil
Browse files Browse the repository at this point in the history
  • Loading branch information
Enalye committed Mar 5, 2023
1 parent c348d5f commit 8dc6dff
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions docs/en/lang/number.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Number

There are 3 types of number in Grimoire: integers `int` (signed) and `uint` (unsigned) and floating point values `float`.
There are 4 types of number in Grimoire: integers `int` (signed), `uint` and `byte` (both unsigned) and floating point values `float`.

> **Note**: All numbers can have a `_` inserted between digits to make a big number more readable:
```grimoire
Expand All @@ -9,7 +9,7 @@ There are 3 types of number in Grimoire: integers `int` (signed) and `uint` (uns

## Integer

Integral numbers represent the set of all positive natural number and their negative counterpart, they contain no fractionnal part.
Integral numbers `int` represent the set of all positive natural number and their negative counterpart, they contain no fractionnal part.
They can contain a number between -2³¹ (-2 147 483 648) and 2³¹-1 (2 147 483 647).
Exceeding those values will raise an `OverflowError` error.

Expand All @@ -26,7 +26,7 @@ They can be preceded with `0b` for a binary number, `0x` for a hexadecimal numbe

## Entier non-signé

Contrary to signed integers, unsigned integers cannot be negative.
Contrary to signed integers, unsigned integers `uint` cannot be negative.
They can contain a number between 0 and 2³²-1 (4 294 967 295).
Exceeding those values will raise an `OverflowError` error.

Expand All @@ -39,9 +39,20 @@ Alternately, every literal integer greater than 2 147 483 647 is automatically u
12U
```

## Byte

`byte` works like `uint` but on a single byte.
They can contain a number between 0 and 2⁸-1 (255).
Exceeding those values will raise an `OverflowError` error.
They can be written with a postfix `b` or `B`.

```grimoire
128b
```

## Floating point number

Floating point numbers represent the set of all real number, they have a fractionnal part.
Floating point numbers `float` represent the set of all real number, they have a fractionnal part.
They can be written with a period `.` except at the last position, or with a postfix `f` or `F`.
```grimoire
2.3
Expand Down

0 comments on commit 8dc6dff

Please sign in to comment.