diff options
author | Karl Berry <karl@freefriends.org> | 2016-11-22 22:50:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-11-22 22:50:16 +0000 |
commit | f476e2547d6f421f3f59e812adb855596f668eb5 (patch) | |
tree | 859e615afe313dc934f3ca679cd4ea760e356f98 /Master/texmf-dist/tex/latex/l3kernel | |
parent | 4061b69b7a85fc322821dbfc8beb83b498542e45 (diff) |
l3 (22nov16)
git-svn-id: svn://tug.org/texlive/trunk@42556 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel')
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex | 284 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/l3kernel/expl3.sty | 4 |
3 files changed, 283 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index c15781e05f6..6fa4e32f964 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -33,6 +33,7 @@ %% l3fp-expo.dtx (with options: `package') %% l3fp-trig.dtx (with options: `package') %% l3fp-convert.dtx (with options: `package') +%% l3fp-random.dtx (with options: `package') %% l3fp-assign.dtx (with options: `package') %% l3box.dtx (with options: `package') %% l3coffins.dtx (with options: `package') @@ -82,8 +83,8 @@ %% ----------------------------------------------------------------------- \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2016/10/19}% -\def\ExplFileVersion{6730}% +\def\ExplFileDate{2016/11/21}% +\def\ExplFileVersion{6760}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -10622,7 +10623,7 @@ %% %% ----------------------------------------------------------------------- %% -\GetIdInfo$Id: l3fp.dtx 6685 2016-08-19 16:26:52Z bruno $ +\GetIdInfo$Id: l3fp.dtx 6761 2016-11-21 21:48:43Z joseph $ {L3 Floating points} %% File: l3fp-aux.dtx Copyright(C) 2011-2014,2016 The LaTeX3 Project %% @@ -10864,6 +10865,32 @@ { \fi: \__fp_exp_after_o:w \s__fp #3 ; } \cs_new:Npn \__fp_case_return_ii_o:ww #1 \fi: #2 \s__fp #3 ; { \fi: \__fp_exp_after_o:w } +\prg_new_conditional:Npnn \__fp_int:w \s__fp \__fp_chk:w #1 #2 #3; { TF , T , F , p } + { + \if_case:w #1 \exp_stop_f: + \prg_return_true: + \or: \__fp_int_normal:nnnnn #3 + \else: \prg_return_false: + \fi: + } +\cs_new:Npn \__fp_int_normal:nnnnn #1 #2#3#4#5 + { + \if_int_compare:w #1 > \c_zero + \__fp_decimate:nNnnnn { \c_sixteen - #1 } + \__fp_int_test:Nw + {#2} {#3} {#4} {#5} + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \__fp_int_test:Nw #1#2; + { + \if_meaning:w 0 #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } \cs_new:Npn \__fp_small_int:wTF \s__fp \__fp_chk:w #1#2 { \if_case:w #1 \exp_stop_f: @@ -11299,13 +11326,24 @@ \cs_new:Npn \__fp_round_o:Nw #1#2 @ { \if_case:w - \__int_eval:w \__fp_array_count:n {#2} - \c_one \__int_eval_end: - \__fp_round:Nwn #1 #2 {0} \exp:w + \__int_eval:w \__fp_array_count:n {#2} \__int_eval_end: + \__fp_round_no_arg_o:Nw #1 \exp:w + \or: \__fp_round:Nwn #1 #2 {0} \exp:w \or: \__fp_round:Nww #1 #2 \exp:w \else: \__fp_round:Nwww #1 #2 @ \exp:w \fi: \exp_end_continue_f:w } +\cs_new:Npn \__fp_round_no_arg_o:Nw #1 + { + \cs_if_eq:NNTF #1 \__fp_round_to_nearest:NNN + { \__fp_error:nnnn { num-args } { round () } { 1 } { 3 } } + { + \__fp_error:nffn { num-args } + { \__fp_round_name_from_cs:N #1 () } { 1 } { 2 } + } + \exp_after:wN \c_nan_fp + } \cs_new:Npn \__fp_round:Nwww #1#2 ; #3 ; \s__fp \__fp_chk:w #4#5#6 ; #7 @ { \cs_if_eq:NNTF #1 \__fp_round_to_nearest:NNN @@ -12100,6 +12138,30 @@ } } \group_end: +\cs_new:cpn { __fp_parse_prefix_,:Nw } #1 + { + \if_int_compare:w #1 = \c_one + \exp_after:wN \__fp_parse_one:Nw + \exp_after:wN #1 + \else: + \__msg_kernel_expandable_error:nnn + { kernel } { fp-missing-number } { , } + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 + \exp_after:wN , + \fi: + } +\cs_new:cpn { __fp_parse_prefix_):Nw } #1 + { + \if_int_compare:w #1 = \c_one + \else: + \__msg_kernel_expandable_error:nnn + { kernel } { fp-missing-number } { ) } + \exp_after:wN \c_nan_fp \exp:w \exp_end_continue_f:w + \fi: + \__fp_parse_infix:NN #1 ) + } \cs_set_protected:Npn \__fp_tmp:w #1 #2 { \cs_new:cpn { __fp_parse_word_#1:N } @@ -12170,6 +12232,10 @@ { \__fp_parse_function:NNN \__fp_minmax_o:Nw 2 } \cs_new:Npn \__fp_parse_word_min:N { \__fp_parse_function:NNN \__fp_minmax_o:Nw 0 } +\cs_new:Npn \__fp_parse_word_rand:N + { \__fp_parse_function:NNN \__fp_rand_o:Nw ? } +\cs_new:Npn \__fp_parse_word_randint:N + { \__fp_parse_function:NNN \__fp_randint_o:Nw ? } \cs_new:Npn \__fp_parse_word_abs:N { \__fp_parse_unary_function:nNN { set_sign } 0 } \cs_new:Npn \__fp_parse_word_exp:N @@ -12227,6 +12293,12 @@ \cs_new:Npn \__fp_parse_after:ww #1@ \__fp_parse_infix_end:N \s__fp_stop { \exp_end: #1 } +\cs_new:Npn \__fp_parse_o:n #1 + { + \exp_after:wN \exp_after:wN + \exp_after:wN \__fp_exp_after_o:w + \__fp_parse:n {#1} + } \cs_new:Npn \__fp_parse_operand:Nw #1 { \exp_end_continue_f:w @@ -12847,6 +12919,48 @@ \fp_while_do:nNnn {#1} #2 {#3} {#4} } } +\cs_new:Npn \fp_step_function:nnnN #1#2#3 + { + \exp_after:wN \__fp_step:wwwN + \exp:w \exp_end_continue_f:w \__fp_parse_o:n {#1} : + \exp:w \exp_end_continue_f:w \__fp_parse_o:n {#2} : + \exp:w \exp_end_continue_f:w \__fp_parse:n {#3} : + } +\cs_generate_variant:Nn \fp_step_function:nnnN { nnnc } +\cs_new:Npn \__fp_step:wwwN #1 : #2 : #3 : #4 + { + \fp_compare:nNnTF {#2} > 0 + { \__fp_step:NfnnN > } + { + \fp_compare:nNnTF {#2} = 0 + { + \__msg_kernel_expandable_error:nnn { kernel } { zero-step } {#4} + \use_none:nnnn + } + { \__fp_step:NfnnN < } + } + { \fp_eval:n {#1} } {#2} {#3} #4 + } + +\cs_new:Npn \__fp_step:NnnnN #1#2#3#4#5 + { + \fp_compare:nNnF {#2} #1 {#4} + { + #5 {#2} + \__fp_step:NfnnN + #1 { \fp_eval:n { #2 + #3 } } {#3} {#4} #5 + } + } +\cs_generate_variant:Nn \__fp_step:NnnnN { Nf } +\cs_new_protected:Npn \fp_step_inline:nnnn #1#2#3#4 + { + \int_gincr:N \g__prg_map_int + \cs_gset_protected:cpn { __prg_map_ \int_use:N \g__prg_map_int :w } + ##1 {#4} + \fp_step_function:nnnc {#1} {#2} {#3} + { __prg_map_ \int_use:N \g__prg_map_int :w } + \__prg_break_point:Nn \scan_stop: { \int_gdecr:N \g__prg_map_int } + } \cs_new:Npn \__fp_minmax_o:Nw #1#2 @ { \if_meaning:w 0 #1 @@ -16033,6 +16147,166 @@ } \exp_not:N \__fp_array_to_clist_loop:Nw } +%% File: l3fp-random.dtx Copyright (C) 2016 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 +%% license or (at your option) any later version. The latest version +%% of this license is in the file +%% +%% http://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3kernel bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% The released version of this bundle is available from CTAN. +%% +%% ----------------------------------------------------------------------- +%% +%% The development version of the bundle can be found at +%% +%% http://www.latex-project.org/svnroot/experimental/trunk/ +%% +%% for those people who are interested. +%% +%%%%%%%%%%% +%% NOTE: %% +%%%%%%%%%%% +%% +%% Snapshots taken from the repository represent work in progress and may +%% not work or may contain conflicting material! We therefore ask +%% people _not_ to put them into distributions, archives, etc. without +%% prior consultation with the LaTeX Project Team. +%% +%% ----------------------------------------------------------------------- +%% +\cs_new:Npn \__fp_rand_o:Nw ? #1 @ + { + \tl_if_empty:nTF {#1} + { \__fp_rand_o: } + { + \__msg_kernel_expandable_error:nnnnn + { kernel } { fp-num-args } { rand() } { 0 } { 0 } + \exp_after:wN \c_nan_fp + } + } +\cs_if_exist:NTF \pdftex_uniformdeviate:D + { + \cs_new:Npn \__fp_rand_o: + { + \__fp_parse_o:n + { + . + \exp_after:wN \use_none:n + \__int_value:w \__int_eval:w 1 0000 0000 + + \pdftex_uniformdeviate:D 1 0000 0000 \__int_eval_end: + \exp_after:wN \use_none:n + \__int_value:w \__int_eval:w 1 0000 0000 + + \pdftex_uniformdeviate:D 1 0000 0000 \__int_eval_end: + } + } + } + { + \cs_new:Npn \__fp_rand_o: + { + \__msg_kernel_expandable_error:nn { kernel } { fp-no-random } + \exp_after:wN \c_nan_fp + } + } +\cs_new:Npn \__fp_randint_o:Nw ? #1 @ + { + \if_case:w + \__int_eval:w \__fp_array_count:n {#1} - \c_one \__int_eval_end: + \exp_after:wN \__fp_randint_e:w \c_one_fp #1 + \or: \__fp_randint_e:w #1 + \else: + \__msg_kernel_expandable_error:nnnnn + { kernel } { fp-num-args } { randint() } { 1 } { 2 } + \exp_after:wN \c_nan_fp \exp:w + \fi: + \exp_after:wN \exp_end: + } +\cs_new:Npn \__fp_randint_badarg:w \s__fp \__fp_chk:w #1#2#3; + { + \__fp_int:wTF \s__fp \__fp_chk:w #1#2#3; + { + \if_meaning:w 1 #1 + \if_int_compare:w + \use_i_delimit_by_q_stop:nw #3 \q_stop > \c_sixteen + \exp_after:wN \c_one + \fi: + \fi: + } + { \c_one } + } +\cs_new:Npn \__fp_randint_e:w #1; #2; + { + \if_case:w + \__fp_randint_badarg:w #1; + \__fp_randint_badarg:w #2; + \fp_compare:nNnTF { #1; } > { #2; } { \c_one } { \c_zero } + \fp_compare:nNnTF { #1; + 2e9 } < { #2; } + { \__fp_randint_wide_e:nn } + { \__fp_randint_narrow_e:nn } + { #1; } { #2; } + \or: + \__fp_invalid_operation_tl_o:ff + { randint } { \__fp_array_to_clist:n { #1; #2; } } + \exp:w + \fi: + } +\cs_if_exist:NTF \pdftex_uniformdeviate:D + { + \cs_new:Npn \__fp_randint_narrow_e:nn #1#2 + { + \__fp_parse_o:n + { + #1 + + \pdftex_uniformdeviate:D + \int_eval:n { \fp_to_int:n { #2 - #1 } + \c_one } + } + \exp:w + } + \cs_new:Npn \__fp_randint_wide_e:nn #1 #2 + { + \exp_args:Nf \__fp_randint_wide_e:nnn + { \fp_to_int:n { ceil ( ( #2 - #1 + \c_six ) * 1e-8 ) } } + {#1} {#2} + } + \cs_new:Npn \__fp_randint_wide_e:nnn #1#2#3 + { + \exp_args:Nf \__fp_randint_wide_e:nnnn + { + \__fp_parse:n + { + #2 + + \pdftex_uniformdeviate:D #1 e 8 + + \pdftex_uniformdeviate:D 1 0000 0000 + } + } + {#1} {#2} {#3} + } + \cs_new:Npn \__fp_randint_wide_e:nnnn #1#2#3#4 + { + \fp_compare:nNnTF {#1} > {#4} + { \__fp_randint_wide_e:nnn {#2} {#3} {#4} } + { \__fp_exp_after_o:w #1 \exp:w } + } + } + { + \cs_new:Npn \__fp_randint_narrow_e:nn #1#2 + { + \__msg_kernel_expandable_error:nn { kernel } { fp-no-random } + \exp_after:wN \c_nan_fp \exp:w + } + \cs_new:Npn \__fp_randint_wide_e:nn #1#2 + { + \__msg_kernel_expandable_error:nn { kernel } { fp-no-random } + \exp_after:wN \c_nan_fp \exp:w + } + } +\__msg_kernel_new:nnn { kernel } { fp-no-random } + { Random~numbers~unavailable } %% %% File: l3fp-assign.dtx Copyright (C) 2011-2016 The LaTeX3 project %% diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex index b57887da668..4c9fa9cd86f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex @@ -47,8 +47,8 @@ %% ----------------------------------------------------------------------- \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2016/10/19}% -\def\ExplFileVersion{6730}% +\def\ExplFileDate{2016/11/21}% +\def\ExplFileVersion{6760}% \let\ExplLoaderFileVersion\ExplFileVersion \begingroup \def\tempa{LaTeX2e}% diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 7dfc9b66c66..f41857ca261 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -47,8 +47,8 @@ %% ----------------------------------------------------------------------- \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2016/10/19}% -\def\ExplFileVersion{6730}% +\def\ExplFileDate{2016/11/21}% +\def\ExplFileVersion{6760}% \let\ExplLoaderFileVersion\ExplFileVersion \ProvidesPackage{\ExplFileName} [% |