Update documentation for floats.

This commit is contained in:
Christian Theune 2016-01-06 08:41:53 +01:00
parent 934642155c
commit b4bda4765a
4 changed files with 24 additions and 12 deletions

View file

@ -32,7 +32,7 @@ available as <function>builtins.derivation</function>.</para>
<varlistentry><term><function>builtins.add</function> <varlistentry><term><function>builtins.add</function>
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
<listitem><para>Return the sum of the integers <listitem><para>Return the sum of the numbers
<replaceable>e1</replaceable> and <replaceable>e1</replaceable> and
<replaceable>e2</replaceable>.</para></listitem> <replaceable>e2</replaceable>.</para></listitem>
@ -204,7 +204,7 @@ if builtins ? getEnv then builtins.getEnv "PATH" else ""</programlisting>
<varlistentry><term><function>builtins.div</function> <varlistentry><term><function>builtins.div</function>
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
<listitem><para>Return the quotient of the integers <listitem><para>Return the quotient of the numbers
<replaceable>e1</replaceable> and <replaceable>e1</replaceable> and
<replaceable>e2</replaceable>.</para></listitem> <replaceable>e2</replaceable>.</para></listitem>
@ -602,12 +602,12 @@ x: x + 456</programlisting>
<varlistentry><term><function>builtins.lessThan</function> <varlistentry><term><function>builtins.lessThan</function>
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
<listitem><para>Return <literal>true</literal> if the integer <listitem><para>Return <literal>true</literal> if the number
<replaceable>e1</replaceable> is less than the integer <replaceable>e1</replaceable> is less than the number
<replaceable>e2</replaceable>, and <literal>false</literal> <replaceable>e2</replaceable>, and <literal>false</literal>
otherwise. Evaluation aborts if either otherwise. Evaluation aborts if either
<replaceable>e1</replaceable> or <replaceable>e2</replaceable> <replaceable>e1</replaceable> or <replaceable>e2</replaceable>
does not evaluate to an integer.</para></listitem> does not evaluate to a number.</para></listitem>
</varlistentry> </varlistentry>
@ -658,7 +658,7 @@ map (x: "foo" + x) [ "bar" "bla" "abc" ]</programlisting>
<varlistentry><term><function>builtins.mul</function> <varlistentry><term><function>builtins.mul</function>
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
<listitem><para>Return the product of the integers <listitem><para>Return the product of the numbers
<replaceable>e1</replaceable> and <replaceable>e1</replaceable> and
<replaceable>e2</replaceable>.</para></listitem> <replaceable>e2</replaceable>.</para></listitem>
@ -815,7 +815,7 @@ builtins.sort builtins.lessThan [ 483 249 526 147 42 77 ]
<varlistentry><term><function>builtins.sub</function> <varlistentry><term><function>builtins.sub</function>
<replaceable>e1</replaceable> <replaceable>e2</replaceable></term> <replaceable>e1</replaceable> <replaceable>e2</replaceable></term>
<listitem><para>Return the difference between the integers <listitem><para>Return the difference between the numbers
<replaceable>e1</replaceable> and <replaceable>e1</replaceable> and
<replaceable>e2</replaceable>.</para></listitem> <replaceable>e2</replaceable>.</para></listitem>
@ -942,7 +942,7 @@ in foo</programlisting>
<varlistentry><term><function>builtins.toJSON</function> <replaceable>e</replaceable></term> <varlistentry><term><function>builtins.toJSON</function> <replaceable>e</replaceable></term>
<listitem><para>Return a string containing a JSON representation <listitem><para>Return a string containing a JSON representation
of <replaceable>e</replaceable>. Strings, integers, booleans, of <replaceable>e</replaceable>. Strings, integers, floats, booleans,
nulls and lists are mapped to their JSON equivalents. Sets nulls and lists are mapped to their JSON equivalents. Sets
(except derivations) are represented as objects. Derivations are (except derivations) are represented as objects. Derivations are
translated to a JSON string containing the derivations output translated to a JSON string containing the derivations output

View file

@ -43,7 +43,7 @@ of which specify the inputs of the build.</para>
<itemizedlist> <itemizedlist>
<listitem><para>Strings and integers are just passed <listitem><para>Strings and numbers are just passed
verbatim.</para></listitem> verbatim.</para></listitem>
<listitem><para>A <emphasis>path</emphasis> (e.g., <listitem><para>A <emphasis>path</emphasis> (e.g.,

View file

@ -140,8 +140,13 @@ stdenv.mkDerivation {
</listitem> </listitem>
<listitem><para><emphasis>Integers</emphasis>, e.g., <listitem><para>Numbers, which can be <emphasis>integers</emphasis> (like
<literal>123</literal>.</para></listitem> <literal>123</literal>) or <emphasis>floating point</emphasis> (like
<literal>123.43</literal> or <literal>.27e13</literal>).</para>
<para>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.</para></listitem>
<listitem><para><emphasis>Paths</emphasis>, e.g., <listitem><para><emphasis>Paths</emphasis>, e.g.,
<filename>/bin/sh</filename> or <filename>./builder.sh</filename>. <filename>/bin/sh</filename> or <filename>./builder.sh</filename>.

View file

@ -10,6 +10,13 @@
features:</para> features:</para>
<itemizedlist> <itemizedlist>
<listitem>
<para>The Nix language now supports floating point numbers. They are
based on regular C++ <literal>float</literal> and compatible with
existing integers and number-related operations. Export and import to and
from JSON and XML works, too.
</para>
</listitem>
<listitem> <listitem>
<para>All "chroot"-containing strings got renamed to "sandbox". <para>All "chroot"-containing strings got renamed to "sandbox".
In particular, some nix options got renamed, but the old names In particular, some nix options got renamed, but the old names