diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index b02f20ae962..06a0754ab6c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -35,7 +35,7 @@ % % % \title{^^A -% The \textsf{l3fp} package: floating points^^A +% The \textsf{l3fp} package: Floating points^^A % } % % \author{^^A @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -102,7 +102,7 @@ % 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. +% all engines except \XeTeX{}. % \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). % \item Dimensions, automatically expressed in points, \emph{e.g.}, % \texttt{pc} is~$12$. @@ -129,9 +129,12 @@ % \LaTeX{} can now compute: $ \frac{\sin (3.5)}{2} + 2\cdot 10^{-3} % = \ExplSyntaxOn \fp_to_decimal:n {sin(3.5)/2 + 2e-3} $. % \end{verbatim} -% But in all fairness, this module is mostly meant as an underlying tool -% for higher-level commands. For example, one could provide a function -% to typeset nicely the result of floating point computations. +% The operation \texttt{round} can be used to limit the result's +% precision. Adding $+0$ avoids the possibly undesirable output |-0|, +% replacing it by |+0|. However, the \pkg{l3fp} module is mostly meant +% as an underlying tool for higher-level commands. For example, one +% could provide a function to typeset nicely the result of floating +% point computations. % \begin{verbatim} % \documentclass{article} % \usepackage{xparse, siunitx} @@ -143,6 +146,8 @@ % \calcnum { 2 pi * sin ( 2.3 ^ 5 ) } % \end{document} % \end{verbatim} +% See the documentation of \pkg{siunitx} for various options of +% \cs{num}. % % \section{Creating and initialising floating point variables} % @@ -398,7 +403,7 @@ % This is experimental. % \end{function} % -% \begin{function}[EXP, pTF, updated = 2012-12-14, +% \begin{function}[EXP, pTF, updated = 2013-12-14, % tested = m3fp-logic001]{\fp_compare:n} % \begin{syntax} % \cs{fp_compare_p:n} \\ @@ -500,7 +505,7 @@ % \texttt{false}. % \end{function} % -% \begin{function}[rEXP, added = 2012-08-16, tested = m3fp-logic003] +% \begin{function}[rEXP, added = 2012-08-16, updated = 2013-12-14, tested = m3fp-logic003] % {\fp_do_until:nn} % \begin{syntax} % \cs{fp_do_until:nn} \{ \meta{fpexpr_1} \meta{relation} \meta{fpexpr_2} \} \Arg{code} @@ -513,7 +518,7 @@ % \meta{relation} is \texttt{true}. % \end{function} % -% \begin{function}[rEXP, added = 2012-08-16, tested = m3fp-logic003] +% \begin{function}[rEXP, added = 2012-08-16, updated = 2013-12-14, tested = m3fp-logic003] % {\fp_do_while:nn} % \begin{syntax} % \cs{fp_do_while:nn} \{ \meta{fpexpr_1} \meta{relation} \meta{fpexpr_2} \} \Arg{code} @@ -526,7 +531,7 @@ % is \texttt{false}. % \end{function} % -% \begin{function}[rEXP, added = 2012-08-16, tested = m3fp-logic003] +% \begin{function}[rEXP, added = 2012-08-16, updated = 2013-12-14, tested = m3fp-logic003] % {\fp_until_do:nn} % \begin{syntax} % \cs{fp_until_do:nn} \{ \meta{fpexpr_1} \meta{relation} \meta{fpexpr_2} \} \Arg{code} @@ -539,7 +544,7 @@ % \texttt{true}. % \end{function} % -% \begin{function}[rEXP, added = 2012-08-16, tested = m3fp-logic003] +% \begin{function}[rEXP, added = 2012-08-16, updated = 2013-12-14, tested = m3fp-logic003] % {\fp_while_do:nn} % \begin{syntax} % \cs{fp_while_do:nn} \{ \meta{fpexpr_1} \meta{relation} \meta{fpexpr_2} \} \Arg{code} @@ -637,7 +642,7 @@ % The value of the base of the natural logarithm, $\mathrm{e} = \exp(1)$. % \end{variable} % -% \begin{variable}[updated = 2012-05-08, updated = 2013-11-17]{\c_pi_fp} +% \begin{variable}[updated = 2013-11-17]{\c_pi_fp} % The value of~$\pi$. This can be input directly in a floating point % expression as~\texttt{pi}. % \end{variable} @@ -823,6 +828,11 @@ % preceded by any sign, but that sign is ignored. % \item Any unrecognizable string triggers an error, and produces a % \nan{}. +% \item Note that commands such as \tn{infty}, \tn{pi}, or \tn{sin} +% \emph{do not} work in floating point expressions. They may +% silently be interpreted as completely unexpected numbers, because +% integer constants (allowed in expressions) are commonly stored as +% mathematical characters. % \end{itemize} % % \subsection{Precedence of operators} @@ -1253,27 +1263,21 @@ % \cs{fp_eval:n} \{ |rand()| \} % \end{syntax} % Produces a pseudo-random floating-point number (multiple of -% $10^{-16}$) between $0$~included and $1$~excluded. Available in -% \pdfTeX{} and \LuaTeX{} engines only. +% $10^{-16}$) between $0$~included and $1$~excluded. This is not yet +% available in \XeTeX{}. The random seed can be queried using +% \cs{sys_rand_seed:} and set using \cs{sys_gset_rand_seed:n}. % \begin{texnote} % 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}. +% primitive \tn{pdfuniformdeviate} in \pdfTeX{}, \pTeX{}, \upTeX{} +% and \tn{uniformdeviate} in \LuaTeX{}. The underlying code 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} % @@ -1366,9 +1370,7 @@ % \item Function to count items in a tuple (and to determine if something is a tuple). % \item Decide what exponent range to consider. % \item Support signalling \texttt{nan}. -% \item Modulo and remainder, and rounding functions |quantize|, -% |quantize0|, |quantize+|, |quantize-|, |quantize=|, |round=|. -% Should the modulo also be provided as (catcode 12) |%|? +% \item Modulo and remainder, and rounding function |quantize| (and its friends analogous to |trunc|, |ceil|, |floor|). % \item \cs{fp_format:nn} \Arg{fpexpr} \Arg{format}, but what should % \meta{format} be? More general pretty printing? % \item Add |and|, |or|, |xor|? Perhaps under the names \texttt{all}, |