summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-13 21:56:47 +0000
committerKarl Berry <karl@freefriends.org>2018-05-13 21:56:47 +0000
commite6d38f40f0132914020c723840be3489c4b692f0 (patch)
treedac2c281e93cba461b3ff2c1e4b8e34aad401716 /Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
parent55be422dc01e60cfae781a9a4a310a96c9e99256 (diff)
l3 (13may18)
git-svn-id: svn://tug.org/texlive/trunk@47705 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx235
1 files changed, 122 insertions, 113 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
index bda1371504a..7cd493a7eff 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
@@ -38,7 +38,7 @@
% {latex-team@latex-project.org}^^A
% }^^A
% }
-% \date{Released 2018-04-30}
+% \date{Released 2018-05-12}
%
% \maketitle
%
@@ -720,17 +720,88 @@
% \end{macro}
% \end{macro}
%
+% \begin{variable}{\c_@@_exp_intarray}
+% The integer array has $6\times 9\times 4=216$ items encoding the
+% values of $\exp(j\times 10^i)$ for $j=1,\dots,9$ and $i=-1,\dots,4$.
+% Each value is expressed as $\simeq 10^p \times 0.m_1m_2m_3$ with
+% three $8$-digit blocks $m_1$, $m_2$, $m_3$ and an integer
+% exponent~$p$ (one more than the scientific exponent), and these are
+% stored in the integer array as four items: $p$, $10^8+m_1$,
+% $10^8+m_2$, $10^8+m_3$. The various exponentials are stored in
+% increasing order of $j\times 10^i$.
+%
+% Storing this data in an integer array makes it slightly harder to
+% access (slower, too), but uses $16$ bytes of memory per exponential
+% stored, while storing as tokens used around $40$ tokens; tokens have
+% an especially large footprint in Unicode-aware engines.
+% \begin{macrocode}
+\intarray_const_from_clist:Nn \c_@@_exp_intarray
+ {
+ 1 , 1 1105 1709 , 1 1807 5647 , 1 6248 1171 ,
+ 1 , 1 1221 4027 , 1 5816 0169 , 1 8339 2107 ,
+ 1 , 1 1349 8588 , 1 0757 6003 , 1 1039 8374 ,
+ 1 , 1 1491 8246 , 1 9764 1270 , 1 3178 2485 ,
+ 1 , 1 1648 7212 , 1 7070 0128 , 1 1468 4865 ,
+ 1 , 1 1822 1188 , 1 0039 0508 , 1 9748 7537 ,
+ 1 , 1 2013 7527 , 1 0747 0476 , 1 5216 2455 ,
+ 1 , 1 2225 5409 , 1 2849 2467 , 1 6045 7954 ,
+ 1 , 1 2459 6031 , 1 1115 6949 , 1 6638 0013 ,
+ 1 , 1 2718 2818 , 1 2845 9045 , 1 2353 6029 ,
+ 1 , 1 7389 0560 , 1 9893 0650 , 1 2272 3043 ,
+ 2 , 1 2008 5536 , 1 9231 8766 , 1 7740 9285 ,
+ 2 , 1 5459 8150 , 1 0331 4423 , 1 9078 1103 ,
+ 3 , 1 1484 1315 , 1 9102 5766 , 1 0342 1116 ,
+ 3 , 1 4034 2879 , 1 3492 7351 , 1 2260 8387 ,
+ 4 , 1 1096 6331 , 1 5842 8458 , 1 5992 6372 ,
+ 4 , 1 2980 9579 , 1 8704 1728 , 1 2747 4359 ,
+ 4 , 1 8103 0839 , 1 2757 5384 , 1 0077 1000 ,
+ 5 , 1 2202 6465 , 1 7948 0671 , 1 6516 9579 ,
+ 9 , 1 4851 6519 , 1 5409 7902 , 1 7796 9107 ,
+ 14 , 1 1068 6474 , 1 5815 2446 , 1 2146 9905 ,
+ 18 , 1 2353 8526 , 1 6837 0199 , 1 8540 7900 ,
+ 22 , 1 5184 7055 , 1 2858 7072 , 1 4640 8745 ,
+ 27 , 1 1142 0073 , 1 8981 5684 , 1 2836 6296 ,
+ 31 , 1 2515 4386 , 1 7091 9167 , 1 0062 6578 ,
+ 35 , 1 5540 6223 , 1 8439 3510 , 1 0525 7117 ,
+ 40 , 1 1220 4032 , 1 9431 7840 , 1 8020 0271 ,
+ 44 , 1 2688 1171 , 1 4181 6135 , 1 4484 1263 ,
+ 87 , 1 7225 9737 , 1 6812 5749 , 1 2581 7748 ,
+ 131 , 1 1942 4263 , 1 9524 1255 , 1 9365 8421 ,
+ 174 , 1 5221 4696 , 1 8976 4143 , 1 9505 8876 ,
+ 218 , 1 1403 5922 , 1 1785 2837 , 1 4107 3977 ,
+ 261 , 1 3773 0203 , 1 0092 9939 , 1 8234 0143 ,
+ 305 , 1 1014 2320 , 1 5473 5004 , 1 5094 5533 ,
+ 348 , 1 2726 3745 , 1 7211 2566 , 1 5673 6478 ,
+ 391 , 1 7328 8142 , 1 2230 7421 , 1 7051 8866 ,
+ 435 , 1 1970 0711 , 1 1401 7046 , 1 9938 8888 ,
+ 869 , 1 3881 1801 , 1 9428 4368 , 1 5764 8232 ,
+ 1303 , 1 7646 2009 , 1 8905 4704 , 1 8893 1073 ,
+ 1738 , 1 1506 3559 , 1 7005 0524 , 1 9009 7592 ,
+ 2172 , 1 2967 6283 , 1 8402 3667 , 1 0689 6630 ,
+ 2606 , 1 5846 4389 , 1 5650 2114 , 1 7278 5046 ,
+ 3041 , 1 1151 7900 , 1 5080 6878 , 1 2914 4154 ,
+ 3475 , 1 2269 1083 , 1 0850 6857 , 1 8724 4002 ,
+ 3909 , 1 4470 3047 , 1 3316 5442 , 1 6408 6591 ,
+ 4343 , 1 8806 8182 , 1 2566 2921 , 1 5872 6150 ,
+ 8686 , 1 7756 0047 , 1 2598 6861 , 1 0458 3204 ,
+ 13029 , 1 6830 5723 , 1 7791 4884 , 1 1932 7351 ,
+ 17372 , 1 6015 5609 , 1 3095 3052 , 1 3494 7574 ,
+ 21715 , 1 5297 7951 , 1 6443 0315 , 1 3251 3576 ,
+ 26058 , 1 4665 6719 , 1 0099 3379 , 1 5527 2929 ,
+ 30401 , 1 4108 9724 , 1 3326 3186 , 1 5271 5665 ,
+ 34744 , 1 3618 6973 , 1 3140 0875 , 1 3856 4102 ,
+ 39087 , 1 3186 9209 , 1 6113 3900 , 1 6705 9685 ,
+ }
+% \end{macrocode}
+% \end{variable}
+%
% \begin{macro}[rEXP]
% {
% \@@_exp_pos_large:NnnNwn ,
% \@@_exp_large_after:wwn ,
-% \@@_exp_large:w ,
-% \@@_exp_large_v:wN,
-% \@@_exp_large_iv:wN,
-% \@@_exp_large_iii:wN,
-% \@@_exp_large_ii:wN,
-% \@@_exp_large_i:wN,
-% \@@_exp_large_:wN,
+% \@@_exp_large:NwN ,
+% \@@_exp_intarray:w ,
+% \@@_exp_intarray_aux:w ,
% }
% The first two arguments are irrelevant (a rounding digit, and a
% brace group with $8$ zeros). The third argument is the integer part
@@ -740,122 +811,56 @@
% ensures that an integer part of $0$ is also removed. Then read
% digits one by one, looking up $\exp(\meta{digit}\cdot
% 10^{\meta{exponent}})$ in a table, and multiplying that to the
-% current total. The loop is done by having the auxiliary for one
-% exponent call the auxiliary for the next exponent. The current
-% total is expressed by leaving the exponent behind in the input
-% stream (we are currently within an \cs{@@_int_eval:w}), and keeping
-% track of a fixed point number, |#1| for the numbered auxiliaries.
-% Our usage of \cs{if_case:w} is somewhat dirty for optimization:
-% \TeX{} jumps to the appropriate case, but we then close the
-% \cs{if_case:w} \enquote{by hand}, using \cs{or:} and \cs{fi:} as
-% delimiters.
+% current total. The loop is done by \cs{@@_exp_large:NwN}, whose
+% |#1| is the \meta{exponent}, |#2| is the current mantissa, and |#3|
+% is the \meta{digit}. At the end, \cs{@@_exp_large_after:wwn} moves
+% on to the Taylor series, eventually multiplied with the mantissa
+% that we have just computed.
% \begin{macrocode}
\cs_new:Npn \@@_exp_pos_large:NnnNwn #1#2#3 #4#5; #6
{
- \exp_after:wN \exp_after:wN
- \cs:w @@_exp_large_ \@@_int_to_roman:w #6 :wN \exp_after:wN \cs_end:
+ \exp_after:wN \exp_after:wN \exp_after:wN \@@_exp_large:NwN
+ \exp_after:wN \exp_after:wN \exp_after:wN #6
\exp_after:wN \c_@@_one_fixed_tl
\int_value:w #3 #4 \exp_stop_f:
#5 00000 ;
}
-\cs_new:Npn \@@_exp_large:w #1 \or: #2 \fi:
- { \fi: \@@_fixed_mul:wwn #1; }
-\cs_new:Npn \@@_exp_large_v:wN #1; #2
+\cs_new:Npn \@@_exp_large:NwN #1#2; #3
{
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 4343 \@@_exp_large:w {8806}{8182}{2566}{2921}{5872}{6150} \or:
- + 8686 \@@_exp_large:w {7756}{0047}{2598}{6861}{0458}{3204} \or:
- + 13029 \@@_exp_large:w {6830}{5723}{7791}{4884}{1932}{7351} \or:
- + 17372 \@@_exp_large:w {6015}{5609}{3095}{3052}{3494}{7574} \or:
- + 21715 \@@_exp_large:w {5297}{7951}{6443}{0315}{3251}{3576} \or:
- + 26058 \@@_exp_large:w {4665}{6719}{0099}{3379}{5527}{2929} \or:
- + 30401 \@@_exp_large:w {4108}{9724}{3326}{3186}{5271}{5665} \or:
- + 34744 \@@_exp_large:w {3618}{6973}{3140}{0875}{3856}{4102} \or:
- + 39087 \@@_exp_large:w {3186}{9209}{6113}{3900}{6705}{9685} \or:
- \fi:
- #1;
- \@@_exp_large_iv:wN
- }
-\cs_new:Npn \@@_exp_large_iv:wN #1; #2
- {
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 435 \@@_exp_large:w {1970}{0711}{1401}{7046}{9938}{8888} \or:
- + 869 \@@_exp_large:w {3881}{1801}{9428}{4368}{5764}{8232} \or:
- + 1303 \@@_exp_large:w {7646}{2009}{8905}{4704}{8893}{1073} \or:
- + 1738 \@@_exp_large:w {1506}{3559}{7005}{0524}{9009}{7592} \or:
- + 2172 \@@_exp_large:w {2967}{6283}{8402}{3667}{0689}{6630} \or:
- + 2606 \@@_exp_large:w {5846}{4389}{5650}{2114}{7278}{5046} \or:
- + 3041 \@@_exp_large:w {1151}{7900}{5080}{6878}{2914}{4154} \or:
- + 3475 \@@_exp_large:w {2269}{1083}{0850}{6857}{8724}{4002} \or:
- + 3909 \@@_exp_large:w {4470}{3047}{3316}{5442}{6408}{6591} \or:
- \fi:
- #1;
- \@@_exp_large_iii:wN
- }
-\cs_new:Npn \@@_exp_large_iii:wN #1; #2
- {
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 44 \@@_exp_large:w {2688}{1171}{4181}{6135}{4484}{1263} \or:
- + 87 \@@_exp_large:w {7225}{9737}{6812}{5749}{2581}{7748} \or:
- + 131 \@@_exp_large:w {1942}{4263}{9524}{1255}{9365}{8421} \or:
- + 174 \@@_exp_large:w {5221}{4696}{8976}{4143}{9505}{8876} \or:
- + 218 \@@_exp_large:w {1403}{5922}{1785}{2837}{4107}{3977} \or:
- + 261 \@@_exp_large:w {3773}{0203}{0092}{9939}{8234}{0143} \or:
- + 305 \@@_exp_large:w {1014}{2320}{5473}{5004}{5094}{5533} \or:
- + 348 \@@_exp_large:w {2726}{3745}{7211}{2566}{5673}{6478} \or:
- + 391 \@@_exp_large:w {7328}{8142}{2230}{7421}{7051}{8866} \or:
- \fi:
- #1;
- \@@_exp_large_ii:wN
- }
-\cs_new:Npn \@@_exp_large_ii:wN #1; #2
- {
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 5 \@@_exp_large:w {2202}{6465}{7948}{0671}{6516}{9579} \or:
- + 9 \@@_exp_large:w {4851}{6519}{5409}{7902}{7796}{9107} \or:
- + 14 \@@_exp_large:w {1068}{6474}{5815}{2446}{2146}{9905} \or:
- + 18 \@@_exp_large:w {2353}{8526}{6837}{0199}{8540}{7900} \or:
- + 22 \@@_exp_large:w {5184}{7055}{2858}{7072}{4640}{8745} \or:
- + 27 \@@_exp_large:w {1142}{0073}{8981}{5684}{2836}{6296} \or:
- + 31 \@@_exp_large:w {2515}{4386}{7091}{9167}{0062}{6578} \or:
- + 35 \@@_exp_large:w {5540}{6223}{8439}{3510}{0525}{7117} \or:
- + 40 \@@_exp_large:w {1220}{4032}{9431}{7840}{8020}{0271} \or:
- \fi:
- #1;
- \@@_exp_large_i:wN
- }
-\cs_new:Npn \@@_exp_large_i:wN #1; #2
- {
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 1 \@@_exp_large:w {2718}{2818}{2845}{9045}{2353}{6029} \or:
- + 1 \@@_exp_large:w {7389}{0560}{9893}{0650}{2272}{3043} \or:
- + 2 \@@_exp_large:w {2008}{5536}{9231}{8766}{7740}{9285} \or:
- + 2 \@@_exp_large:w {5459}{8150}{0331}{4423}{9078}{1103} \or:
- + 3 \@@_exp_large:w {1484}{1315}{9102}{5766}{0342}{1116} \or:
- + 3 \@@_exp_large:w {4034}{2879}{3492}{7351}{2260}{8387} \or:
- + 4 \@@_exp_large:w {1096}{6331}{5842}{8458}{5992}{6372} \or:
- + 4 \@@_exp_large:w {2980}{9579}{8704}{1728}{2747}{4359} \or:
- + 4 \@@_exp_large:w {8103}{0839}{2757}{5384}{0077}{1000} \or:
+ \if_case:w #3 ~
+ \exp_after:wN \@@_fixed_continue:wn
+ \else:
+ \exp_after:wN \@@_exp_intarray:w
+ \int_value:w \@@_int_eval:w 36 * #1 + 4 * #3 \exp_after:wN ;
\fi:
- #1;
- \@@_exp_large_:wN
+ #2;
+ {
+ \if_meaning:w 0 #1
+ \exp_after:wN \@@_exp_large_after:wwn
+ \else:
+ \exp_after:wN \@@_exp_large:NwN
+ \int_value:w \@@_int_eval:w #1 - 1 \exp_after:wN \scan_stop:
+ \fi:
+ }
}
-\cs_new:Npn \@@_exp_large_:wN #1; #2
+\cs_new:Npn \@@_exp_intarray:w #1 ;
{
- \if_case:w #2 ~ \exp_after:wN \@@_fixed_continue:wn \or:
- + 1 \@@_exp_large:w {1105}{1709}{1807}{5647}{6248}{1171} \or:
- + 1 \@@_exp_large:w {1221}{4027}{5816}{0169}{8339}{2107} \or:
- + 1 \@@_exp_large:w {1349}{8588}{0757}{6003}{1039}{8374} \or:
- + 1 \@@_exp_large:w {1491}{8246}{9764}{1270}{3178}{2485} \or:
- + 1 \@@_exp_large:w {1648}{7212}{7070}{0128}{1468}{4865} \or:
- + 1 \@@_exp_large:w {1822}{1188}{0039}{0508}{9748}{7537} \or:
- + 1 \@@_exp_large:w {2013}{7527}{0747}{0476}{5216}{2455} \or:
- + 1 \@@_exp_large:w {2225}{5409}{2849}{2467}{6045}{7954} \or:
- + 1 \@@_exp_large:w {2459}{6031}{1115}{6949}{6638}{0013} \or:
- \fi:
- #1;
- \@@_exp_large_after:wwn
+ +
+ \__kernel_intarray_item:Nn \c_@@_exp_intarray
+ { \@@_int_eval:w #1 - 3 \scan_stop: }
+ \exp_after:wN \use_i:nnn
+ \exp_after:wN \@@_fixed_mul:wwn
+ \int_value:w 0
+ \exp_after:wN \@@_exp_intarray_aux:w
+ \int_value:w \__kernel_intarray_item:Nn
+ \c_@@_exp_intarray { \@@_int_eval:w #1 - 2 }
+ \exp_after:wN \@@_exp_intarray_aux:w
+ \int_value:w \__kernel_intarray_item:Nn
+ \c_@@_exp_intarray { \@@_int_eval:w #1 - 1 }
+ \exp_after:wN \@@_exp_intarray_aux:w
+ \int_value:w \__kernel_intarray_item:Nn \c_@@_exp_intarray {#1} ; ;
}
+\cs_new:Npn \@@_exp_intarray_aux:w 1 #1#2#3#4#5 ; { ; {#1#2#3#4} {#5} }
\cs_new:Npn \@@_exp_large_after:wwn #1; #2; #3
{
\@@_exp_Taylor:Nnnwn ? { } { } 0 #2; {} #3
@@ -1142,7 +1147,11 @@
\fi:
}
\cs_new:Npn \@@_pow_C_pack:w
- { \exp_after:wN \@@_exp_large_v:wN \c_@@_one_fixed_tl }
+ {
+ \exp_after:wN \@@_exp_large:NwN
+ \exp_after:wN 5
+ \c_@@_one_fixed_tl
+ }
% \end{macrocode}
% \end{macro}
%^^A end[todo]