diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/expl3/l3fp.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/expl3/l3fp.dtx | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/Master/texmf-dist/source/latex/expl3/l3fp.dtx b/Master/texmf-dist/source/latex/expl3/l3fp.dtx index e8ecdad5480..f5b1d427096 100644 --- a/Master/texmf-dist/source/latex/expl3/l3fp.dtx +++ b/Master/texmf-dist/source/latex/expl3/l3fp.dtx @@ -35,7 +35,7 @@ \RequirePackage{l3names} %</driver|package> %\fi -\GetIdInfo$Id: l3fp.dtx 2080 2010-10-27 11:02:09Z joseph $ +\GetIdInfo$Id: l3fp.dtx 2092 2010-11-25 20:44:04Z joseph $ {L3 Experimental floating-point operations} %\iffalse %<*driver> @@ -100,9 +100,9 @@ % %\subsection{Constants} % -%\begin{variable}{ \c_infinity_fp } -% A marker value for an infinite result from a calculation, such as -% \( \tan ( \pi / 2 ) \). +%\begin{variable}{ \c_one_fp } +% A floating point variable with permanent value \( 1 \): used for +% speeding up some comparisons. %\end{variable} % %\begin{variable}{ \c_undefined_fp } @@ -268,6 +268,17 @@ % can be used in a variety of contexts. The \cs{fp_use:N} function % should also be consulted in this context, as it will insert the % value of the floating point variable as a real number. +% +%\begin{function}{ +% \fp_to_dim:N / (EXP) | +% \fp_to_dim:c / (EXP) | +%} +% \begin{syntax} +% \cs{fp_to_dim:N} \meta{floating point variable} +% \end{syntax} +% Inserts the value of the \meta{floating point variable} +% into the input stream converted into a dimension in points. +%\end{function} % %\begin{function}{ % \fp_to_int:N / (EXP) | @@ -370,23 +381,6 @@ %\subsection{Tests on floating-point values} % %\begin{function}{ -% \fp_if_infinity_p:N / (EXP) | -% \fp_if_infinity:N / (EXP) (TF) | -%} -% \begin{syntax} -% \cs{fp_if_infinity_p:N} \meta{fixed-point} -% \cs{fp_if_infinity:NTF} \meta{fixed-point} -% ~~\Arg{true code} \Arg{false code} -% \end{syntax} -% Tests if \meta{floating point} is infinite (\emph{i.e}.~equal to the -% special \cs{c_infinity_fp} variable). The branching versions then -% leave either \meta{true code} or \meta{false code} in the input -% stream, as appropriate to the truth of the test and the variant of -% the function chosen. The logical truth of the test is left in the -% input stream by the predicate version. -%\end{function} -% -%\begin{function}{ % \fp_if_undefined_p:N / (EXP) | % \fp_if_undefined:N / (EXP) (TF) | %} @@ -766,12 +760,11 @@ %\end{macro} %\end{macro} % -%\begin{macro}{\c_infinity_fp} -% Infinity is the biggest number that can be represented by \TeX's -% \texttt{count} data type. +%\begin{macro}{\c_one_fp} +% The constant value \( 1 \): used for fast comparisons. % \begin{macrocode} -\tl_new:N \c_infinity_fp -\tl_set:Nn \c_infinity_fp { + 2147483647 . 2147483647 e 2147483647 } +\tl_new:N \c_one_fp +\tl_set:Nn \c_one_fp { + 1.000000000 e 0 } % \end{macrocode} %\end{macro} % @@ -1051,6 +1044,8 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \fp_split:Nn #1#2 { \tl_set:Nx \l_fp_tmp_tl {#2} + \tl_set_rescan:Nno \l_fp_tmp_tl { \char_make_ignore:n { 32 } } + { \l_fp_tmp_tl } \l_fp_split_sign_int \c_one \fp_split_sign: \use:c { l_fp_input_ #1 _sign_int } \l_fp_split_sign_int @@ -1624,6 +1619,16 @@ % a form that can be used by \TeX. Here, the functions are slightly % different, as some information may be discarded. % +%\begin{macro}{\fp_to_dim:N} +%\begin{macro}{\fp_to_dim:c} +% A very simple wrapper. +% \begin{macrocode} +\cs_new_nopar:Npn \fp_to_dim:N #1 { \fp_use:N #1 pt } +\cs_generate_variant:Nn \fp_to_dim:N { c } +% \end{macrocode} +%\end{macro} +%\end{macro} +% %\begin{macro}{\fp_to_int:N} %\begin{macro}{\fp_to_int:c} %\begin{macro}[aux]{\fp_to_int_aux:w} @@ -3266,7 +3271,7 @@ \l_fp_output_decimal_int \l_fp_output_exponent_int \tl_new:c { c_fp_sin ( \l_fp_trig_arg_tl ) _tl } - \tl_set:cx { c_fp_sin ( \l_fp_trig_arg_tl ) _tl } + \tl_gset:cx { c_fp_sin ( \l_fp_trig_arg_tl ) _tl } { \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero + @@ -3376,7 +3381,7 @@ \l_fp_output_decimal_int \l_fp_output_exponent_int \tl_new:c { c_fp_cos ( \l_fp_trig_arg_tl ) _tl } - \tl_set:cx { c_fp_cos ( \l_fp_trig_arg_tl ) _tl } + \tl_gset:cx { c_fp_cos ( \l_fp_trig_arg_tl ) _tl } { \tex_ifnum:D \l_fp_input_a_sign_int > \c_zero + @@ -3697,7 +3702,7 @@ \l_fp_output_decimal_int \l_fp_output_exponent_int \tl_new:c { c_fp_tan ( \l_fp_trig_arg_tl ) _tl } - \tl_set:cx { c_fp_tan ( \l_fp_trig_arg_tl ) _tl } + \tl_gset:cx { c_fp_tan ( \l_fp_trig_arg_tl ) _tl } { \tex_ifnum:D \l_fp_output_sign_int > \c_zero + @@ -3727,21 +3732,6 @@ % %\subsection{Tests for special values} % -%\begin{macro}{\fp_if_infinity_p:N} -%\begin{macro}[TF]{\fp_if_infinity:N} -% Testing for infinity is easy. -% \begin{macrocode} -\prg_new_conditional:Npnn \fp_if_infinity:N #1 { p , T , F , TF } { - \tex_ifx:D #1 \c_infinity_fp - \prg_return_true: - \tex_else:D - \prg_return_false: - \tex_fi:D -} -% \end{macrocode} -%\end{macro} -%\end{macro} -% %\begin{macro}{\fp_if_undefined_p:N} %\begin{macro}[TF]{\fp_if_undefined:N} % Testing for an undefined value is easy. |