diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 104 |
1 files changed, 53 insertions, 51 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 2cbbe3e2cb6..ea20f8d1bc8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -1,44 +1,30 @@ % \iffalse meta-comment % %% File: l3fp.dtx Copyright (C) 2011-2016 The LaTeX3 Project -%% -%% It may be distributed and/or modified under the conditions of the -%% LaTeX Project Public License (LPPL), either version 1.3c of this -%% license or (at your option) any later version. The latest version -%% of this license is in the file -%% -%% http://www.latex-project.org/lppl.txt -%% -%% This file is part of the "l3kernel bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% The released version of this bundle is available from CTAN. -%% -%% ----------------------------------------------------------------------- -%% -%% The development version of the bundle can be found at -%% -%% http://www.latex-project.org/svnroot/experimental/trunk/ -%% -%% for those people who are interested. -%% -%%%%%%%%%%% -%% NOTE: %% -%%%%%%%%%%% -%% -%% Snapshots taken from the repository represent work in progress and may -%% not work or may contain conflicting material! We therefore ask -%% people _not_ to put them into distributions, archives, etc. without -%% prior consultation with the LaTeX3 Project Team. -%% -%% ----------------------------------------------------------------------- -%% +% +% It may be distributed and/or modified under the conditions of the +% LaTeX Project Public License (LPPL), either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in the file +% +% http://www.latex-project.org/lppl.txt +% +% This file is part of the "l3kernel bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. % %<*driver> \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3fp.dtx 6761 2016-11-21 21:48:43Z joseph $ +\GetIdInfo$Id: l3fp.dtx 6805 2016-12-28 22:15:52Z joseph $ {L3 Floating points} %</driver|package> %<*driver> @@ -91,7 +77,6 @@ % \item Boolean logic: negation $\mathop{!}x$, conjunction % $x\mathop{\&\&}y$, disjunction $x\mathop{\vert\vert}y$, ternary % operator $x\mathop{?}y\mathop{:}z$. -% \item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$. % \item Exponentials: $\exp x$, $\ln x$, $x^y$. % \item Trigonometry: $\sin x$, $\cos x$, $\tan x$, $\cot x$, $\sec % x$, $\csc x$ expecting their arguments in radians, and @@ -123,6 +108,8 @@ % ties rounded to an even value by default, towards zero if $t=0$, % towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$. And % \emph{(not yet)} modulo, and \enquote{quantize}. +% \item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$ in +% \pdfTeX{} and \LuaTeX{} engines. % \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). % \item Dimensions, automatically expressed in points, \emph{e.g.}, % \texttt{pc} is~$12$. @@ -541,8 +528,8 @@ % \texttt{false}. % \end{function} % -% \begin{function}[added = 2016-11-21, rEXP] -% {\fp_step_function:nnnN} +% \begin{function}[added = 2016-11-21, updated = 2016-12-06, rEXP] +% {\fp_step_function:nnnN, \fp_step_function:nnnc} % \begin{syntax} % \cs{fp_step_function:nnnN} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function} % \end{syntax} @@ -569,9 +556,14 @@ % [I saw 1.4] \quad % [I saw 1.5] \quad % \end{quote} +% \begin{texnote} +% Due to rounding, it may happen that adding the \meta{step} to the +% \meta{value} does not change the \meta{value}; such cases give an +% error, as they would otherwise lead to an infinite loop. +% \end{texnote} % \end{function} % -% \begin{function}[added = 2016-11-21] +% \begin{function}[added = 2016-11-21, updated = 2016-12-06] % {\fp_step_inline:nnnn} % \begin{syntax} % \cs{fp_step_inline:nnnn} \Arg{initial value} \Arg{step} \Arg{final value} \Arg{code} @@ -1180,20 +1172,36 @@ % $\sqrt{\text{\nan{}}}=\text{\nan{}}$. % \end{function} % -% \begin{function}[added = 2016-11-20]{rand} +% \begin{function}[added = 2016-12-05]{rand} % \begin{syntax} % \cs{fp_eval:n} \{ |rand()| \} % \end{syntax} % Produces a pseudo-random floating-point number (multiple of -% $10^{-16}$) between $0$~included and $1$~excluded. +% $10^{-16}$) between $0$~included and $1$~excluded. Available in +% \pdfTeX{} and \LuaTeX{} engines only. % \begin{texnote} -% This is a wrapper around \tn{pdfuniformdeviate}. The random seed -% can be queried using \tn{pdfrandomseed} and set using -% \tn{pdfsetrandomseed}. +% This is based on pseudo-random numbers provided by the engine's +% primitive \tn{pdfuniformdeviate} in \pdfTeX{} and +% \tn{uniformdeviate} in \LuaTeX{}. The underlying code in +% \pdfTeX{} and \LuaTeX{} is based on Metapost, which follows an +% additive scheme recommended in Section 3.6 of \enquote{The Art of +% Computer Programming, Volume~2}. +% +% While we are more careful than \tn{uniformdeviate} to preserve +% uniformity of the underlying stream of $28$-bit pseudo-random +% integers, these pseudo-random numbers should of course not be +% relied upon for serious numerical computations nor cryptography. +% +% The random seed can be queried using \tn{pdfrandomseed} and set +% using \tn{pdfsetrandomseed} (in \LuaTeX{} \tn{randomseed} and +% \tn{setrandomseed}). While a $32$-bit (signed) integer can be +% given as a seed, only the absolute value is used and any number +% beyond $2^{28}$ is divided by an appropriate power of~$2$. We +% recommend using an integer in $[0,2^{28}-1]$. % \end{texnote} % \end{function} % -% \begin{function}[added = 2016-11-20]{randint} +% \begin{function}[added = 2016-12-05]{randint} % \begin{syntax} % \cs{fp_eval:n} \{ |randint(| \meta{fpexpr} |)| \} % \cs{fp_eval:n} \{ |randint(| \meta{fpexpr_1} , \meta{fpexpr_2} |)| \} @@ -1201,12 +1209,8 @@ % Produces a pseudo-random integer between $1$~and \meta{fpexpr} or % between \meta{fpexpr_1} and \meta{fpexpr_2} inclusive. The bounds % must be integers in the range $(-10^{16},10^{16})$ and the first -% must be smaller or equal to the second. -% \begin{texnote} -% This is a wrapper around \tn{pdfuniformdeviate}. The random seed -% can be queried using \tn{pdfrandomseed} and set using -% \tn{pdfsetrandomseed}. -% \end{texnote} +% must be smaller or equal to the second. See \texttt{rand} for +% important comments on how these pseudo-random numbers are generated. % \end{function} % % \begin{variable}[tested = m3fp-parse001]{inf, nan} @@ -1297,8 +1301,6 @@ % \item Hyperbolic functions \texttt{cosh}, \texttt{sinh}, \texttt{tanh}. % \item Inverse hyperbolics. % \item Base conversion, input such as \texttt{0xAB.CDEF}. -% \item Random numbers (pgfmath provides |rnd|, |rand|, |random|), with -% seed reset at every \cs{fp_set:Nn}. % \item Factorial (not with |!|), gamma function. % \item Improve coefficients of the \texttt{sin} and \texttt{tan} % series. |