From a8f443d96011c11ad726c2a28a37752bd56c12cc Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Fri, 12 Jul 2024 18:20:14 +0200 Subject: [PATCH] docs: update to define integer overflow Change-Id: Ie8a1b31035f2d27a220e5df2e9e178ec3b39ee68 --- doc/manual/src/language/operators.md | 6 ++++-- doc/manual/src/language/values.md | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/manual/src/language/operators.md b/doc/manual/src/language/operators.md index 418d0349f..ff09e739f 100644 --- a/doc/manual/src/language/operators.md +++ b/doc/manual/src/language/operators.md @@ -59,8 +59,10 @@ The result is a [Boolean] value. ## Arithmetic -Numbers are type-compatible: -Pure integer operations will always return integers, whereas any operation involving at least one floating point number return a floating point number. +Numbers will retain their type unless mixed with other numeric types: +Pure integer operations will always return integers, whereas any operation involving at least one floating point number returns a floating point number. + +Integer overflow (of 64-bit signed integers) and division by zero are defined to throw an error. See also [Comparison] and [Equality]. diff --git a/doc/manual/src/language/values.md b/doc/manual/src/language/values.md index 2ae3e143a..f02ef2597 100644 --- a/doc/manual/src/language/values.md +++ b/doc/manual/src/language/values.md @@ -85,6 +85,9 @@ Numbers, which can be *integers* (like `123`) or *floating point* (like `123.43` or `.27e13`). + Integers in the Nix language are 64-bit signed integers. + Integer overflow is defined to throw an error. + See [arithmetic] and [comparison] operators for semantics. [arithmetic]: ./operators.md#arithmetic