diff options
| author | Jakob Peters <jakobj.peters@gmail.com> | 2024-12-08 08:52:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-08 16:52:57 +0000 |
| commit | 57f7c167d867094660077d3da75a0207497aa36e (patch) | |
| tree | 8cbe6e027e147f1c6270b826f583c3c99d841068 | |
| parent | d04cc61eee2b9519e82b7759a929314299cb4a34 (diff) | |
Document integer literal parsing (#5462)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
| -rw-r--r-- | crates/typst-library/src/foundations/int.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/typst-library/src/foundations/int.rs b/crates/typst-library/src/foundations/int.rs index e936353c..bddffada 100644 --- a/crates/typst-library/src/foundations/int.rs +++ b/crates/typst-library/src/foundations/int.rs @@ -11,7 +11,12 @@ use crate::foundations::{ /// /// The number can be negative, zero, or positive. As Typst uses 64 bits to /// store integers, integers cannot be smaller than `{-9223372036854775808}` or -/// larger than `{9223372036854775807}`. +/// larger than `{9223372036854775807}`. Integer literals are always positive, +/// so a negative integer such as `{-1}` is semantically the negation `-` of the +/// positive literal `1`. A positive integer greater than the maximum value and +/// a negative integer less than or equal to the minimum value cannot be +/// represented as an integer literal, and are instead parsed as a `{float}`. +/// The minimum integer value can still be obtained through integer arithmetic. /// /// The number can also be specified as hexadecimal, octal, or binary by /// starting it with a zero followed by either `x`, `o`, or `b`. |
