[latex3-commits] [l3svn] r6032 - Remove stale code from l3bigint
noreply at latex-project.org
noreply at latex-project.org
Tue Sep 22 21:43:48 CEST 2015
Author: bruno
Date: 2015-09-22 21:43:47 +0200 (Tue, 22 Sep 2015)
New Revision: 6032
Modified:
trunk/l3trial/l3bigint/l3bigint.dtx
Log:
Remove stale code from l3bigint
I had left some code from a previous implementation
of l3bigint. It is now unsalvageable given the
extensive internal changes.
Modified: trunk/l3trial/l3bigint/l3bigint.dtx
===================================================================
--- trunk/l3trial/l3bigint/l3bigint.dtx 2015-09-22 19:38:25 UTC (rev 6031)
+++ trunk/l3trial/l3bigint/l3bigint.dtx 2015-09-22 19:43:47 UTC (rev 6032)
@@ -2814,214 +2814,6 @@
%</initex|package>
% \end{macrocode}
%
-% ^^A todo: old implementation is below
-%
-% \subsection{Multiplying big integers (stupid implementation)}
-%
-% \begin{macro}[EXP, int]{\@@_mul_o:ww}
-% \begin{macro}[EXP, aux]{\@@_mul:nw}
-% \begin{macrocode}
-\cs_new:cpn { @@_mul_o:ww }
- \s_@@ \@@_chk:w #1 . #2 #3 ;
- \s_@@ \@@_chk:w #4 . #5 #6 ;
- {
- \int_case:nnTF { #2 #5 1 }
- {
- { 1 } { }
- { -1 } { \exp_last_unbraced:Nf - }
- }
- { \@@_mul:nw {#3} #6 ; }
- { \exp_after:wN \c_@@_zero_bigint }
- }
-\cs_new:Npn \@@_mul:nw #1#2
- {
- \exp_after:wN \@@_mul:wnw
- \exp:w \exp_end_continue_f:w \@@_mul_digit:nN {#1} #2 ; {#1}
- }
-\cs_new:Npn \@@_mul:wnw #1 ; #2 #3
- {
- \token_if_eq_charcode:NNTF #3 ;
- {#1}
- {
- \exp_last_unbraced:Nf \@@_mul:wnw
- {
- \exp_after:wN \@@_add_signed:Nww \exp_after:wN +
- \exp:w \exp_end_continue_f:w \@@_mul_digit:nN {#2} #3 ;
- #1 0 ;
- ;
- }
- {#2}
- }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[EXP, aux]{\@@_mul_digit:nN}
-% \begin{macro}[EXP, aux]{\@@_mul_digit_digit:NN}
-% The result of each integer expression certainly has~$2$ digits,
-% thanks to the shift by~$9$ (well, with the carry from the level
-% below, this shift is~$10$). Specifically, every integer expression
-% yields a result in~$[10,91]$.
-% \begin{macrocode}
-\cs_new:Npn \@@_mul_digit:nN #1#2
- {
- \exp_after:wN \@@_add_after:N
- \@@_int_value:w \@@_int_eval:w \c_minus_one +
- \@@_mul_digit_digit:NN #2 #1 { ? \c_one \@@_add_end:w } \s__stop
- }
-\cs_new:Npn \@@_mul_digit_digit:NN #1#2
- {
- \use_none:n #2
- \exp_after:wN \use_ii_i:nn \exp_after:wN \@@_int_eval_end:
- \@@_int_value:w \__int_eval:w
- \c_nine + #1 * #2 + \@@_mul_digit_digit:NN #1
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsubsection{Long division}
-%
-% \begin{macro}[EXP]{\bigint_div_truncate:nn}
-% \begin{macro}[aux, EXP]{\@@_div_truncate:wwwnn}
-% \begin{macrocode}
-\cs_new:Npn \bigint_div_truncate:nn #1#2
- {
- \@@_value_do:nn {#2}
- { \@@_value_do:nn {#1} { \@@_div:nnnnN } }
- \@@_div_truncate:wwwnn
- }
-\cs_new:Npn \@@_div_truncate:wwwnn #1; #2; #3; #4 #5
- {
- \tl_if_empty:nTF {#1} { 0 }
- { \int_compare:nNnF {#4} = {#5} { - } #1 }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\bigint_mod:nn}
-% \begin{macro}[aux, EXP]{\@@_mod:wwwnn}
-% \begin{macrocode}
-\cs_new:Npn \bigint_mod:nn #1#2
- {
- \@@_value_do:nn {#2}
- { \@@_value_do:nn {#1} { \@@_div:nnnnN } }
- \@@_mod:wwwnn
- }
-\cs_new:Npn \@@_mod:wwwnn #1; #2; #3; #4 #5
- {
- \tl_if_empty:nTF {#2} { 0 }
- { \int_compare:nNnF {#4} = \c_one { - } #2 }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\bigint_div_round:nn}
-% \begin{macro}[aux, EXP]{\@@_div_round:wwwnn, \@@_div_round_aux:wn}
-% \begin{macrocode}
-\cs_new:Npn \bigint_div_round:nn #1#2
- {
- \@@_value_do:nn {#2}
- { \@@_value_do:nn {#1} { \@@_div:nnnnN } }
- \@@_div_round:wwwnn
- }
-\cs_new:Npn \@@_div_round:wwwnn #1; #2; #3; #4 #5
- {
- \int_compare:nNnTF
- {
- \exp_last_unbraced:Nf \@@_div_round_aux:wn
- { \@@_add_signed:Nww - #2 ; #3 ; ; } {#2}
- }
- = \c_one
- {
- \tl_if_empty:nTF {#1}
- { 0 }
- { \int_compare:nNnF {#4} = {#5} { - } #1 }
- }
- {
- \int_compare:nNnF {#4} = {#5} { \exp_after:wN - }
- \exp:w \exp_end_continue_f:w
- \tl_if_empty:nTF {#1} { 1 } { \@@_add_signed:Nww + 1 ; #1 ; }
- }
- }
-\cs_new:Npn \@@_div_round_aux:wn #1 ; #2
- { \@@_compare:nnnn { 1 } {#1} { 1 } {#2} }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[aux, EXP]
-% {\@@_div:nnnnN, \@@_div:nnn, \@@_div:wwn, \@@_div:wnw, \@@_div_next:nnNw}
-% \begin{macrocode}
-\cs_new:Npn \@@_div:nnnnN #1#2#3#4#5
- {
- \int_compare:nNnTF { #1 * #3 } = \c_zero
- {
- \int_compare:nNnT {#3} = \c_zero
- {
- \msg_expandable_error:nnf
- { bigint } { division-by-zero }
- { \@@_to_decimal:nn {#1} {#2} }
- }
- 0
- }
- {
- \exp_after:wN #5 \exp:w \exp_end_continue_f:w
- \exp_args:Nf \@@_div:nnn { \tl_count:n {#4} } {#2} {#4}
- {#1} {#3}
- }
- }
-\cs_new:Npn \@@_div:nnn #1#2#3
- {
- \use:nff \@@_div:wwn
- { \str_range:nnn {#2} { 1 } {#1} ; }
- { \str_range:nnn {#2} { #1 + 1 } { -1 } ; }
- {#3}
- }
-\cs_new:Npn \@@_div:wwn #1 ; #2 ; #3
- {
- \exp_after:wN \@@_add_after:N
- \@@_int_value:w \@@_int_eval:w \c_zero
- \@@_div:wnw #1 ; {#3} #2 ;
- }
-\cs_new:Npn \@@_div:wnw #1 ; #2
- {
- \int_compare:nNnTF
- { \@@_compare:nnnn { 1 } {#1} { 1 } {#2} } = \c_minus_one
- { \@@_div_next:nnNw {#1} {#2} }
- {
- + \c_one
- \exp_last_unbraced:Nf \@@_div:wnw
- { \@@_add_signed:Nww - #2 ; #1 ; ; }
- {#2}
- }
- }
-\cs_new:Npn \@@_div_next:nnNw #1#2#3
- {
- \token_if_eq_meaning:NNTF #3 ;
- { ; #1 ; #2 ; }
- {
- \exp_after:wN \@@_int_eval_end:
- \@@_int_value:w \@@_int_eval:w \c_zero
- \exp_last_unbraced:Nf \@@_div:wnw
- { \@@_add_after:N #1 #3 ; } {#2}
- }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Messages}
-%
-% Be careful that |#1| may be very long, so give a meaningful message
-% before |#1|.
-% \begin{macrocode}
-\msg_new:nnn { bigint } { division-by-zero }
- { Division~by~zero:~#1/0. }
-% \end{macrocode}
-%
% \end{implementation}
%
% \PrintIndex
More information about the latex3-commits
mailing list