diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 3b1843e9b43..2cbbe3e2cb6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -38,7 +38,7 @@ \documentclass[full]{l3doc} %</driver> %<*driver|package> -\GetIdInfo$Id: l3fp.dtx 6685 2016-08-19 16:26:52Z bruno $ +\GetIdInfo$Id: l3fp.dtx 6761 2016-11-21 21:48:43Z joseph $ {L3 Floating points} %</driver|package> %<*driver> @@ -91,6 +91,7 @@ % \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 @@ -540,6 +541,50 @@ % \texttt{false}. % \end{function} % +% \begin{function}[added = 2016-11-21, rEXP] +% {\fp_step_function:nnnN} +% \begin{syntax} +% \cs{fp_step_function:nnnN} \Arg{initial value} \Arg{step} \Arg{final value} \meta{function} +% \end{syntax} +% This function first evaluates the \meta{initial value}, \meta{step} +% and \meta{final value}, all of which should be floating point expressions. +% The \meta{function} is then placed in front of each \meta{value} +% from the \meta{initial value} to the \meta{final value} in turn +% (using \meta{step} between each \meta{value}). The \meta{step} must +% be non-zero. If the \meta{step} is positive, the loop stops when +% the \meta{value} becomes larger than the \meta{final value}. If the +% \meta{step} is negative, the loop stops when the \meta{value} +% becomes smaller than the \meta{final value}. The \meta{function} +% should absorb one numerical argument. For example +% \begin{verbatim} +% \cs_set:Npn \my_func:n #1 { [I~saw~#1] \quad } +% \fp_step_function:nnnN { 1.0 } { 0.1 } { 1.5 } \my_func:n +% \end{verbatim} +% would print +% \begin{quote} +% [I saw 1.0] \quad +% [I saw 1.1] \quad +% [I saw 1.2] \quad +% [I saw 1.3] \quad +% [I saw 1.4] \quad +% [I saw 1.5] \quad +% \end{quote} +% \end{function} +% +% \begin{function}[added = 2016-11-21] +% {\fp_step_inline:nnnn} +% \begin{syntax} +% \cs{fp_step_inline:nnnn} \Arg{initial value} \Arg{step} \Arg{final value} \Arg{code} +% \end{syntax} +% This function first evaluates the \meta{initial value}, \meta{step} +% and \meta{final value}, all of which should be floating point expressions. +% Then for each \meta{value} from the \meta{initial value} to the +% \meta{final value} in turn (using \meta{step} between each +% \meta{value}), the \meta{code} is inserted into the input stream +% with |#1| replaced by the current \meta{value}. Thus the +% \meta{code} should define a function of one argument~(|#1|). +% \end{function} +% % \section{Some useful constants, and scratch variables} % % \begin{variable}[added = 2012-05-08]{\c_zero_fp, \c_minus_zero_fp} @@ -1135,6 +1180,35 @@ % $\sqrt{\text{\nan{}}}=\text{\nan{}}$. % \end{function} % +% \begin{function}[added = 2016-11-20]{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. +% \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} +% \end{function} +% +% \begin{function}[added = 2016-11-20]{randint} +% \begin{syntax} +% \cs{fp_eval:n} \{ |randint(| \meta{fpexpr} |)| \} +% \cs{fp_eval:n} \{ |randint(| \meta{fpexpr_1} , \meta{fpexpr_2} |)| \} +% \end{syntax} +% 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} +% \end{function} +% % \begin{variable}[tested = m3fp-parse001]{inf, nan} % The special values $+\infty$, $-\infty$, and \nan{} are represented % as \texttt{inf}, \texttt{-inf} and \texttt{nan} (see \cs{c_inf_fp}, |