diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-19 22:13:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-19 22:13:10 +0000 |
commit | a9b5c8812a42ed9fc7bd6323b1185a096ecb7c0e (patch) | |
tree | 3130ecf7e791b7a7bf9587e8d8d3a339921de401 /Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx | |
parent | dd8d54441efc71090eb7f91c1315b3d08ddbdcdc (diff) |
l3 (19mar17)
git-svn-id: svn://tug.org/texlive/trunk@43548 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 59f734632b4..a6e66dd36bf 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-extended.dtx Copyright (C) 2011-2014,2016 The LaTeX3 Project +%% File: l3fp-extended.dtx Copyright (C) 2011-2014,2016,2017 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 @@ -22,8 +22,8 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-extended.dtx 6943 2017-02-17 16:47:59Z bruno $ - {L3 Floating-points with extended precision} +\def\ExplFileDate{2017/03/18} +\def\ExplFileVersion{7019} \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -105,25 +105,23 @@ % appropriate for computing continued fractions and Taylor series. % % At the end of the calculation, the result is turned back to a floating -% point number using \cs{@@_fixed_to_float:wN}. This function has to +% point number using \cs{@@_fixed_to_float_o:wN}. This function has to % change the exponent of the floating point number: it must be used % after starting an integer expression for the overall exponent of the % result. % % \subsection{Helpers for numbers with extended precision} % -% ^^A todo: put trailing semicolon here? % \begin{variable}[int]{\c_@@_one_fixed_tl} % The fixed-point number~$1$, used in \pkg{l3fp-expo}. % \begin{macrocode} \tl_const:Nn \c_@@_one_fixed_tl - { {10000} {0000} {0000} {0000} {0000} {0000} } + { {10000} {0000} {0000} {0000} {0000} {0000} ; } % \end{macrocode} % \end{variable} % % \begin{macro}[int, EXP]{\@@_fixed_continue:wn} -% This function does nothing. Of course, there is no bound on -% $a_1$ (except \TeX{}'s own $2^{31}-1$). +% This function simply calls the next function. % \begin{macrocode} \cs_new:Npn \@@_fixed_continue:wn #1; #2 { #2 #1; } % \end{macrocode} @@ -135,7 +133,7 @@ % \end{syntax} % This function adds $1$ to the fixed point \meta{a}, by changing % $a_1$ to $10000+a_1$, then calls the \meta{continuation}. This -% requires $a_1 \leq 2^{31} - 10001$. +% requires $a_1 + 10000 < 2^{31}$. % \begin{macrocode} \cs_new:Npn \@@_fixed_add_one:wN #1#2; #3 { @@ -167,9 +165,7 @@ % \begin{macro}[aux, EXP]{\@@_fixed_mul_after:wwn} % The fixed point operations which involve multiplication end by % calling this auxiliary. It braces the last block of digits, and -% places the \meta{continuation} |#2| in front. The -% \meta{continuation} was brought up through the expansions by -% the packing functions. +% places the \meta{continuation} |#3| in front. % \begin{macrocode} \cs_new:Npn \@@_fixed_mul_after:wwn #1; #2; #3 { #3 {#1} #2; } % \end{macrocode} @@ -625,14 +621,17 @@ % comma, then six groups of digits, ending with a semicolon. The first % group of digit may be any non-negative integer, while other groups of % digits have $4$~digits. In other words, an extended-precision number -% is an exponent ending in a comma, then a fixed point number. +% is an exponent ending in a comma, then a fixed point number. The +% corresponding value is $0.\meta{digits}\cdot 10^{\meta{exponent}}$. +% This convention differs from floating points. % % \begin{macro}[int, EXP]{\@@_ep_to_fixed:wwn} % \begin{macro}[aux, EXP] % {\@@_ep_to_fixed_auxi:www, \@@_ep_to_fixed_auxii:nnnnnnnwn} % Converts an extended-precision number with an exponent at most~$4$ -% to a fixed point number whose first block will have $12$~digits, -% most often starting with many zeros. +% and a first block less than $10^{8}$ to a fixed point number whose +% first block will have $12$~digits, hopefully starting with many +% zeros. % \begin{macrocode} \cs_new:Npn \@@_ep_to_fixed:wwn #1,#2 { @@ -1142,55 +1141,55 @@ % \end{macro} % % \subsection{Converting from fixed point to floating point} -% ^^A todo: doc and turn ..._to_float:... -> ..._to_float_o:... +% ^^A todo: doc % % After computing Taylor series, we wish to convert the result from % extended precision (with or without an exponent) to the public % floating point format. The functions here should be called within an % integer expression for the overall exponent of the floating point. % -% \begin{macro}[int, rEXP]{\@@_ep_to_float:wwN, \@@_ep_inv_to_float:wwN} +% \begin{macro}[int, rEXP]{\@@_ep_to_float_o:wwN, \@@_ep_inv_to_float_o:wwN} % An extended-precision number is simply a comma-delimited exponent % followed by a fixed point number. Leave the exponent in the current % integer expression then convert the fixed point number. % \begin{macrocode} -\cs_new:Npn \@@_ep_to_float:wwN #1, - { + \__int_eval:w #1 \@@_fixed_to_float:wN } -\cs_new:Npn \@@_ep_inv_to_float:wwN #1,#2; +\cs_new:Npn \@@_ep_to_float_o:wwN #1, + { + \__int_eval:w #1 \@@_fixed_to_float_o:wN } +\cs_new:Npn \@@_ep_inv_to_float_o:wwN #1,#2; { \@@_ep_div:wwwwn 1,{1000}{0000}{0000}{0000}{0000}{0000}; #1,#2; - \@@_ep_to_float:wwN + \@@_ep_to_float_o:wwN } % \end{macrocode} % \end{macro} % -% \begin{macro}[rEXP, int]{\@@_fixed_inv_to_float:wN} +% \begin{macro}[rEXP, int]{\@@_fixed_inv_to_float_o:wN} % Another function which reduces to converting an extended precision % number to a float. % \begin{macrocode} -\cs_new:Npn \@@_fixed_inv_to_float:wN - { \@@_ep_inv_to_float:wwN 0, } +\cs_new:Npn \@@_fixed_inv_to_float_o:wN + { \@@_ep_inv_to_float_o:wwN 0, } % \end{macrocode} % \end{macro} % -% \begin{macro}[rEXP, int]{\@@_fixed_to_float_rad:wN} +% \begin{macro}[rEXP, int]{\@@_fixed_to_float_rad_o:wN} % Converts the fixed point number~|#1| from degrees to radians then to % a floating point number. This could perhaps remain in % \pkg{l3fp-trig}. % \begin{macrocode} -\cs_new:Npn \@@_fixed_to_float_rad:wN #1; +\cs_new:Npn \@@_fixed_to_float_rad_o:wN #1; { \@@_fixed_mul:wwn #1; {5729}{5779}{5130}{8232}{0876}{7981}; - { \@@_ep_to_float:wwN 2, } + { \@@_ep_to_float_o:wwN 2, } } % \end{macrocode} % \end{macro} % % ^^A todo: make exponents end in ',' consistently throughout l3fp % \begin{macro}[int, rEXP] -% {\@@_fixed_to_float:wN, \@@_fixed_to_float:Nw} +% {\@@_fixed_to_float_o:wN, \@@_fixed_to_float_o:Nw} % \begin{syntax} -% \ldots{} \cs{__int_eval:w} \meta{exponent} \cs{@@_fixed_to_float:wN} \Arg{a_1} \Arg{a_2} \Arg{a_3} \Arg{a_4} \Arg{a_5} \Arg{a_6} |;| \meta{sign} +% \ldots{} \cs{__int_eval:w} \meta{exponent} \cs{@@_fixed_to_float_o:wN} \Arg{a_1} \Arg{a_2} \Arg{a_3} \Arg{a_4} \Arg{a_5} \Arg{a_6} |;| \meta{sign} % \end{syntax} % yields % \begin{quote} @@ -1204,8 +1203,8 @@ % %^^A todo: round properly when rounding to infinity: I need the sign. % \begin{macrocode} -\cs_new:Npn \@@_fixed_to_float:Nw #1#2; { \@@_fixed_to_float:wN #2; #1 } -\cs_new:Npn \@@_fixed_to_float:wN #1#2#3#4#5#6; #7 +\cs_new:Npn \@@_fixed_to_float_o:Nw #1#2; { \@@_fixed_to_float_o:wN #2; #1 } +\cs_new:Npn \@@_fixed_to_float_o:wN #1#2#3#4#5#6; #7 { + \__int_eval:w \c_@@_block_int % for the 8-digit-at-the-start thing. \exp_after:wN \exp_after:wN |