diff options
Diffstat (limited to 'macros/latex-dev/required/l3kernel/l3fp.dtx')
-rw-r--r-- | macros/latex-dev/required/l3kernel/l3fp.dtx | 66 |
1 files changed, 38 insertions, 28 deletions
diff --git a/macros/latex-dev/required/l3kernel/l3fp.dtx b/macros/latex-dev/required/l3kernel/l3fp.dtx index 0a883b7cdf..045f66200a 100644 --- a/macros/latex-dev/required/l3kernel/l3fp.dtx +++ b/macros/latex-dev/required/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2025-01-14} +% \date{Released 2025-01-18} % % \maketitle % @@ -59,8 +59,8 @@ % separate exponent. The module implements expandably a wide set of % arithmetic, trigonometric, and other operations on decimal floating point % numbers, to be used within floating point expressions. \emph{Floating point -% expressions} (\enquote{\meta{fp expr}}) support the following operations with their usual -% precedence. +% expressions} (\enquote{\meta{fp expr}}) support the following operations with +% their usual precedence. % \begin{itemize} % \item Basic arithmetic: addition $x+y$, subtraction $x-y$, % multiplication $x*y$, division $x/y$, square root~$\sqrt{x}$, @@ -108,7 +108,8 @@ % towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$. % \end{itemize} % And \emph{(not yet)} modulo, and \enquote{quantize}. -% \item Random numbers: $\operatorname{rand}()$, $\operatorname{randint}(m,n)$. +% \item Random numbers: $\operatorname{rand}()$, +% $\operatorname{randint}(m,n)$. % \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). % \item Dimensions, automatically expressed in points, \emph{e.g.}, % \texttt{pc} is~$12$. @@ -124,9 +125,9 @@ % as |1.234e-34|, or |-.0001|), or as a stored floating point variable, % which is automatically replaced by its current value. % A \enquote{floating point} is a floating point number or a tuple thereof. See -% section~\ref{sec:l3fp:fp-floats} for a description of what a floating point is, -% section~\ref{sec:l3fp:fp-precedence} for details about how an expression is -% parsed, and section~\ref{sec:l3fp:fp-operations} to know what the various +% section~\ref{sec:l3fp:fp-floats} for a description of what a floating point +% is, section~\ref{sec:l3fp:fp-precedence} for details about how an expression +% is parsed, and section~\ref{sec:l3fp:fp-operations} to know what the various % operations do. Some operations may raise exceptions (error messages), % described in section~\ref{sec:l3fp:fp-exceptions}. % @@ -257,7 +258,8 @@ % integers are expressed without a decimal separator. The values % $\pm\infty$ and \nan{} trigger an \enquote{invalid operation} % exception. -% For a tuple, each item is converted using \cs{fp_eval:n} and they are combined as +% For a tuple, each item is converted using \cs{fp_eval:n} and they are +% combined as % |(|\meta{fp_1}\verb*|, |\meta{fp_2}\verb*|, |\ldots{}\meta{fp_n}|)| % if $n>1$ and |(|\meta{fp_1}|,)| or |()| for fewer items. % This function is identical to \cs{fp_to_decimal:n}. @@ -288,7 +290,8 @@ % integers are expressed without a decimal separator. The values % $\pm\infty$ and~\nan{} trigger an \enquote{invalid operation} % exception. -% For a tuple, each item is converted using \cs{fp_to_decimal:n} and they are combined as +% For a tuple, each item is converted using \cs{fp_to_decimal:n} and they are +% combined as % |(|\meta{fp_1}\verb*|, |\meta{fp_2}\verb*|, |\ldots{}\meta{fp_n}|)| % if $n>1$ and |(|\meta{fp_1}|,)| or |()| for fewer items. % \end{function} @@ -340,7 +343,8 @@ % The values $\pm\infty$ and~\nan{} trigger an \enquote{invalid % operation} exception. Normal category codes apply: thus the |e| is % category code~$11$ (a letter). -% For a tuple, each item is converted using \cs{fp_to_scientific:n} and they are combined as +% For a tuple, each item is converted using \cs{fp_to_scientific:n} and they +% are combined as % |(|\meta{fp_1}\verb*|, |\meta{fp_2}\verb*|, |\ldots{}\meta{fp_n}|)| % if $n>1$ and |(|\meta{fp_1}|,)| or |()| for fewer items. % \end{function} @@ -364,7 +368,8 @@ % |0|, |-0|, \texttt{inf}, \texttt{-inf}, and~\texttt{nan} % respectively. Normal category codes apply and thus \texttt{inf} or % \texttt{nan}, if produced, are made up of letters. -% For a tuple, each item is converted using \cs{fp_to_tl:n} and they are combined as +% For a tuple, each item is converted using \cs{fp_to_tl:n} and they are +% combined as % |(|\meta{fp_1}\verb*|, |\meta{fp_2}\verb*|, |\ldots{}\meta{fp_n}|)| % if $n>1$ and |(|\meta{fp_1}|,)| or |()| for fewer items. % \end{function} @@ -380,7 +385,8 @@ % exponent. Non-significant trailing zeros are trimmed. Integers are % expressed without a decimal separator. The values $\pm\infty$ % and~\nan{} trigger an \enquote{invalid operation} exception. -% For a tuple, each item is converted using \cs{fp_to_decimal:n} and they are combined as +% For a tuple, each item is converted using \cs{fp_to_decimal:n} and they are +% combined as % |(|\meta{fp_1}\verb*|, |\meta{fp_2}\verb*|, |\ldots{}\meta{fp_n}|)| % if $n>1$ and |(|\meta{fp_1}|,)| or |()| for fewer items. % This function is identical to \cs{fp_to_decimal:N}. @@ -995,7 +1001,8 @@ % valid floating point numbers. Note that the latter could be mistaken % with the difference of \enquote{\texttt{e}} and $1$. To avoid % confusions, the base of natural logarithms cannot be input as |e| and -% should be input as \texttt{exp(1)} or \cs[module = fp]{c_e_fp} (which is faster). +% should be input as \texttt{exp(1)} or \cs[module = fp]{c_e_fp} (which is +% faster). % % Special numbers are input as follows: % \begin{itemize} @@ -1024,7 +1031,8 @@ % \item Unary |+|, |-|, |!|. % \item Implicit multiplication by juxtaposition (\texttt{2pi}) % when neither factor is in parentheses. -% \item Binary |*| and |/|, implicit multiplication by juxtaposition with parentheses (for instance \texttt{3(4+5)}). +% \item Binary |*| and |/|, implicit multiplication by juxtaposition with +% parentheses (for instance \texttt{3(4+5)}). % \item Binary |+| and |-|. % \item Comparisons |>=|, |!=|, |<?|, \emph{etc}. % \item Logical \texttt{and}, denoted by |&&|. @@ -1061,9 +1069,10 @@ % \cs{fp_eval:n} \{ \meta{operand_1} |?| \meta{operand_2} |:| \meta{operand_3} \} % \end{syntax} % The ternary operator |?:| results in \meta{operand_2} if -% \meta{operand_1} is true (not $\pm 0$), and \meta{operand_3} if \meta{operand_1} -% is false ($\pm 0$). All three \meta{operands} are evaluated in all -% cases; they may be tuples. The operator is right associative, hence +% \meta{operand_1} is true (not $\pm 0$), and \meta{operand_3} if +% \meta{operand_1} is false ($\pm 0$). All three \meta{operands} are +% evaluated in all cases; they may be tuples. The operator is right +% associative, hence % \begin{verbatim} % \fp_eval:n % { @@ -1262,11 +1271,11 @@ % \cs{fp_eval:n} \{ |round| |(| \meta{fp expr_1} , \meta{fp expr_2} , \meta{fp expr_3} |)| \} % \end{syntax} % Only |round| accepts a third argument. -% Evaluates $\meta{fp expr_1}=x$ and $\meta{fp expr_2}=n$ and $\meta{fp expr_3}=t$ then rounds -% $x$~to $n$~places. If $n$~is an integer, this rounds~$x$ to a -% multiple of~$10^{-n}$; if $n=+\infty$, this always yields~$x$; if -% $n=-\infty$, this yields one of $\pm 0$, $\pm\infty$, or~\nan{}; if -% $n=\nan{}$, this yields \nan{}; if +% Evaluates $\meta{fp expr_1}=x$ and $\meta{fp expr_2}=n$ and $\meta{fp +% expr_3}=t$ then rounds $x$~to $n$~places. If $n$~is an integer, this +% rounds~$x$ to a multiple of~$10^{-n}$; if $n=+\infty$, this always +% yields~$x$; if $n=-\infty$, this yields one of $\pm 0$, $\pm\infty$, +% or~\nan{}; if $n=\nan{}$, this yields \nan{}; if % $n$~is neither $\pm\infty$ nor an integer, then an \enquote{invalid % operation} exception is raised. When \meta{fp expr_2} is omitted, % $n=0$, \emph{i.e.}, \meta{fp expr_1} is rounded to an integer. The @@ -1277,8 +1286,8 @@ % as follows. If $t$ is \texttt{nan} (or not given) the even % multiple is chosen (\enquote{ties to even}), if $t=\pm 0$ the % multiple closest to $0$ is chosen (\enquote{ties to zero}), -% if $t$ is positive/negative the multiple closest to $\infty$/$-\infty$ is chosen -% (\enquote{ties towards positive/negative infinity}). +% if $t$ is positive/negative the multiple closest to $\infty$/$-\infty$ +% is chosen (\enquote{ties towards positive/negative infinity}). % \item |floor| yields the largest % multiple of~$10^{-n}$ smaller or equal to~$x$ (\enquote{round % towards negative infinity}); @@ -1459,8 +1468,8 @@ % \cs{fp_eval:n} \{ |sqrt(| \meta{fp expr} |)| \} % \end{syntax} % Computes the square root of the \meta{fp expr}. The \enquote{invalid -% operation} is raised when the \meta{fp expr} is negative or is a tuple; no other -% exception can occur. Special values yield $\sqrt{-0} = -0$, +% operation} is raised when the \meta{fp expr} is negative or is a tuple; no +% other exception can occur. Special values yield $\sqrt{-0} = -0$, % $\sqrt{+0} = +0$, $\sqrt{+\infty} = +\infty$ and % $\sqrt{\text{\nan{}}}=\text{\nan{}}$. % \end{function} @@ -1502,8 +1511,9 @@ % % \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[module = fp]{c_inf_fp}, -% \cs[module = fp]{c_minus_inf_fp} and \cs[module = fp]{c_nan_fp}). +% as \texttt{inf}, \texttt{-inf} and \texttt{nan} (see +% \cs[module = fp]{c_inf_fp}, \cs[module = fp]{c_minus_inf_fp} and +% \cs[module = fp]{c_nan_fp}). % \end{variable} % % \begin{variable}[tested = m3fp-parse001]{pi} |