From b4bda4765af09acb86a4dd71105059491e7dcc30 Mon Sep 17 00:00:00 2001 From: Christian Theune Date: Wed, 6 Jan 2016 08:41:53 +0100 Subject: [PATCH] Update documentation for floats. --- doc/manual/expressions/builtins.xml | 18 +++++++++--------- doc/manual/expressions/derivations.xml | 2 +- doc/manual/expressions/language-values.xml | 9 +++++++-- doc/manual/release-notes/rl-1.11.xml | 7 +++++++ 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/doc/manual/expressions/builtins.xml b/doc/manual/expressions/builtins.xml index 3b664479d..13cc2221e 100644 --- a/doc/manual/expressions/builtins.xml +++ b/doc/manual/expressions/builtins.xml @@ -32,7 +32,7 @@ available as builtins.derivation. builtins.add e1 e2 - Return the sum of the integers + Return the sum of the numbers e1 and e2. @@ -204,7 +204,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else "" builtins.div e1 e2 - Return the quotient of the integers + Return the quotient of the numbers e1 and e2. @@ -335,7 +335,7 @@ stdenv.mkDerivation { - builtins.foldl’ + builtins.foldl’ op nul list Reduce a list by applying a binary operator, from @@ -602,12 +602,12 @@ x: x + 456 builtins.lessThan e1 e2 - Return true if the integer - e1 is less than the integer + Return true if the number + e1 is less than the number e2, and false otherwise. Evaluation aborts if either e1 or e2 - does not evaluate to an integer. + does not evaluate to a number. @@ -658,7 +658,7 @@ map (x: "foo" + x) [ "bar" "bla" "abc" ] builtins.mul e1 e2 - Return the product of the integers + Return the product of the numbers e1 and e2. @@ -815,7 +815,7 @@ builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ] builtins.sub e1 e2 - Return the difference between the integers + Return the difference between the numbers e1 and e2. @@ -942,7 +942,7 @@ in foo builtins.toJSON e Return a string containing a JSON representation - of e. Strings, integers, booleans, + of e. Strings, integers, floats, booleans, nulls and lists are mapped to their JSON equivalents. Sets (except derivations) are represented as objects. Derivations are translated to a JSON string containing the derivation’s output diff --git a/doc/manual/expressions/derivations.xml b/doc/manual/expressions/derivations.xml index 90e2786fa..f2a73dccf 100644 --- a/doc/manual/expressions/derivations.xml +++ b/doc/manual/expressions/derivations.xml @@ -43,7 +43,7 @@ of which specify the inputs of the build. - Strings and integers are just passed + Strings and numbers are just passed verbatim. A path (e.g., diff --git a/doc/manual/expressions/language-values.xml b/doc/manual/expressions/language-values.xml index 0bf6632d6..f1174ecb5 100644 --- a/doc/manual/expressions/language-values.xml +++ b/doc/manual/expressions/language-values.xml @@ -140,8 +140,13 @@ stdenv.mkDerivation { - Integers, e.g., - 123. + Numbers, which can be integers (like + 123) or floating point (like + 123.43 or .27e13). + + Numbers are type-compatible: pure integer operations will always + return integers, whereas any operation involving at least one floating point + number will have a floating point number as a result. Paths, e.g., /bin/sh or ./builder.sh. diff --git a/doc/manual/release-notes/rl-1.11.xml b/doc/manual/release-notes/rl-1.11.xml index aa9a3e101..fb6e4abfe 100644 --- a/doc/manual/release-notes/rl-1.11.xml +++ b/doc/manual/release-notes/rl-1.11.xml @@ -10,6 +10,13 @@ features: + + The Nix language now supports floating point numbers. They are + based on regular C++ float and compatible with + existing integers and number-related operations. Export and import to and + from JSON and XML works, too. + + All "chroot"-containing strings got renamed to "sandbox". In particular, some nix options got renamed, but the old names