From 3301423440393adfdbbcfa0d8471e4b4c63df1e6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 31 Aug 2012 17:58:55 +0000 Subject: l3kernel 3160 (31aug12) git-svn-id: svn://tug.org/texlive/trunk@27559 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/l3kernel/expl3.sty | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3basics.sty | 15 +- Master/texmf-dist/tex/latex/l3kernel/l3clist.sty | 13 +- Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3color.sty | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | 9 +- Master/texmf-dist/tex/latex/l3kernel/l3expan.sty | 162 ++-- Master/texmf-dist/tex/latex/l3kernel/l3file.sty | 8 +- Master/texmf-dist/tex/latex/l3kernel/l3fp.sty | 909 +++++++++++---------- Master/texmf-dist/tex/latex/l3kernel/l3int.sty | 12 +- Master/texmf-dist/tex/latex/l3kernel/l3msg.sty | 14 +- Master/texmf-dist/tex/latex/l3kernel/l3prg.sty | 6 +- Master/texmf-dist/tex/latex/l3kernel/l3prop.sty | 6 +- Master/texmf-dist/tex/latex/l3kernel/l3seq.sty | 6 +- Master/texmf-dist/tex/latex/l3kernel/l3skip.sty | 2 +- 15 files changed, 661 insertions(+), 513 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 6adfc5fed60..edf7566552f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -60,8 +60,8 @@ } \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2012/08/14} -\def\ExplFileVersion{4091} +\def\ExplFileDate{2012/08/29} +\def\ExplFileVersion{4160} \RequirePackage{etex} \reserveinserts{32} \ProvidesExplPackage diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index c7c5bcb0eb8..d9dfc41083c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3basics.dtx 4069 2012-08-08 23:12:57Z bruno $ +\GetIdInfo$Id: l3basics.dtx 4144 2012-08-27 19:37:16Z bruno $ {L3 Basic definitions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -82,7 +82,10 @@ \tex_let:D \if_int_compare:w \tex_ifnum:D \tex_let:D \__int_to_roman:w \tex_romannumeral:D \tex_let:D \group_insert_after:N \tex_aftergroup:D -\tex_long:D \tex_def:D \exp_args:Nc #1#2 { \exp_after:wN #1 \cs:w #2 \cs_end: } +\tex_long:D \tex_def:D \exp_args:Nc #1#2 + { \exp_after:wN #1 \cs:w #2 \cs_end: } +\tex_long:D \tex_def:D \exp_args:cc #1#2 + { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: } \tex_def:D \token_to_str:c { \exp_args:Nc \token_to_str:N } \tex_long:D \tex_def:D \cs_meaning:c #1 { @@ -254,7 +257,7 @@ \exp_after:wN \use_ii:nn \fi: { - \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 _p: #5 } #6 + \exp_args:cc { cs_ #2 #3 :Npn } { #4 _p: #5 } #6 { #7 \c_zero \c_true_bool \c_false_bool } } { @@ -264,17 +267,17 @@ } \cs_set_protected:Npn \__prg_generate_T_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 T } #6 + \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 T } #6 { #7 \c_zero \use:n \use_none:n } } \cs_set_protected:Npn \__prg_generate_F_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 F } #6 + \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 F } #6 { #7 \c_zero { } } } \cs_set_protected:Npn \__prg_generate_TF_form:wnnnnnn #1 \q_stop #2#3#4#5#6#7 { - \exp_args:Nc \exp_args:Nc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6 + \exp_args:cc { cs_ #2 #3 :Npn } { #4 : #5 TF } #6 { #7 \c_zero } } \cs_set_protected_nopar:Npn \prg_set_eq_conditional:NNn diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty index 35d5381e677..18cee384adc 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -48,7 +48,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3clist.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3clist.dtx 4102 2012-08-15 16:08:27Z bruno $ {L3 Comma separated lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -146,7 +146,7 @@ \cs_new_protected_nopar:Npn \clist_put_right:Nn { \__clist_put_right:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \__clist_put_right:NNNn \clist_gconcat:NNN \clist_gset:Nn } + { \__clist_put_right:NNNn \clist_gconcat:NNN \clist_set:Nn } \cs_new_protected:Npn \__clist_put_right:NNNn #1#2#3#4 { #2 \l__clist_internal_clist {#4} @@ -419,18 +419,13 @@ } \cs_new_protected:Npn \clist_show:N #1 { - \__msg_show_variable:Nnn - #1 - { clist } + \__msg_show_variable:Nnx #1 { clist } { \clist_map_function:NN #1 \__msg_show_item:n } } \cs_new_protected:Npn \clist_show:n #1 { \clist_set:Nn \l__clist_internal_clist {#1} - \__msg_show_variable:Nnn - \l__clist_internal_clist - { clist } - { \clist_map_function:NN \l__clist_internal_clist \__msg_show_item:n } + \clist_show:N \l__clist_internal_clist } \cs_generate_variant:Nn \clist_show:N { c } \clist_new:N \l_tmpa_clist diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty index a126e8fd5c4..1b8d88d4761 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty @@ -47,7 +47,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3coffins.dtx 4011 2012-07-20 21:02:59Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 4092 2012-08-14 14:04:41Z bruno $ {L3 Coffin code layer} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -807,7 +807,7 @@ { \__coffin_if_exist:NT #1 { - \__msg_show_variable:Nnn #1 { coffins } + \__msg_show_variable:Nnx #1 { coffins } { \prop_map_function:cN { l__coffin_poles_ \__int_value:w #1 _prop } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty index 1584c055979..12b019250a5 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty @@ -47,8 +47,8 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3color.dtx 3991 2012-07-16 19:00:35Z joseph $ - {L3 Experimental colour support} +\GetIdInfo$Id: l3color.dtx 4156 2012-08-29 11:10:09Z joseph $ + {L3 Experimental color support} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \__expl_package_check: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 111db55e442..641a13ec78c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -52,7 +52,7 @@ \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription \RequirePackage{expl3,xparse,calc} -\GetIdInfo$Id: l3doc.dtx 4070 2012-08-09 11:04:46Z joseph $ +\GetIdInfo$Id: l3doc.dtx 4130 2012-08-20 21:30:22Z joseph $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -71,7 +71,6 @@ \tl_new:N \l__codedoc_macro_tl \int_new:N \l__codedoc_macro_int \int_new:N \g__codedoc_nested_macro_int -\int_new:N \g__codedoc_codeline_int \prop_new:N \g__codedoc_missing_tests_prop \clist_new:N \g_docinput_clist \tl_new:N \l__codedoc_at_replaced_macro_tl @@ -798,7 +797,7 @@ \tl_to_str:N \l__codedoc_at_replaced_macro_tl }] } - \int_gincr:N \g__codedoc_codeline_int + \int_gincr:N \c@CodelineNo \bool_if:NF \l__codedoc_macro_aux_bool { @@ -822,7 +821,7 @@ \exp_args:Nx \DoNotIndex{ \tl_to_str:N \l__codedoc_at_replaced_macro_tl } } - \int_gdecr:N \g__codedoc_codeline_int + \int_gdecr:N \c@CodelineNo \ignorespaces } \tl_clear:N \l__codedoc_macro_tl @@ -1250,7 +1249,7 @@ \immediate\write\@indexfile { \string\indexentry{#1} - { \filesep \int_use:N \g__codedoc_codeline_int } + { \filesep \int_use:N \c@CodelineNo } } } \cs_set_eq:NN \filesep \@empty diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty index f7a458e9a88..6dceea954ad 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3expan.dtx 4073 2012-08-10 01:33:13Z bruno $ +\GetIdInfo$Id: l3expan.dtx 4149 2012-08-28 10:50:40Z bruno $ {L3 Argument expansion} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -56,6 +56,7 @@ \cs_new:Npn \::: #1 {#1} \cs_new:Npn \::n #1 \::: #2#3 { #1 \::: { #2 {#3} } } \cs_new:Npn \::N #1 \::: #2#3 { #1 \::: {#2#3} } +\cs_new:Npn \::p #1 \::: #2#3# { #1 \::: {#2#3} } \cs_new:Npn \::c #1 \::: #2#3 { \exp_after:wN \__exp_arg_next:Nnn \cs:w #3 \cs_end: {#1} {#2} } \cs_new:Npn \::o #1 \::: #2#3 @@ -109,8 +110,6 @@ { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN {#3} } \cs_new:Npn \exp_args:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN#2 \exp_after:wN #3 \exp_after:wN {#4} } -\cs_new:Npn \exp_args:cc #1#2 - { \cs:w #1 \exp_after:wN \cs_end: \cs:w #2 \cs_end: } \cs_new:Npn \exp_args:NNc #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 \cs:w # 3\cs_end: } \cs_new:Npn \exp_args:Ncc #1#2#3 @@ -313,80 +312,151 @@ \exp_after:wN #1 \exp_after:wN \__cs_generate_variant:nnNN \exp_after:wN #1 - \etex_detokenize:D {#2} , ? , \q_recursion_stop + \etex_detokenize:D {#2} , \scan_stop: , \q_recursion_stop } \group_begin: - \tex_lccode:D `\Z = `\d \scan_stop: - \tex_lccode:D `\? =`\\ \scan_stop: + \tex_catcode:D `\M = 12 \scan_stop: + \tex_catcode:D `\A = 12 \scan_stop: \tex_catcode:D `\P = 12 \scan_stop: \tex_catcode:D `\R = 12 \scan_stop: - \tex_catcode:D `\O = 12 \scan_stop: - \tex_catcode:D `\T = 12 \scan_stop: - \tex_catcode:D `\E = 12 \scan_stop: - \tex_catcode:D `\C = 12 \scan_stop: - \tex_catcode:D `\Z = 12 \scan_stop: \tex_lowercase:D { \group_end: \cs_new_protected:Npn \__cs_generate_variant:N #1 { - \exp_after:wN \__cs_generate_variant:w - \token_to_meaning:N #1 - \q_mark \cs_new_protected_nopar:Npx - ? PROTECTEZ - \q_mark \cs_new_nopar:Npx - \q_stop + \exp_after:wN \if_meaning:w \exp_not:N #1 #1 + \cs_set_eq:NN \__cs_tmp:w \cs_new_protected_nopar:Npx + \else: + \exp_after:wN \__cs_generate_variant:ww + \token_to_meaning:N #1 MA \q_mark + \q_mark \cs_new_protected_nopar:Npx + PR + \q_mark \cs_new_nopar:Npx + \q_stop + \fi: } - \cs_new_protected:Npn \__cs_generate_variant:w - #1 ? PROTECTEZ #2 \q_mark #3 #4 \q_stop + \cs_new_protected:Npn \__cs_generate_variant:ww #1 MA #2 \q_mark + { \__cs_generate_variant:wwNw #1 } + \cs_new_protected:Npn \__cs_generate_variant:wwNw + #1 PR #2 \q_mark #3 #4 \q_stop { \cs_set_eq:NN \__cs_tmp:w #3 } } \cs_new_protected:Npn \__cs_generate_variant:nnNN #1#2#3#4 - { \__cs_generate_variant:Nnnw #4 {#1}{#2} } + { + \if_meaning:w \c_false_bool #3 + \__msg_kernel_error:nnx { kernel } { missing-colon } + { \token_to_str:c {#1} } + \exp_after:wN \use_none_delimit_by_q_recursion_stop:w + \fi: + \__cs_generate_variant:Nnnw #4 {#1}{#2} + } \cs_new_protected:Npn \__cs_generate_variant:Nnnw #1#2#3#4 , { - \if:w ? #4 + \if_meaning:w \scan_stop: #4 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: - \exp_after:wN \__cs_generate_variant:NNn - \exp_after:wN #1 - \cs:w - #2 : - \__cs_generate_variant_loop:NwN - ? #3 - \q_mark #4 \__cs_generate_variant_loop_end:w - \q_mark \__cs_generate_variant_loop_error:wnNNnn - \q_stop - \cs_end: - {#4} + \use:x + { + \exp_not:N \__cs_generate_variant:wwNN + \__cs_generate_variant_loop:nNwN { } + #4 + \__cs_generate_variant_loop_end:nwwwNNnn + \q_mark + #3 ~ + { ~ { } \fi: \__cs_generate_variant_loop_long:wNNnn } ~ + { } + \q_stop + \exp_not:N #1 {#2} {#4} + } \__cs_generate_variant:Nnnw #1 {#2} {#3} } -\cs_new:Npn \__cs_generate_variant_loop:NwN #1 #2 \q_mark #3 - { #3 \__cs_generate_variant_loop:NwN #2 \q_mark } -\cs_new:Npn \__cs_generate_variant_loop_end:w #1#2 \q_mark #3 \q_stop {#2} -\cs_new:Npn \__cs_generate_variant_loop_error:wnNNnn - #1 \q_stop \cs_end: #2 #3#4#5#6 +\cs_new:Npn \__cs_generate_variant_loop:nNwN #1#2#3 \q_mark #4 + { + \if:w #2 #4 + \exp_after:wN \__cs_generate_variant_loop_same:w + \else: + \if:w N #4 \else: + \if:w n #4 \else: + \__cs_generate_variant_loop_invalid:NNwNNnn #4#2 + \fi: + \fi: + \fi: + #1 + \prg_do_nothing: + #2 + \__cs_generate_variant_loop:nNwN { } #3 \q_mark + } +\cs_new:Npn \__cs_generate_variant_loop_same:w + #1 \prg_do_nothing: #2#3#4 + { + #3 { #1 \__cs_generate_variant_same:N #2 } + } +\cs_new:Npn \__cs_generate_variant_loop_end:nwwwNNnn + #1#2 \q_mark #3 ~ #4 \q_stop #5#6#7#8 { - \cs_end: {#2} - \__msg_kernel_error:nnxx { kernel } { variant-too-long } - { \tl_to_str:n {#2} } { \token_to_str:N #4 } - #3 #4 {#5} {#6} + \scan_stop: \scan_stop: \fi: + \exp_not:N \q_mark + \exp_not:N \q_stop + \exp_not:N #6 + \exp_not:c { #7 : #8 #1 #3 } + } +\cs_new:Npn \__cs_generate_variant_loop_long:wNNnn #1 \q_stop #2#3#4#5 + { + \exp_not:n + { + \q_mark + \__msg_kernel_error:nnxx { kernel } { variant-too-long } + {#5} { \token_to_str:N #3 } + \use_none:nnnn + \q_stop + #3 + #3 + } + } +\cs_new:Npn \__cs_generate_variant_loop_invalid:NNwNNnn + #1#2 \fi: \fi: \fi: #3 \q_stop #4#5#6#7 + { + \fi: \fi: \fi: + \exp_not:n + { + \q_mark + \__msg_kernel_error:nnxxxx { kernel } { invalid-variant } + {#7} { \token_to_str:N #5 } {#1} {#2} + \use_none:nnnn + \q_stop + #5 + #5 + } + } +\cs_new:Npn \__cs_generate_variant_same:N #1 + { + \if:w N #1 + N + \else: + \if:w p #1 + p + \else: + n + \fi: + \fi: } -\cs_new_protected:Npn \__cs_generate_variant:NNn #1 #2 #3 +\cs_new_protected:Npn \__cs_generate_variant:wwNN + #1 \q_mark #2 \q_stop #3#4 { - \cs_if_free:NTF #2 + #2 + \cs_if_free:NTF #4 { \group_begin: - \__cs_generate_internal_variant:n {#3} - \__cs_tmp:w #2 { \exp_not:c { exp_args:N #3 } \exp_not:N #1 } + \__cs_generate_internal_variant:n {#1} + \__cs_tmp:w #4 { \exp_not:c { exp_args:N #1 } \exp_not:N #3 } \group_end: } { \iow_log:x { - Variant~\token_to_str:N #2~% + Variant~\token_to_str:N #4~% already~defined;~ not~ changing~ it~on~line~% \tex_the:D \tex_inputlineno:D } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty index c222c3a6358..44e02bdff7c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3file.dtx 4059 2012-08-08 13:12:06Z bruno $ +\GetIdInfo$Id: l3file.dtx 4101 2012-08-15 16:05:33Z bruno $ {L3 File and I/O operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -55,6 +55,7 @@ \tl_gset_eq:NN \g_file_current_name_tl \@currname \seq_new:N \g__file_stack_seq \seq_new:N \g__file_record_seq +\tl_new:N \l__file_internal_tl \tl_new:N \l__file_internal_name_tl \seq_new:N \l__file_search_path_seq \seq_new:N \l__file_saved_search_path_seq @@ -141,10 +142,11 @@ \clist_if_exist:NTF \@filelist { \@addtofilelist {#1} } { \seq_gput_right:Nn \g__file_record_seq {#1} } - \seq_gpush:Nn \g__file_stack_seq \g_file_current_name_tl + \seq_gpush:No \g__file_stack_seq \g_file_current_name_tl \tl_gset:Nn \g_file_current_name_tl {#1} \tex_input:D #1 \c_space_tl - \seq_gpop:NN \g__file_stack_seq \g_file_current_name_tl + \seq_gpop:NN \g__file_stack_seq \l__file_internal_tl + \tl_gset_eq:NN \g_file_current_name_tl \l__file_internal_tl } \cs_generate_variant:Nn \__file_input_aux:n { o } \cs_new_protected:Npn \file_path_include:n #1 diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty index 3918bd5a161..cd23b05bfc1 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty @@ -59,7 +59,7 @@ %% ----------------------------------------------------------------------- %% \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp.dtx 4089 2012-08-14 04:52:20Z bruno $ +\GetIdInfo$Id: l3fp.dtx 4151 2012-08-28 11:51:52Z bruno $ {L3 Floating points} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -218,11 +218,15 @@ \int_const:Nn \c__fp_middle_shift_int { 5 0000 * 9999 } \int_const:Nn \c__fp_trailing_shift_int { 5 0000 * 10000 } \cs_new:Npn \__fp_pack:NNNNNw #1 #2#3#4#5 #6; { + #1#2#3#4#5 ; {#6} } +\cs_new:Npn \__fp_pack:NNNNNwn #1 #2#3#4#5 #6; #7 + { + #1#2#3#4#5 ; {#7} {#6} } \int_const:Nn \c__fp_big_leading_shift_int { - 15 2374 } \int_const:Nn \c__fp_big_middle_shift_int { 15 2374 * 9999 } \int_const:Nn \c__fp_big_trailing_shift_int { 15 2374 * 10000 } \cs_new:Npn \__fp_pack_big:NNNNNNw #1#2 #3#4#5#6 #7; { + #1#2#3#4#5#6 ; {#7} } +\cs_new:Npn \__fp_pack_big:NNNNNNwn #1#2 #3#4#5#6 #7; #8 + { + #1#2#3#4#5#6 ; {#8} {#7} } \int_const:Nn \c__fp_Bigg_leading_shift_int { - 20 0000 } \int_const:Nn \c__fp_Bigg_middle_shift_int { 20 0000 * 9999 } \int_const:Nn \c__fp_Bigg_trailing_shift_int { 20 0000 * 10000 } @@ -417,7 +421,7 @@ { \cs_set:Npn \__fp_invalid_operation:nnw ##1##2##3; } { #1 - \__fp_error:nffn { invalid } {##2} { \__fp_to_tl:w ##3; } { } + \__fp_error:nnfn { invalid } {##2} { \__fp_to_tl:w ##3; } { } \fp_flag_on:n { invalid_operation } ##1 } @@ -431,11 +435,10 @@ \exp_after:wN \c_nan_fp } \exp_args:Nno \use:n - { \cs_set:Npn \__fp_array_invalid_operation_o:nw ##1##2@ } + { \cs_set:Npn \__fp_invalid_operation_tl_o:nf ##1##2 } { #1 - \__fp_error:nffn { invalid } - {##1} { \__fp_array_to_clist:w ##2 @ } { } + \__fp_error:nnfn { invalid } {##1} {##2} { } \fp_flag_on:n { invalid_operation } \exp_after:wN \c_nan_fp } @@ -452,7 +455,7 @@ { \cs_set:Npn \__fp_division_by_zero_o:Nnw ##1##2##3; } { #1 - \__fp_error:nffn { zero-div } {##2} { \__fp_to_tl:w ##3; } { } + \__fp_error:nnfn { zero-div } {##2} { \__fp_to_tl:w ##3; } { } \fp_flag_on:n { division_by_zero } \exp_after:wN ##1 } @@ -499,7 +502,7 @@ } \cs_new:Npn \__fp_invalid_operation:nnw #1#2#3; { } \cs_new:Npn \__fp_invalid_operation_o:Nww #1#2; #3; { } -\cs_new:Npn \__fp_array_invalid_operation_o:nw #1 #2 @ { } +\cs_new:Npn \__fp_invalid_operation_tl_o:nf #1 #2 { } \cs_new:Npn \__fp_division_by_zero_o:Nnw #1#2#3; { } \cs_new:Npn \__fp_division_by_zero_o:NNww #1#2#3; #4; { } \cs_new:Npn \__fp_overflow:w { } @@ -512,21 +515,7 @@ { \__fp_invalid_operation:nnw { \exp_after:wN \c_nan_fp } } \cs_new:Npn \__fp_error:nnnn #1 { \__msg_kernel_expandable_error:nnnnn { kernel } { fp - #1 } } -\cs_generate_variant:Nn \__fp_error:nnnn { nff } -\cs_new:Npn \__fp_array_to_clist:w #1 @ - { - \__fp_array_to_clist_i:wwww ; - #1 - \__fp_array_to_clist_ii:ww \s__fp ; @ - } -\cs_new:Npn \__fp_array_to_clist_i:wwww #1; #2 \s__fp #3; #4 @ - { - #2 - \exp_after:wN \__fp_array_to_clist_i:wwww - \tex_romannumeral:D -`0 \__fp_to_tl:w \s__fp #3 ; ; - #4 , ~ #1 @ - } -\cs_new:Npn \__fp_array_to_clist_ii:ww #1 ; , ~ , ~ #2 @ {#2} +\cs_generate_variant:Nn \__fp_error:nnnn { nnf, nff } \__msg_kernel_new:nnnn { kernel } { unknown-fpu-exception } { The~FPU~exception~'#1'~is~not~known:~that~trap~will~never~be~triggered. } { @@ -687,7 +676,10 @@ \cs_new:Npn \__fp_round:Nww #1#2 ; #3 ; { \__fp_small_int:wTF #3; { \__fp_round:Nwn #1#2; } - { \__fp_array_invalid_operation_o:nw { round } #2; #3; @ } + { + \__fp_invalid_operation_tl_o:nf + { round } { \__fp_array_to_clist:n { #2; #3; } } + } } \cs_new:Npn \__fp_round:Nwn #1 \s__fp \__fp_chk:w #2#3#4; #5 { @@ -808,7 +800,7 @@ \cs_new:Npn \__fp_type_from_scan:N #1 { \exp_after:wN \__fp_type_from_scan:w - \token_to_str:N #1 \q_mark S--FP \q_mark \q_stop + \token_to_str:N #1 \q_mark S--FP-? \q_mark \q_stop } \cs_new:Npn \__fp_type_from_scan:w #1 S--FP #2 \q_mark #3 \q_stop {#2} } @@ -877,39 +869,26 @@ } \cs_new:Npn \__fp_parse_operand_relax:NN #1#2 { - \__fp_parse_operand_relax_aux:wwnw - #2 \s__fp_mark - { - \__fp_exp_after_o:nw - { - \tex_romannumeral:D -`0 - \exp_after:wN \__fp_parse_infix:NN - \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w - } - \s__fp - } - \s__fp #2 - { - \__msg_kernel_expandable_error:nn { kernel } { fp-early-end } - \exp_after:wN \c_nan_fp - \tex_romannumeral:D -`0 - \__fp_parse_infix:NN #1 - \s__fp_mark - } - \s__fp_mark - { - \__msg_kernel_expandable_error:nnn - { kernel } { bad-variable } {#2} - \exp_after:wN \c_nan_fp - \tex_romannumeral:D -`0 - \exp_after:wN \__fp_parse_infix:NN - \exp_after:wN #1 - \tex_romannumeral:D \__fp_parse_expand:w - } - \s__fp_mark \s__fp_stop + \cs:w __fp_exp_after \__fp_type_from_scan:N #2 _f:nw \cs_end: + { + \exp_after:wN \__fp_parse_infix:NN + \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w + } + #2 + } +\cs_new:Npn \__fp_exp_after_mark_f:nw #1 + { + \__msg_kernel_expandable_error:nn { kernel } { fp-early-end } + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 #1 + } +\cs_new:cpn { __fp_exp_after_?_f:nw } #1#2 + { + \__msg_kernel_expandable_error:nnn + { kernel } { bad-variable } {#2} + \exp_after:wN \c_nan_fp + \tex_romannumeral:D -`0 #1 } -\cs_new:Npn \__fp_parse_operand_relax_aux:wwnw - #1 \s__fp #2 \s__fp_mark #3 #4 \s__fp_mark \s__fp_stop { #3 } \cs_new:Npn \__fp_parse_operand_other:NN #1 #2 { \if_int_compare:w @@ -1447,8 +1426,9 @@ \cs:w __fp \__fp_type_from_scan:N #2 + _ #4 \__fp_type_from_scan:N #5 - _ #4 _o:ww + _o:ww \cs_end: #2#3 #5#6 \tex_romannumeral:D -`0 #7 #1 @@ -1504,7 +1484,8 @@ \tex_romannumeral:D -`0 \__fp_parse_infix:NN } } -\tl_map_inline:nn { {abs} {cos} {cot} {exp} {ln} {sin} {tan} } +\tl_map_inline:nn + { {abs} {cos} {cot} {csc} {exp} {ln} {sec} {sin} {tan} } { \cs_new:cpn { __fp_parse_word_#1:N } ##1 { @@ -1600,7 +1581,7 @@ { \token_if_eq_meaning:NNTF #3 \__fp_parse_infix_):N { - \__fp_parse_exp_after_array:wf #2 \s__fp_stop + \__fp_exp_after_array_f:w #2 \s__fp_stop \exp_after:wN \__fp_parse_infix:NN \exp_after:wN #1 \tex_romannumeral:D \__fp_parse_expand:w @@ -1611,13 +1592,13 @@ } } \group_end: -\cs_new:Npn \__fp_parse_exp_after_array:wf #1 +\cs_new:Npn \__fp_exp_after_array_f:w #1 { - \cs:w __fp \__fp_type_from_scan:N #1 _exp_after_f:nw \cs_end: - { \__fp_parse_exp_after_array:wf } + \cs:w __fp_exp_after \__fp_type_from_scan:N #1 _f:nw \cs_end: + { \__fp_exp_after_array_f:w } #1 } -\cs_new:Npn \__fp_stop_exp_after_f:nw #1#2 { } +\cs_new:Npn \__fp_exp_after_stop_f:nw #1#2 { } \cs_new:cpn {__fp_parse_prefix_.:Nw} #1 { \exp_after:wN \__fp_parse_infix_after_operand:NwN @@ -1990,12 +1971,12 @@ \cs_new:Npn \__fp_compare_npos:nwnw #1#2; #3#4; { \if_int_compare:w #1 = #3 \exp_stop_f: - \__fp_compare_mantissa:nnnnnnnn #2 #4 + \__fp_compare_significand:nnnnnnnn #2 #4 \else: \if_int_compare:w #1 < #3 - \fi: 1 \fi: } -\cs_new:Npn \__fp_compare_mantissa:nnnnnnnn #1#2#3#4#5#6#7#8 +\cs_new:Npn \__fp_compare_significand:nnnnnnnn #1#2#3#4#5#6#7#8 { \if_int_compare:w #1#2 = #5#6 \exp_stop_f: \if_int_compare:w #3#4 = #7#8 \exp_stop_f: @@ -2007,6 +1988,62 @@ \if_int_compare:w #1#2 < #5#6 - \fi: 1 \fi: } +\cs_new:Npn \fp_do_until:nn #1#2 + { + #2 + \fp_compare:nF {#1} + { \fp_do_until:nn {#1} {#2} } + } +\cs_new:Npn \fp_do_while:nn #1#2 + { + #2 + \fp_compare:nT {#1} + { \fp_do_while:nn {#1} {#2} } + } +\cs_new:Npn \fp_until_do:nn #1#2 + { + \fp_compare:nF {#1} + { + #2 + \fp_until_do:nn {#1} {#2} + } + } +\cs_new:Npn \fp_while_do:nn #1#2 + { + \fp_compare:nT {#1} + { + #2 + \fp_while_do:nn {#1} {#2} + } + } +\cs_new:Npn \fp_do_until:nNnn #1#2#3#4 + { + #4 + \fp_compare:nNnF {#1} #2 {#3} + { \fp_do_until:nNnn {#1} #2 {#3} {#4} } + } +\cs_new:Npn \fp_do_while:nNnn #1#2#3#4 + { + #4 + \fp_compare:nNnT {#1} #2 {#3} + { \fp_do_while:nNnn {#1} #2 {#3} {#4} } + } +\cs_new:Npn \fp_until_do:nNnn #1#2#3#4 + { + \fp_compare:nNnF {#1} #2 {#3} + { + #4 + \fp_until_do:nNnn {#1} #2 {#3} {#4} + } + } +\cs_new:Npn \fp_while_do:nNnn #1#2#3#4 + { + \fp_compare:nNnT {#1} #2 {#3} + { + #4 + \fp_while_do:nNnn {#1} #2 {#3} {#4} + } + } \cs_new:Npn \__fp_max_o:w #1 @ { \exp_after:wN \__fp_minmax_loop:Nww @@ -2083,7 +2120,7 @@ \__fp_ternary_break_point:n { \exp_after:wN \__fp_ternary_i:NwwN } \exp_after:wN #1 \tex_romannumeral:D -`0 - \__fp_parse_exp_after_array:wf #3 \s__fp_stop + \__fp_exp_after_array_f:w #3 \s__fp_stop \exp_after:wN @ \tex_romannumeral:D \__fp_parse_until:Nw \c_two @@ -2094,7 +2131,7 @@ \exp_after:wN \__fp_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \__fp_parse_exp_after_array:wf #3 \s__fp_stop + \__fp_exp_after_array_f:w #3 \s__fp_stop \exp_after:wN #4 \exp_after:wN #1 \fi: @@ -2117,7 +2154,7 @@ \exp_after:wN \__fp_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \__fp_parse_exp_after_array:wf #2 \s__fp_stop + \__fp_exp_after_array_f:w #2 \s__fp_stop #4 #1 } \cs_new:Npn \__fp_ternary_ii:NwwN #1#2@#3@#4 @@ -2125,7 +2162,7 @@ \exp_after:wN \__fp_parse_until_test:NwN \exp_after:wN #1 \tex_romannumeral:D -`0 - \__fp_parse_exp_after_array:wf #3 \s__fp_stop + \__fp_exp_after_array_f:w #3 \s__fp_stop #4 #1 } %% File: l3fp-basics.dtx Copyright (C) 2011-2012 The LaTeX3 Project @@ -2273,7 +2310,7 @@ \cs_new:Npn \__fp_add_big_i_o:wNww #1; #2 #3; #4; { \__fp_decimate:nNnnnn {#1} - \__fp_add_mantissa_o:NnnwnnnnN + \__fp_add_significand_o:NnnwnnnnN #4 #3 #2 @@ -2281,34 +2318,34 @@ \cs_new:Npn \__fp_add_big_ii_o:wNww #1; #2 #3; #4; { \__fp_decimate:nNnnnn {#1} - \__fp_add_mantissa_o:NnnwnnnnN + \__fp_add_significand_o:NnnwnnnnN #3 #4 #2 } -\cs_new:Npn \__fp_add_mantissa_o:NnnwnnnnN #1 #2#3 #4; #5#6#7#8 +\cs_new:Npn \__fp_add_significand_o:NnnwnnnnN #1 #2#3 #4; #5#6#7#8 { - \exp_after:wN \__fp_add_mantissa_test_o:N + \exp_after:wN \__fp_add_significand_test_o:N \int_use:N \__int_eval:w 1#5#6 + #2 - \exp_after:wN \__fp_add_mantissa_pack:NNNNNNN + \exp_after:wN \__fp_add_significand_pack:NNNNNNN \int_use:N \__int_eval:w 1#7#8 + #3 ; #1 } -\cs_new:Npn \__fp_add_mantissa_pack:NNNNNNN #1 #2#3#4#5#6#7 +\cs_new:Npn \__fp_add_significand_pack:NNNNNNN #1 #2#3#4#5#6#7 { \if_meaning:w 2 #1 + \c_one \fi: ; #2 #3 #4 #5 #6 #7 ; } -\cs_new:Npn \__fp_add_mantissa_test_o:N #1 +\cs_new:Npn \__fp_add_significand_test_o:N #1 { \if_meaning:w 2 #1 - \exp_after:wN \__fp_add_mantissa_carry_o:wwwNN + \exp_after:wN \__fp_add_significand_carry_o:wwwNN \else: - \exp_after:wN \__fp_add_mantissa_no_carry_o:wwwNN + \exp_after:wN \__fp_add_significand_no_carry_o:wwwNN \fi: } -\cs_new:Npn \__fp_add_mantissa_no_carry_o:wwwNN +\cs_new:Npn \__fp_add_significand_no_carry_o:wwwNN #1; #2; #3#4 ; #5#6 { \exp_after:wN \__fp_basics_pack_high:NNNNNw @@ -2318,7 +2355,7 @@ + \__fp_round:NNN #6 #4 #5 \exp_after:wN ; } -\cs_new:Npn \__fp_add_mantissa_carry_o:wwwNN +\cs_new:Npn \__fp_add_significand_carry_o:wwwNN #1; #2; #3#4; #5#6 { + \c_one @@ -2527,41 +2564,41 @@ \exp_after:wN #1 \int_use:N \__int_eval:w #4 + #8 - \__fp_mul_mantissa_o:nnnnNnnnn #5 #1 #9 + \__fp_mul_significand_o:nnnnNnnnn #5 #1 #9 } -\cs_new:Npn \__fp_mul_mantissa_o:nnnnNnnnn #1#2#3#4 #5 #6#7#8#9 +\cs_new:Npn \__fp_mul_significand_o:nnnnNnnnn #1#2#3#4 #5 #6#7#8#9 { - \exp_after:wN \__fp_mul_mantissa_test_f:NNN + \exp_after:wN \__fp_mul_significand_test_f:NNN \exp_after:wN #5 \int_use:N \__int_eval:w 99990000 + #1*#6 + - \exp_after:wN \__fp_mul_mantissa_keep:NNNNNw + \exp_after:wN \__fp_mul_significand_keep:NNNNNw \int_use:N \__int_eval:w 99990000 + #1*#7 + #2*#6 + - \exp_after:wN \__fp_mul_mantissa_keep:NNNNNw + \exp_after:wN \__fp_mul_significand_keep:NNNNNw \int_use:N \__int_eval:w 99990000 + #1*#8 + #2*#7 + #3*#6 + - \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \exp_after:wN \__fp_mul_significand_drop:NNNNNw \int_use:N \__int_eval:w 99990000 + #1*#9 + #2*#8 + #3*#7 + #4*#6 + - \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \exp_after:wN \__fp_mul_significand_drop:NNNNNw \int_use:N \__int_eval:w 99990000 + #2*#9 + #3*#8 + #4*#7 + - \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \exp_after:wN \__fp_mul_significand_drop:NNNNNw \int_use:N \__int_eval:w 99990000 + #3*#9 + #4*#8 + - \exp_after:wN \__fp_mul_mantissa_drop:NNNNNw + \exp_after:wN \__fp_mul_significand_drop:NNNNNw \int_use:N \__int_eval:w 100000000 + #4*#9 ; ; \exp_after:wN ; } -\cs_new:Npn \__fp_mul_mantissa_drop:NNNNNw #1#2#3#4#5 #6; +\cs_new:Npn \__fp_mul_significand_drop:NNNNNw #1#2#3#4#5 #6; { #1#2#3#4#5 ; + #6 } -\cs_new:Npn \__fp_mul_mantissa_keep:NNNNNw #1#2#3#4#5 #6; +\cs_new:Npn \__fp_mul_significand_keep:NNNNNw #1#2#3#4#5 #6; { #1#2#3#4#5 ; #6 ; } -\cs_new:Npn \__fp_mul_mantissa_test_f:NNN #1 #2 #3 +\cs_new:Npn \__fp_mul_significand_test_f:NNN #1 #2 #3 { \if_meaning:w 0 #3 - \exp_after:wN \__fp_mul_mantissa_small_f:NNwwwN + \exp_after:wN \__fp_mul_significand_small_f:NNwwwN \else: - \exp_after:wN \__fp_mul_mantissa_large_f:NwwNNNN + \exp_after:wN \__fp_mul_significand_large_f:NwwNNNN \fi: #1 #3 } -\cs_new:Npn \__fp_mul_mantissa_large_f:NwwNNNN #1 #2; #3; #4#5#6#7; + +\cs_new:Npn \__fp_mul_significand_large_f:NwwNNNN #1 #2; #3; #4#5#6#7; + { \exp_after:wN \__fp_basics_pack_high:NNNNNw \int_use:N \__int_eval:w 1#2 @@ -2572,7 +2609,7 @@ \exp_after:wN #7 \__int_value:w \__fp_round_digit:Nw } -\cs_new:Npn \__fp_mul_mantissa_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7 +\cs_new:Npn \__fp_mul_significand_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7 { - \c_one \exp_after:wN \__fp_basics_pack_high:NNNNNw @@ -2606,34 +2643,34 @@ \exp_after:wN #1 \int_use:N \__int_eval:w #3 - #6 - \exp_after:wN \__fp_div_mantissa_i_o:wnnw + \exp_after:wN \__fp_div_significand_i_o:wnnw \int_use:N \__int_eval:w #7 \use_i:nnnn #8 + \c_one ; #4 {#7}{#8}#9 ; #1 } -\cs_new:Npn \__fp_div_mantissa_i_o:wnnw #1 ; #2#3 #4 ; +\cs_new:Npn \__fp_div_significand_i_o:wnnw #1 ; #2#3 #4 ; { - \exp_after:wN \__fp_div_mantissa_test_o:w + \exp_after:wN \__fp_div_significand_test_o:w \int_use:N \__int_eval:w - \exp_after:wN \__fp_div_mantissa_calc:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn \int_use:N \__int_eval:w 999999 + #2 #3 0 / #1 ; #2 #3 ; #4 - { \exp_after:wN \__fp_div_mantissa_ii:wwn \__int_value:w #1 } - { \exp_after:wN \__fp_div_mantissa_ii:wwn \__int_value:w #1 } - { \exp_after:wN \__fp_div_mantissa_ii:wwn \__int_value:w #1 } - { \exp_after:wN \__fp_div_mantissa_iii:wwnnnnn \__int_value:w #1 } + { \exp_after:wN \__fp_div_significand_ii:wwn \__int_value:w #1 } + { \exp_after:wN \__fp_div_significand_ii:wwn \__int_value:w #1 } + { \exp_after:wN \__fp_div_significand_ii:wwn \__int_value:w #1 } + { \exp_after:wN \__fp_div_significand_iii:wwnnnnn \__int_value:w #1 } } -\cs_new:Npn \__fp_div_mantissa_calc:wwnnnnnnn 1#1 +\cs_new:Npn \__fp_div_significand_calc:wwnnnnnnn 1#1 { \if_meaning:w 1 #1 - \exp_after:wN \__fp_div_mantissa_calc_i:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc_i:wwnnnnnnn \else: - \exp_after:wN \__fp_div_mantissa_calc_ii:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc_ii:wwnnnnnnn \fi: } -\cs_new:Npn \__fp_div_mantissa_calc_i:wwnnnnnnn #1; #2;#3#4 #5#6#7#8 #9 +\cs_new:Npn \__fp_div_significand_calc_i:wwnnnnnnn #1; #2;#3#4 #5#6#7#8 #9 { 1 1 #1 #9 \exp_after:wN ; @@ -2650,7 +2687,7 @@ - #1 * #8 ; {#5}{#6}{#7}{#8} } -\cs_new:Npn \__fp_div_mantissa_calc_ii:wwnnnnnnn #1; #2;#3#4 #5#6#7#8 #9 +\cs_new:Npn \__fp_div_significand_calc_ii:wwnnnnnnn #1; #2;#3#4 #5#6#7#8 #9 { 1 0 #1 #9 \exp_after:wN ; @@ -2667,33 +2704,33 @@ - #1 * #8 ; {#5}{#6}{#7}{#8} } -\cs_new:Npn \__fp_div_mantissa_ii:wwn #1; #2;#3 +\cs_new:Npn \__fp_div_significand_ii:wwn #1; #2;#3 { - \exp_after:wN \__fp_div_mantissa_pack:NNN + \exp_after:wN \__fp_div_significand_pack:NNN \int_use:N \__int_eval:w - \exp_after:wN \__fp_div_mantissa_calc:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn \int_use:N \__int_eval:w 999999 + #2 #3 0 / #1 ; #2 #3 ; } -\cs_new:Npn \__fp_div_mantissa_iii:wwnnnnn #1; #2;#3#4#5 #6#7 +\cs_new:Npn \__fp_div_significand_iii:wwnnnnn #1; #2;#3#4#5 #6#7 { 0 - \exp_after:wN \__fp_div_mantissa_iv:wwnnnnnnn + \exp_after:wN \__fp_div_significand_iv:wwnnnnnnn \int_use:N \__int_eval:w (\c_two * #2 #3) / #6 #7 ; % <- P #2 ; {#3} {#4} {#5} {#6} {#7} } -\cs_new:Npn \__fp_div_mantissa_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9 +\cs_new:Npn \__fp_div_significand_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9 { + \c_five * #1 - \exp_after:wN \__fp_div_mantissa_vi:Nw + \exp_after:wN \__fp_div_significand_vi:Nw \int_use:N \__int_eval:w -20 + 2*#2#3 - #1*#6#7 + - \exp_after:wN \__fp_div_mantissa_v:NN + \exp_after:wN \__fp_div_significand_v:NN \int_use:N \__int_eval:w 199980 + 2*#4 - #1*#8 + - \exp_after:wN \__fp_div_mantissa_v:NN + \exp_after:wN \__fp_div_significand_v:NN \int_use:N \__int_eval:w 200000 + 2*#5 - #1*#9 ; } -\cs_new:Npn \__fp_div_mantissa_v:NN #1#2 { #1#2 \__int_eval_end: + } -\cs_new:Npn \__fp_div_mantissa_vi:Nw #1#2; +\cs_new:Npn \__fp_div_significand_v:NN #1#2 { #1#2 \__int_eval_end: + } +\cs_new:Npn \__fp_div_significand_vi:Nw #1#2; { \if_meaning:w 0 #1 \if_int_compare:w \__int_eval:w #2 > \c_zero + \c_one \fi: @@ -2702,17 +2739,17 @@ \fi: ; } -\cs_new:Npn \__fp_div_mantissa_pack:NNN 1 #1 #2 { + #1 #2 ; } -\cs_new:Npn \__fp_div_mantissa_test_o:w 10 #1 +\cs_new:Npn \__fp_div_significand_pack:NNN 1 #1 #2 { + #1 #2 ; } +\cs_new:Npn \__fp_div_significand_test_o:w 10 #1 { \if_meaning:w 0 #1 - \exp_after:wN \__fp_div_mantissa_small_o:wwwNNNNwN + \exp_after:wN \__fp_div_significand_small_o:wwwNNNNwN \else: - \exp_after:wN \__fp_div_mantissa_large_o:wwwNNNNwN + \exp_after:wN \__fp_div_significand_large_o:wwwNNNNwN \fi: #1 } -\cs_new:Npn \__fp_div_mantissa_small_o:wwwNNNNwN +\cs_new:Npn \__fp_div_significand_small_o:wwwNNNNwN 0 #1; #2; #3; #4#5#6#7#8; #9 { \exp_after:wN \__fp_basics_pack_high:NNNNNw @@ -2722,7 +2759,7 @@ + \__fp_round:NNN #9 #7 #8 \exp_after:wN ; } -\cs_new:Npn \__fp_div_mantissa_large_o:wwwNNNNwN +\cs_new:Npn \__fp_div_significand_large_o:wwwNNNNwN #1; #2; #3; #4#5#6#7#8; #9 { + \c_one @@ -2736,13 +2773,13 @@ \__int_value:w \__fp_round_digit:Nw #7 #8 ; \exp_after:wN ; } -\cs_new:Npn \__fp_neg_o:w \s__fp \__fp_chk:w #1 #2 +\cs_new:Npn \__fp_neg_o:w #1 \s__fp \__fp_chk:w #2 #3 { \exp_after:wN \__fp_exp_after_o:w \exp_after:wN \s__fp \exp_after:wN \__fp_chk:w - \exp_after:wN #1 - \int_use:N \__int_eval:w \c_two - #2 \__int_eval_end: + \exp_after:wN #2 + \int_use:N \__int_eval:w \c_two - #3 \__int_eval_end: } \cs_new:Npn \__fp_abs_o:w \s__fp \__fp_chk:w #1 #2 { @@ -2788,6 +2825,12 @@ \tl_const:Nn \c__fp_one_fixed_tl { {10000} {0000} {0000} {0000} {0000} {0000} } \cs_new:Npn \__fp_fixed_continue:wn #1; #2 { #2 #1; } +\cs_new:Npn \__fp_fixed_add_one:wN #1#2; #3 + { + \exp_after:wN #3 \exp_after:wN + { \int_use:N \__int_eval:w \c_ten_thousand + #1 } #2 ; + } +\cs_new:Npn \__fp_fixed_mul_after:wn #1; #2 { #2 {#1} } \cs_new:Npn \__fp_fixed_div_int:wwN #1#2#3#4#5#6 ; #7 ; #8 { \exp_after:wN \__fp_fixed_div_int_after:Nw @@ -2799,7 +2842,7 @@ #3; {#7} \__fp_fixed_div_int_ii:wnn #4; {#7} \__fp_fixed_div_int_ii:wnn #5; {#7} \__fp_fixed_div_int_ii:wnn - #6; {#7} \__fp_fixed_div_int_end:wnn ; + #6; {#7} \__fp_fixed_div_int_iii:wnn ; } \cs_new:Npn \__fp_fixed_div_int_i:wnN #1; #2 #3 { @@ -2816,110 +2859,104 @@ \exp_after:wN \__fp_fixed_div_int_i:wnN \int_use:N \__int_eval:w #3 - #1*#2 \__int_eval_end: } -\cs_new:Npn \__fp_fixed_div_int_end:wnn #1; #2 #3 { + #1 + \c_two ; } +\cs_new:Npn \__fp_fixed_div_int_iii:wnn #1; #2 #3 { + #1 + \c_two ; } \cs_new:Npn \__fp_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} } \cs_new:Npn \__fp_fixed_div_int_after:Nw #1 #2; { #1 {#2} } -\cs_new:Npn \__fp_fixed_add_one:wN #1#2; #3 - { - \exp_after:wN #3 \exp_after:wN - { \int_use:N \__int_eval:w 10000 + #1 } #2 ; - } -\cs_new_nopar:Npn \__fp_fixed_add:wwN { \__fp_fixed_add_i:NNnnnnwnn + + } -\cs_new_nopar:Npn \__fp_fixed_sub:wwN { \__fp_fixed_add_i:NNnnnnwnn + - } -\cs_new_nopar:Npn \__fp_fixed_sub_back:wwN { \__fp_fixed_add_i:NNnnnnwnn - + } -\cs_new:Npn \__fp_fixed_add_i:NNnnnnwnn #1#2 #3#4#5#6 #7; #8#9 - { - \exp_after:wN \__fp_fixed_add_after:NNNNNwN - \int_use:N \__int_eval:w 1 9999 9998 #1 #3#4 #2 #8#9 - \exp_after:wN \__fp_fixed_add_pack:NNNNNwN - \int_use:N \__int_eval:w 1 9999 9998 #1 #5#6 - \__fp_fixed_add_ii:NnnNnnnnw #1 #7 #2 - } -\cs_new:Npn \__fp_fixed_add_ii:NnnNnnnnw #1 #2#3 #4 #5#6 #7#8 ; #9 - { - #4 #5#6 - \exp_after:wN \__fp_fixed_add_pack:NNNNNwN - \int_use:N \__int_eval:w 2 0000 0000 #4 #7#8 #1 #2#3 ; #9 ; - } -\cs_new:Npn \__fp_fixed_add_pack:NNNNNwN #1 #2#3#4#5 #6; #7 - { + #1 ; #7 {#2#3#4#5} {#6} } -\cs_new:Npn \__fp_fixed_add_after:NNNNNwN #1 #2#3#4#5 #6; #7 - { - \exp_after:wN #7 - \exp_after:wN { \int_use:N \__int_eval:w - 2 0000 + #1#2#3#4#5 } - {#6} - } +\cs_new_nopar:Npn \__fp_fixed_add:wwn { \__fp_fixed_add_i:Nnnnnwnn + } +\cs_new_nopar:Npn \__fp_fixed_sub:wwn { \__fp_fixed_add_i:Nnnnnwnn - } +\cs_new:Npn \__fp_fixed_add_i:Nnnnnwnn #1 #2#3#4#5 #6; #7#8 + { + \exp_after:wN \__fp_fixed_add_after:NNNNNwn + \int_use:N \__int_eval:w 9 9999 9998 + #2#3 #1 #7#8 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwn + \int_use:N \__int_eval:w 1 9999 9998 + #4#5 + \__fp_fixed_add_ii:nnNnnnwn #6 #1 + } +\cs_new:Npn \__fp_fixed_add_ii:nnNnnnwn #1#2 #3 #4#5 #6#7 ; #8 + { + #3 #4#5 + \exp_after:wN \__fp_fixed_add_pack:NNNNNwn + \int_use:N \__int_eval:w 2 0000 0000 #3 #6#7 + #1#2 ; {#8} ; + } +\cs_new:Npn \__fp_fixed_add_pack:NNNNNwn #1 #2#3#4#5 #6; #7 + { + #1 ; {#7} {#2#3#4#5} {#6} } +\cs_new:Npn \__fp_fixed_add_after:NNNNNwn 1 #1 #2#3#4#5 #6; #7 + { #7 {#1#2#3#4#5} {#6} } \cs_new:Npn \__fp_fixed_mul:wwn #1#2#3#4 #5; #6#7#8#9 { - \exp_after:wN \__fp_fixed_mul_after:wwn + \exp_after:wN \__fp_fixed_mul_after:wn \int_use:N \__int_eval:w \c__fp_leading_shift_int - \exp_after:wN \__fp_pack:NNNNNw + \exp_after:wN \__fp_pack:NNNNNwn \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1*#6 - \exp_after:wN \__fp_pack:NNNNNw + \exp_after:wN \__fp_pack:NNNNNwn \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1*#7 + #2*#6 - \exp_after:wN \__fp_pack:NNNNNw + \exp_after:wN \__fp_pack:NNNNNwn \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1*#8 + #2*#7 + #3*#6 - \exp_after:wN \__fp_pack:NNNNNw + \exp_after:wN \__fp_pack:NNNNNwn \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1*#9 + #2*#8 + #3*#7 + #4*#6 - \exp_after:wN \__fp_pack:NNNNNw + \exp_after:wN \__fp_pack:NNNNNwn \int_use:N \__int_eval:w \c__fp_trailing_shift_int + #2*#9 + #3*#8 + #4*#7 + ( #3*#9 + #4*#8 - + \__fp_fixed_mul_i:nnnnnnnn #5 {#6}{#7} {#1}{#2} - } -\cs_new:Npn \__fp_fixed_mul_i:nnnnnnnn #1#2 #3#4 #5#6 #7#8 - { #1*#4 + #2*#3 + #5*#8 + #6*#7 )/10000 + #1*#3 + #5*#7 ; } -\cs_new:Npn \__fp_fixed_mul_pack:NNNNNw - #1 #2#3#4#5 #6; { + #1#2#3#4#5 ; {#6} } -\cs_new:Npn \__fp_fixed_mul_after:wwn #1; #2; #3 { #3 {#1} #2 ; } -\cs_new:Npn \__fp_fixed_one_minus_mul:wwn #1; #2#3#4#5; - { - \exp_after:wN \__fp_fixed_mul_after:wwn - \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + \c_ten_thousand - \exp_after:wN \__fp_pack_big:NNNNNNw + + \__fp_fixed_mul_i:nnnnnnnwn #5 {#6}{#7} {#1}{#2} + } +\cs_new:Npn \__fp_fixed_mul_i:nnnnnnnwn #1#2 #3#4 #5#6 #7#8 ; #9 + { + #1*#4 + #2*#3 + #5*#8 + #6*#7 ) / \c_ten_thousand + + #1*#3 + #5*#7 ; + {#9} ; + } +\cs_new:Npn \__fp_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; #9 + { + \exp_after:wN \__fp_fixed_mul_after:wn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + \exp_after:wN \__fp_pack_big:NNNNNNwn + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #3 #4 + \__fp_fixed_mul_add_i:Nwnnnwnnn + + + #5 #6 ; #2 ; #1 ; #2 ; + + + #7 #8 ; {#9} ; + } +\cs_new:Npn \__fp_fixed_mul_sub_back:wwwn #1; #2; #3#4#5#6#7#8; #9 + { + \exp_after:wN \__fp_fixed_mul_after:wn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + \exp_after:wN \__fp_pack_big:NNNNNNwn + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #3 #4 + \__fp_fixed_mul_add_i:Nwnnnwnnn - + + #5 #6 ; #2 ; #1 ; #2 ; - + + #7 #8 ; {#9} ; + } +\cs_new:Npn \__fp_fixed_one_minus_mul:wwn #1; #2; #3 + { + \exp_after:wN \__fp_fixed_mul_after:wn + \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + \exp_after:wN \__fp_pack_big:NNNNNNwn + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + 1 0000 0000 + \__fp_fixed_mul_add_i:Nwnnnwnnn - + ; #2 ; #1 ; #2 ; - + ; {#3} ; + } +\cs_new:Npn \__fp_fixed_mul_add_i:Nwnnnwnnn #1 #2; #3#4#5#6; #7#8#9 + { + #1 #7*#3 + \exp_after:wN \__fp_pack_big:NNNNNNwn + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #1 #7*#4 #1 #8*#3 + \exp_after:wN \__fp_pack_big:NNNNNNwn \int_use:N \__int_eval:w \c__fp_big_middle_shift_int - \__fp_fixed_mul_add_i:Nnwnnwnnn - - 00; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; - 00 ; - } -\cs_new:Npn \__fp_fixed_mul_add:wwwn #1; #2#3#4#5; #6#7#8#9 - { - \exp_after:wN \__fp_fixed_mul_after:wwn - \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + #6 - \exp_after:wN \__fp_pack_big:NNNNNNw - \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #7 - \__fp_fixed_mul_add_i:Nnwnnwnnn - + {#8}{#9}; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; + - } -\cs_new:Npn \__fp_fixed_mul_sub_back:wwwn #1; #2#3#4#5; #6#7#8#9 - { - \exp_after:wN \__fp_fixed_mul_after:wwn - \int_use:N \__int_eval:w \c__fp_big_leading_shift_int + #6 - \exp_after:wN \__fp_pack_big:NNNNNNw - \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #7 - \__fp_fixed_mul_add_i:Nnwnnwnnn - - {#8}{#9}; {#2}{#3}{#4}; #1; {#2}{#3}{#4}#5; - - } -\cs_new:Npn \__fp_fixed_mul_add_i:Nnwnnwnnn #1 #2#3; #4#5#6; #7#8#9 - { % sg z3z4; y1y2y3; x1x2x3 x4x5x6; y1y2y3y4y5y6; sg z5z6; - #1 #7*#4 - \exp_after:wN \__fp_pack_big:NNNNNNw - \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #2 - #1 #7*#5 #1 #8*#4 - \exp_after:wN \__fp_pack_big:NNNNNNw - \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #3 - #1 #7*#6 #1 #8*#5 #1 #9*#4 - \exp_after:wN \__fp_pack_big:NNNNNNw - \int_use:N \__int_eval:w \c__fp_big_middle_shift_int - #1 \__fp_fixed_mul_add_ii:nnnnwnnnn {#7}{#8}{#9} + #1 #7*#5 #1 #8*#4 #1 #9*#3 #2 + \exp_after:wN \__fp_pack_big:NNNNNNwn + \int_use:N \__int_eval:w \c__fp_big_middle_shift_int + #1 \__fp_fixed_mul_add_ii:nnnnwnnnn {#7}{#8}{#9} } \cs_new:Npn \__fp_fixed_mul_add_ii:nnnnwnnnn #1#2#3#4#5; #6#7#8#9 - { % x1x2x3x4 x5x6; y1y2y3y4 y5y6; sg z5z6; + { ( #1*#9 + #2*#8 + #3*#7 + #4*#6 ) - \exp_after:wN \__fp_pack_big:NNNNNNw + \exp_after:wN \__fp_pack_big:NNNNNNwn \int_use:N \__int_eval:w \c__fp_big_trailing_shift_int \__fp_fixed_mul_add_iii:nnnnwnnwN { #6 + #4*#7 + #3*#8 + #2*#9 + #1 } @@ -2928,15 +2965,9 @@ {#6} } \cs_new:Npn \__fp_fixed_mul_add_iii:nnnnwnnwN #1#2 #3#4#5; #6#7#8; #9 - { % {y1+x4*y2+x3*y3+x2*y4+x1} {y2+x4*y3+x3*y4+x2} - % x1x5x6; y1y5y6; sg z5z6; - % => - % sg (x5*y1+x4*y2+x3*y3+x2*y4+x1*y5) - % sg (x6*y1+x5*y2+x4*y3+x3*y4+x2*y5+x1*y6)/10000 - % + z5z6; + { #9 (#4* #1 *#7) #9 (#5*#6+#4* #2 *#7+#3*#8) / \c_ten_thousand - + \__fp_use_s:nn } \cs_new:Npn \__fp_fixed_to_float:Nw #1#2; { \__fp_fixed_to_float:wN #2; #1 } \cs_new:Npn \__fp_fixed_to_float:wN #1#2#3#4#5#6; #7 @@ -2996,7 +3027,7 @@ } \cs_new:Npn \__fp_fixed_inv_to_float:wN #1#2; #3 { - - \__int_eval:w + + \__int_eval:w % ^^A todo: remove the +? \if_int_compare:w #1 < \c_one_thousand \__fp_fixed_dtf_zeros:wNnnnnnn \fi: @@ -3092,7 +3123,7 @@ { #1 ; {#2#3#4#5} {#6} } \cs_new:Npn \__fp_fixed_dtf_epsilon_ii:NNNNNww #1#2#3#4#5#6; #7; { - \__fp_fixed_mul:wwn %^^A todo: optimize to use \__fp_mul_mantissa. + \__fp_fixed_mul:wwn %^^A todo: optimize to use \__fp_mul_significand. {0000} {#2#3#4#5} {#6} #7 ; {0000} {#2#3#4#5} {#6} #7 ; \__fp_fixed_add_one:wN @@ -3209,7 +3240,7 @@ } \cs_new:Npn \__fp_ln_x_iv:wnnnnnnnn #1; #2#3#4#5 #6#7#8#9 { - \exp_after:wN \__fp_div_mantissa_pack:NNN + \exp_after:wN \__fp_div_significand_pack:NNN \int_use:N \__int_eval:w \__fp_ln_div_i:w #1 ; #6 #7 ; {#8} {#9} @@ -3222,20 +3253,20 @@ } \cs_new:Npn \__fp_ln_div_i:w #1; { - \exp_after:wN \__fp_div_mantissa_calc:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn \int_use:N \__int_eval:w 999999 + 2 0000 0000 / #1 ; % Q1 } \cs_new:Npn \__fp_ln_div_ii:wwn #1; #2;#3 % y; B1;B2 <- for k=1 { - \exp_after:wN \__fp_div_mantissa_pack:NNN + \exp_after:wN \__fp_div_significand_pack:NNN \int_use:N \__int_eval:w - \exp_after:wN \__fp_div_mantissa_calc:wwnnnnnnn + \exp_after:wN \__fp_div_significand_calc:wwnnnnnnn \int_use:N \__int_eval:w 999999 + #2 #3 / #1 ; % Q2 #2 #3 ; } \cs_new:Npn \__fp_ln_div_vi:wwn #1; #2;#3#4#5 #6#7#8#9 %y;F1;F2F3F4x1x2x3x4 { - \exp_after:wN \__fp_div_mantissa_pack:NNN + \exp_after:wN \__fp_div_significand_pack:NNN \int_use:N \__int_eval:w 1000000 + #2 #3 / #1 ; % Q6 } \cs_new:Npn \__fp_ln_div_after:Nw #1#2; @@ -3303,7 +3334,7 @@ \__fp_ln_Taylor_break:w \fi: \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl ; #1; - \__fp_fixed_add:wwN #2; + \__fp_fixed_add:wwn #2; \__fp_fixed_mul:wwn #3; { \exp_after:wN \__fp_ln_Taylor_loop:www @@ -3311,7 +3342,7 @@ } #3; } -\cs_new:Npn \__fp_ln_Taylor_break:w \fi: #1 \__fp_fixed_add:wwN #2#3; #4 ;; +\cs_new:Npn \__fp_ln_Taylor_break:w \fi: #1 \__fp_fixed_add:wwn #2#3; #4 ;; { \fi: \exp_after:wN \__fp_fixed_mul:wwn @@ -3320,9 +3351,9 @@ \cs_new:Npn \__fp_ln_c:NwNw #1 #2; #3 { \if_meaning:w + #1 - \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_sub:wwN + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_sub:wwn \else: - \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_add:wwN + \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_add:wwn \fi: #3 ; #2 ; } @@ -3336,11 +3367,11 @@ \if_int_compare:w #2 > \c_zero \exp_after:wN \__fp_ln_exponent_small:NNww \exp_after:wN 0 - \exp_after:wN \__fp_fixed_sub:wwN \__int_value:w + \exp_after:wN \__fp_fixed_sub:wwn \__int_value:w \else: \exp_after:wN \__fp_ln_exponent_small:NNww \exp_after:wN 2 - \exp_after:wN \__fp_fixed_add:wwN \__int_value:w - + \exp_after:wN \__fp_fixed_add:wwn \__int_value:w - \fi: \fi: #2; #1; @@ -3348,7 +3379,7 @@ \cs_new:Npn \__fp_ln_exponent_one:ww 1; #1; { \c_zero - \exp_after:wN \__fp_fixed_sub:wwN \c__fp_ln_x_fixed_tl ; #1; + \exp_after:wN \__fp_fixed_sub:wwn \c__fp_ln_x_fixed_tl ; #1; \__fp_fixed_to_float:wN 0 } \cs_new:Npn \__fp_ln_exponent_small:NNww #1#2#3; #4#5#6#7#8#9; @@ -3421,7 +3452,7 @@ } #5 {#4} - #2 0 + #1 #2 0 \tex_romannumeral:D \fi: \fi: @@ -3429,8 +3460,9 @@ } \cs_new:Npn \__fp_exp_overflow: { + \c_two * \c__fp_max_exponent_int ; {1000} {0000} {0000} {0000} ; } -\cs_new:Npn \__fp_exp_Taylor:Nnnwn #1#2#3 #4; #5 +\cs_new:Npn \__fp_exp_Taylor:Nnnwn #1#2#3 #4; #5 #6 { + #6 \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN \__fp_pack_twice_four:wNNNNNNNN @@ -3562,9 +3594,9 @@ #1; \__fp_exp_large_after:wwn } -\cs_new:Npn \__fp_exp_large_after:wwn #1; #2; +\cs_new:Npn \__fp_exp_large_after:wwn #1; #2; #3 { - \__fp_exp_Taylor:Nnnwn ? { } { } 0 #2; {} + \__fp_exp_Taylor:Nnnwn ? { } { } 0 #2; {} #3 \__fp_fixed_mul:wwn #1; } \cs_new:cpn { __fp_ \iow_char:N \^ _o:ww } @@ -3599,6 +3631,13 @@ \fi: \if_meaning:w #1 #4 \__fp_case_return_o:Nw \c_zero_fp + \fi: + \if_meaning:w 0 #1 + \__fp_case_use:nw + { + \__fp_division_by_zero_o:NNww \c_inf_fp ^ + \s__fp \__fp_chk:w #1 #2 ; + } \else: \__fp_case_return_o:Nw \c_inf_fp \fi: @@ -3613,7 +3652,7 @@ \fi: \__fp_case_return_o:Nww \c_one_fp \fi: - \if_case:w #4 ~ + \if_case:w #4 \exp_stop_f: \or: \exp_after:wN \__fp_pow_npos:Nww \exp_after:wN #5 @@ -3638,50 +3677,57 @@ \exp_after:wN 0 \__int_value:w \if:w #1 \if_int_compare:w #3 > \c_zero 0 \else: 2 \fi: - \exp_after:wN \__fp_pow_npos_aux:Nnww + \exp_after:wN \__fp_pow_npos_aux:NNnww + \exp_after:wN + \exp_after:wN \__fp_fixed_to_float:wN \else: - - - \exp_after:wN \__fp_pow_npos_aux:Nnww + \exp_after:wN \__fp_pow_npos_aux:NNnww + \exp_after:wN - \exp_after:wN \__fp_fixed_inv_to_float:wN \fi: {#3} } -\cs_new:Npn \__fp_pow_npos_aux:Nnww #1#2#3#4; \s__fp \__fp_chk:w 1#5#6#7; +\cs_new:Npn \__fp_pow_npos_aux:NNnww #1#2#3#4#5; \s__fp \__fp_chk:w 1#6#7#8; { + #1 \__int_eval:w - \__fp_ln_significand:NNNNnnnN #3#4 - \__fp_pow_exponent:wnN {#2} - \__fp_fixed_mul:wwn #7 {0000}{0000} ; - \__fp_pow_B:wwN #6; - #1 0 % fixed_to_float:wN + \__fp_ln_significand:NNNNnnnN #4#5 + \__fp_pow_exponent:wnN {#3} + \__fp_fixed_mul:wwn #8 {0000}{0000} ; + \__fp_pow_B:wwN #7; + #1 #2 0 % fixed_to_float:wN } \cs_new:Npn \__fp_pow_exponent:wnN #1; #2 { \if_int_compare:w #2 > \c_zero - \exp_after:wN \__fp_pow_exponent:Nwnnnnnn % n\ln(10) - (-\ln(x)) + \exp_after:wN \__fp_pow_exponent:Nwnnnnnwn % n\ln(10) - (-\ln(x)) \exp_after:wN + \else: - \exp_after:wN \__fp_pow_exponent:Nwnnnnnn % -( |n|\ln(10) + (-\ln(x)) ) + \exp_after:wN \__fp_pow_exponent:Nwnnnnnwn % -( |n|\ln(10) + (-\ln(x)) ) \exp_after:wN - \fi: #2; #1; } -\cs_new:Npn \__fp_pow_exponent:Nwnnnnnn #1#2; #3#4#5#6#7#8; - { %^^A todo: use that in ln. %^^A todo: log(1.00...) too inaccurate? - \exp_after:wN \__fp_fixed_mul_after:wwn - \int_use:N \__int_eval:w -5 0000 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 #1#2*23025 - #1 #3 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 #1 #2*8509 - #1 #4 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 #1 #2*2994 - #1 #5 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 #1 #2*0456 - #1 #6 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 5 0000 0000 #1 #2*8401 - #1 #7 - #1 ( #2*7991 - #8 ) / 1 0000 ; ; +\cs_new:Npn \__fp_pow_exponent:Nwnnnnnwn #1#2; #3#4#5#6#7#8; #9 + { %^^A todo: use that in ln. + \exp_after:wN \__fp_fixed_mul_after:wn + \int_use:N \__int_eval:w \c__fp_leading_shift_int + \exp_after:wN \__fp_pack:NNNNNwn + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1#2*23025 - #1 #3 + \exp_after:wN \__fp_pack:NNNNNwn + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1 #2*8509 - #1 #4 + \exp_after:wN \__fp_pack:NNNNNwn + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1 #2*2994 - #1 #5 + \exp_after:wN \__fp_pack:NNNNNwn + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #1 #2*0456 - #1 #6 + \exp_after:wN \__fp_pack:NNNNNwn + \int_use:N \__int_eval:w \c__fp_trailing_shift_int + #1 #2*8401 - #1 #7 + #1 ( #2*7991 - #8 ) / 1 0000 ; {#9} ; } \cs_new:Npn \__fp_pow_B:wwN #1#2#3#4#5#6; #7; { @@ -3698,7 +3744,7 @@ \int_use:N \__int_eval:w 10 0000 + #1 \__int_eval_end: #2#3#4#5#6 0000 0000 0000 0000 0000 0000 ; %^^A todo: how many 0? } -\cs_new:Npn \__fp_pow_C_overflow:w #1; #2; +\cs_new:Npn \__fp_pow_C_overflow:w #1; #2; #3 { + \c_two * \c__fp_max_exponent_int \exp_after:wN \__fp_fixed_continue:wn \c__fp_one_fixed_tl ; @@ -3729,7 +3775,7 @@ \cs_new:Npn \__fp_pow_neg:www \s__fp \__fp_chk:w #1#2; #3; #4; { \if_case:w \__fp_pow_neg_case:w #4 ; - \exp_after:wN \__fp_pow_neg_neg:w + \exp_after:wN \__fp_neg_o:w \or: \if_int_compare:w \__int_eval:w #1 / \c_two = \c_one \__fp_invalid_operation_o:Nww ^ #3; #4; @@ -3741,14 +3787,6 @@ \__fp_exp_after_o:w \s__fp \__fp_chk:w #1#2; } -\cs_new:Npn \__fp_pow_neg_neg:w \__fp_exp_after_o:w \s__fp \__fp_chk:w #1#2 - { - \exp_after:wN \__fp_exp_after_o:w - \exp_after:wN \s__fp - \exp_after:wN \__fp_chk:w - \exp_after:wN #1 - \int_use:N \__int_eval:w \c_two - #2 \__int_eval_end: - } \cs_new:Npn \__fp_pow_neg_case:w \s__fp \__fp_chk:w #1#2#3; { \if_case:w #1 \exp_stop_f: @@ -3826,24 +3864,17 @@ %% %% ----------------------------------------------------------------------- %% -\cs_new_nopar:Npx \__fp_one_over:w - { - \exp_not:N \exp_after:wN - \exp_not:c { __fp_/_o:ww } - \exp_not:N \c_one_fp - } \cs_new:Npn \__fp_sin_o:w \s__fp \__fp_chk:w #1#2 { \if_case:w #1 \exp_stop_f: \__fp_case_return_same_o:w \or: - \exp_after:wN \__fp_trig_exponent:NNNNwn - \exp_after:wN \__fp_sin_series:NNwww - \exp_after:wN ? - \exp_after:wN #2 - \exp_after:wN \c_zero - \or: - \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sin } } + \__fp_case_use:nw + { + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_o:w + \__fp_sin_series:NNwww \__fp_fixed_to_float:wN #2 \c_zero + } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sin } } \else: \__fp_case_return_same_o:w \fi: \s__fp \__fp_chk:w #1#2 @@ -3853,16 +3884,42 @@ \if_case:w #1 \exp_stop_f: \__fp_case_return_o:Nw \c_one_fp \or: - \__fp_case_use:nw %^^A todo: is that faster than the exp_after route? + \__fp_case_use:nw { - \__fp_trig_exponent:NNNNwn - \__fp_sin_series:NNwww - ? - 0 - \c_two + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_one_o:w + \__fp_sin_series:NNwww \__fp_fixed_to_float:wN 0 \c_two } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cos } } + \else: \__fp_case_return_same_o:w + \fi: + \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_csc_o:w \s__fp \__fp_chk:w #1#2 + { + \if_case:w #1 \exp_stop_f: + \__fp_cot_zero_o:Nnw #2 { csc } + \or: + \__fp_case_use:nw + { + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_inv_o:w + \__fp_sin_series:NNwww \__fp_fixed_inv_to_float:wN #2 \c_zero + } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { csc } } + \else: \__fp_case_return_same_o:w + \fi: + \s__fp \__fp_chk:w #1#2 + } +\cs_new:Npn \__fp_sec_o:w \s__fp \__fp_chk:w #1#2 + { + \if_case:w #1 \exp_stop_f: + \__fp_case_return_o:Nw \c_one_fp \or: - \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cos } } + \__fp_case_use:nw + { + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_one_o:w + \__fp_sin_series:NNwww \__fp_fixed_inv_to_float:wN 0 \c_two + } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { sec } } \else: \__fp_case_return_same_o:w \fi: \s__fp \__fp_chk:w #1#2 @@ -3872,13 +3929,12 @@ \if_case:w #1 \exp_stop_f: \__fp_case_return_same_o:w \or: - \exp_after:wN \__fp_trig_exponent:NNNNwn - \exp_after:wN \__fp_tan_series:NNwww - \exp_after:wN 0 - \exp_after:wN #2 - \exp_after:wN \c_one - \or: - \__fp_case_use:nw { \__fp_invalid_operation_o:nw { tan } } + \__fp_case_use:nw + { + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_o:w + \__fp_tan_series_o:NNwww 0 #2 \c_one + } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { tan } } \else: \__fp_case_return_same_o:w \fi: \s__fp \__fp_chk:w #1#2 @@ -3886,129 +3942,126 @@ \cs_new:Npn \__fp_cot_o:w \s__fp \__fp_chk:w #1#2 { \if_case:w #1 \exp_stop_f: - \exp_after:wN \__fp_one_over:w - \or: - \exp_after:wN \__fp_trig_exponent:NNNNwn - \exp_after:wN \__fp_tan_series:NNwww - \exp_after:wN 2 - \exp_after:wN #2 - \exp_after:wN \c_three + \__fp_cot_zero_o:Nnw #2 { cot } \or: - \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cot } } + \__fp_case_use:nw + { + \__fp_trig_exponent:NNNNNwn \__fp_trig_epsilon_inv_o:w + \__fp_tan_series_o:NNwww 2 #2 \c_three + } + \or: \__fp_case_use:nw { \__fp_invalid_operation_o:nw { cot } } \else: \__fp_case_return_same_o:w \fi: \s__fp \__fp_chk:w #1#2 } -\cs_new:Npn \__fp_trig_exponent:NNNNwn #1#2#3#4 \s__fp \__fp_chk:w 1#5#6 +\cs_new:Npn \__fp_cot_zero_o:Nnw #1 #2 #3 \fi: { - \if_int_compare:w #6 > - \c_eight - \exp_after:wN #1 + \fi: + \if_meaning:w 0 #1 + \exp_after:wN \__fp_division_by_zero_o:Nnw \exp_after:wN \c_inf_fp + \else: + \exp_after:wN \__fp_division_by_zero_o:Nnw \exp_after:wN \c_minus_inf_fp + \fi: + {#2} + } +\cs_new:Npn \__fp_trig_exponent:NNNNNwn #1#2#3#4#5 \s__fp \__fp_chk:w 1#6#7 + { + \if_int_compare:w #7 > - \c_eight \exp_after:wN #2 \exp_after:wN #3 - \int_use:N \__int_eval:w #4 - \if_int_compare:w #6 > \c_zero - \exp_after:wN \__fp_trig_large:w \__int_value:w + \exp_after:wN #4 + \int_use:N \__int_eval:w #5 + \if_int_compare:w #7 > \c_zero + \exp_after:wN \__fp_trig_large:ww \__int_value:w \else: - \exp_after:wN \__fp_trig_small:w \__int_value:w + \exp_after:wN \__fp_trig_small:ww \__int_value:w \fi: \else: - \if_case:w #4 - \__fp_sin_epsilon:w - \or: \__fp_sin_epsilon:w - \or: \__fp_cos_epsilon:w - \else: \__fp_cot_epsilon:w - \fi: - #5 + \exp_after:wN #1 + \exp_after:wN #6 \fi: - #6 ; - } -\cs_new:Npn \__fp_sin_epsilon:w #1 \fi: #2 \fi: #3 ; - { \fi: \fi: \__fp_exp_after_o:w \s__fp \__fp_chk:w 1 #2 {#3} } -\cs_new:Npn \__fp_cos_epsilon:w #1 \fi: #2 \fi: #3 ; #4 ; - { \fi: \fi: \exp_after:wN \c_one_fp } -\cs_new:Npn \__fp_cot_epsilon:w \fi: #1 \fi: #2 ; - { \fi: \fi: \__fp_one_over:w \s__fp \__fp_chk:w 1 #1 {#2} } -\cs_new:Npn \__fp_trig_small:w #1; - { - \exp_after:wN \exp_after:wN \exp_after:wN \__fp_trig_small_aux:wwNN - \prg_replicate:nn { - #1 } { 0 } ; + #7 ; } -\cs_new:Npn \__fp_trig_small_aux:wwNN #1; #2#3#4#5; +\cs_new:Npn \__fp_trig_epsilon_o:w #1 #2 ; + { \__fp_exp_after_o:w \s__fp \__fp_chk:w 1 #1 {#2} } +\cs_new:Npn \__fp_trig_epsilon_one_o:w #1 ; #2 ; + { \exp_after:wN \c_one_fp } +\group_begin: + \char_set_catcode_letter:N / + \cs_new:Npn \__fp_trig_epsilon_inv_o:w #1 #2 ; + { + \exp_after:wN \__fp_/_o:ww + \c_one_fp + \s__fp \__fp_chk:w 1 #1 {#2} + } +\group_end: +\cs_new:Npn \__fp_trig_small:ww #1; #2#3#4#5; { - \__fp_pack_twice_four:wNNNNNNNN - \__fp_pack_twice_four:wNNNNNNNN - \__fp_pack_twice_four:wNNNNNNNN - . - ; - #1#2#3#4#5 0000 0000; + \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN + \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN + \exp_after:wN \__fp_pack_twice_four:wNNNNNNNN + \exp_after:wN . + \exp_after:wN ; + \tex_romannumeral:D -`0 + \prg_replicate:nn { - #1 } { 0 } #2#3#4#5 0000 0000 ; } -\cs_new:Npn \__fp_trig_large:w #1; #2#3; +\cs_new:Npn \__fp_trig_large:ww #1; #2#3; { \__fp_trig_large_i:www #2; #3 ; #1; } \cs_new:Npn \__fp_trig_large_i:www #1; #2; #3; { \if_meaning:w 0 #3 \__fp_trig_large_break:w \fi: - \exp_after:wN \__fp_trig_large_ii:wnnnnnn + \exp_after:wN \__fp_trig_large_ii_o:wnnnn \int_use:N \__int_eval:w ( #1 - 3141 ) / 6283 ; - {#1} #2; + {#1} #2 + \exp_after:wN ; \int_use:N \__int_eval:w \c_minus_one + #3; } -\cs_new:Npn \__fp_trig_large_ii:wnnnnnn #1; #2#3#4#5; +\cs_new:Npn \__fp_trig_large_ii_o:wnnnn #1; #2#3#4#5 { \exp_after:wN \__fp_trig_large_i:www - \int_use:N \__int_eval:w -5 0000 + #20 - #1*62831 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 + #30 - #1*8530 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 4 9995 0000 + #40 - #1*7179 - \exp_after:wN \__fp_fixed_mul_pack:NNNNNw - \int_use:N \__int_eval:w 5 0000 0000 + #50 - #1*5880 - \exp_after:wN ; + \int_use:N \__int_eval:w \c__fp_leading_shift_int + #20 - #1*62831 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #30 - #1*8530 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_middle_shift_int + #40 - #1*7179 + \exp_after:wN \__fp_pack:NNNNNw + \int_use:N \__int_eval:w \c__fp_trailing_shift_int + #50 - #1*5880 \exp_after:wN ; } \cs_new:Npn \__fp_trig_large_break:w \fi: #1; #2; - { \fi: \__fp_trig_octant_loop:nw #2 {0000} {0000} ; } -\cs_new:Npn \__fp_trig_octant_loop:nw #1#2; + { \fi: \__fp_trig_octant_loop:nnnnnw #2 {0000} {0000} ; } +\cs_new:Npn \__fp_trig_octant_loop:nnnnnw #1#2#3#4#5#6; { - \if_int_compare:w #1 < 15707 \exp_stop_f: + \if_int_compare:w #1#2 < 157079633 \exp_stop_f: + \if_int_compare:w #1#2 = 157079632 \exp_stop_f: + \if_int_compare:w #3#4 > 67948969 \exp_stop_f: + \use_i_ii:nnn + \fi: + \fi: \__fp_trig_octant_break:w \fi: + \c_two - \__fp_fixed_sub_back:wwN + \__fp_fixed_sub:wwn + {#1} {#2} {#3} {#4} {0000} {0000} ; {15707} {9632} {6794} {8970} {0000} {0000} ; - {#1} #2; - \__fp_trig_octant_loop:nw + \__fp_trig_octant_loop:nnnnnw } -\cs_new:Npn \__fp_trig_octant_break:w #1 \fi: + #2#3 #4; #5#6; #7; +\cs_new:Npn \__fp_trig_octant_break:w #1 \fi: + #2#3 #4#5; #6; #7; { \fi: - \if_int_compare:w #5 < 7854 \exp_stop_f: - \if_int_compare:w #5 < \c_zero - \exp_after:wN \__fp_trig_octant_neg:w - \fi: + \if_int_compare:w #4 < 7854 \exp_stop_f: \exp_after:wN \__fp_use_i_until_s:nw \exp_after:wN . \fi: + \c_one - \__fp_fixed_sub:wwN - {15707} {9632} {6794} {8970} {0000} {0000} ; - {#5} #6 ; . ; - } -\cs_new:Npn \__fp_trig_octant_neg:w #1\fi: #2; #3#4#5#6#7#8; #9 - { - \fi: - + \c_seven - \exp_after:wN \__fp_fixed_add_after:NNNNNwN - \int_use:N \__int_eval:w 1 9999 9998 - #30000 - #4 - \exp_after:wN \__fp_fixed_add_pack:NNNNNwN - \int_use:N \__int_eval:w 1 9999 9998 - #5#6 - \exp_after:wN \__fp_fixed_add_pack:NNNNNwN - \int_use:N \__int_eval:w 2 0000 0000 - #7#8 ; {#9} ; + \__fp_fixed_sub:wwn #6 ; {#4} #5 ; . ; } \cs_new:Npn \__fp_sin_series:NNwww #1#2#3 . #4; #5; { \__fp_fixed_mul:wwn #4; #4; { - \exp_after:wN \__fp_sin_series_aux:Nnww + \exp_after:wN \__fp_sin_series_aux:NNnww + \exp_after:wN #1 \__int_value:w \if_int_odd:w \__int_eval:w ( #3 + \c_two ) / \c_four \__int_eval_end: #2 @@ -4019,49 +4072,49 @@ } #4 ; } -\cs_new:Npn \__fp_sin_series_aux:Nnww #1#2 #3; #4; +\cs_new:Npn \__fp_sin_series_aux:NNnww #1#2#3 #4; #5; { - \if_int_odd:w \__int_eval:w #2 / \c_two \__int_eval_end: + \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: - { - \__fp_fixed_continue:wn {0000}{0000}{0000}{0001}{5619}{2070}; % 1/18! - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0000}{0477}{9477}{3324}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0011}{4707}{4559}{7730}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{2087}{6756}{9878}{6810}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0027}{5573}{1922}{3985}{8907}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{2480}{1587}{3015}{8730}{1587}; - \__fp_fixed_mul_sub_back:wwwn #3; {0013}{8888}{8888}{8888}{8888}{8889}; - \__fp_fixed_mul_sub_back:wwwn #3; {0416}{6666}{6666}{6666}{6666}{6667}; - \__fp_fixed_mul_sub_back:wwwn #3; {5000}{0000}{0000}{0000}{0000}{0000}; - \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; + { % 1/18! + \__fp_fixed_mul_sub_back:wwwn {0000}{0000}{0000}{0001}{5619}{2070}; + #4; {0000}{0000}{0000}{0477}{9477}{3324}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0000}{0011}{4707}{4559}{7730}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0000}{2087}{6756}{9878}{6810}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0027}{5573}{1922}{3985}{8907}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{2480}{1587}{3015}{8730}{1587}; + \__fp_fixed_mul_sub_back:wwwn #4; {0013}{8888}{8888}{8888}{8888}{8889}; + \__fp_fixed_mul_sub_back:wwwn #4; {0416}{6666}{6666}{6666}{6666}{6667}; + \__fp_fixed_mul_sub_back:wwwn #4; {5000}{0000}{0000}{0000}{0000}{0000}; + \__fp_fixed_mul_sub_back:wwwn #4;{10000}{0000}{0000}{0000}{0000}{0000}; } - { - \__fp_fixed_continue:wn {0000}{0000}{0000}{0028}{1145}{7254}; % 1/17! - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0000}{7647}{1637}{3182}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0000}{0160}{5904}{3836}{8216}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0002}{5052}{1083}{8544}{1719}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0275}{5731}{9223}{9858}{9065}; - \__fp_fixed_mul_sub_back:wwwn #3; {0001}{9841}{2698}{4126}{9841}{2698}; - \__fp_fixed_mul_sub_back:wwwn #3; {0083}{3333}{3333}{3333}{3333}{3333}; - \__fp_fixed_mul_sub_back:wwwn #3; {1666}{6666}{6666}{6666}{6666}{6667}; - \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; - \__fp_fixed_mul:wwn #4; + { % 1/17! + \__fp_fixed_mul_sub_back:wwwn {0000}{0000}{0000}{0028}{1145}{7254}; + #4; {0000}{0000}{0000}{7647}{1637}{3182}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0000}{0160}{5904}{3836}{8216}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0002}{5052}{1083}{8544}{1719}; + \__fp_fixed_mul_sub_back:wwwn #4; {0000}{0275}{5731}{9223}{9858}{9065}; + \__fp_fixed_mul_sub_back:wwwn #4; {0001}{9841}{2698}{4126}{9841}{2698}; + \__fp_fixed_mul_sub_back:wwwn #4; {0083}{3333}{3333}{3333}{3333}{3333}; + \__fp_fixed_mul_sub_back:wwwn #4; {1666}{6666}{6666}{6666}{6666}{6667}; + \__fp_fixed_mul_sub_back:wwwn #4;{10000}{0000}{0000}{0000}{0000}{0000}; + \__fp_fixed_mul:wwn #5; } { \exp_after:wN \__fp_sanitize:Nw - \exp_after:wN #1 - \int_use:N \__int_eval:w \__fp_fixed_to_float:wN + \exp_after:wN #2 + \int_use:N \__int_eval:w #1 } - #1 + #2 } -\cs_new:Npn \__fp_tan_series:NNwww #1#2#3. #4; #5; +\cs_new:Npn \__fp_tan_series_o:NNwww #1#2#3. #4; #5; { \__fp_fixed_mul:wwn #4; #4; { - \exp_after:wN \__fp_tan_series_aux:Nnww + \exp_after:wN \__fp_tan_series_aux_o:Nnww \__int_value:w \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end: \exp_after:wN \reverse_if:N @@ -4071,18 +4124,18 @@ } #4 ; } -\cs_new:Npn \__fp_tan_series_aux:Nnww #1 #2 #3; #4; +\cs_new:Npn \__fp_tan_series_aux_o:Nnww #1 #2 #3; #4; { - \__fp_fixed_continue:wn {0000}{0000}{1527}{3493}{0856}{7059}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{0159}{6080}{0274}{5257}{6472}; + \__fp_fixed_mul_sub_back:wwwn {0000}{0000}{1527}{3493}{0856}{7059}; + #3; {0000}{0159}{6080}{0274}{5257}{6472}; \__fp_fixed_mul_sub_back:wwwn #3; {0002}{4571}{2320}{0157}{2558}{8481}; \__fp_fixed_mul_sub_back:wwwn #3; {0115}{5830}{7533}{5397}{3168}{2147}; \__fp_fixed_mul_sub_back:wwwn #3; {1929}{8245}{6140}{3508}{7719}{2982}; \__fp_fixed_mul_sub_back:wwwn #3;{10000}{0000}{0000}{0000}{0000}{0000}; \__fp_fixed_mul:wwn #4; { - \__fp_fixed_continue:wn {0000}{0007}{0258}{0681}{9408}{4706}; - \__fp_fixed_mul_sub_back:wwwn #3; {0000}{2343}{7175}{1399}{6151}{7670}; + \__fp_fixed_mul_sub_back:wwwn {0000}{0007}{0258}{0681}{9408}{4706}; + #3; {0000}{2343}{7175}{1399}{6151}{7670}; \__fp_fixed_mul_sub_back:wwwn #3; {0019}{2638}{4588}{9232}{8861}{3691}; \__fp_fixed_mul_sub_back:wwwn #3; {0536}{6357}{0691}{4344}{6852}{4252}; \__fp_fixed_mul_sub_back:wwwn #3; {5263}{1578}{9473}{6842}{1052}{6315}; @@ -4350,6 +4403,21 @@ \cs_new_eq:NN \fp_eval:n \fp_to_decimal:n \cs_new:Npn \fp_abs:n #1 { \fp_to_decimal:n { abs \__fp_parse:n {#1} } } +\cs_new:Npn \__fp_array_to_clist:n #1 + { + \__fp_array_to_clist_i:wwww ; + #1 + \__fp_array_to_clist_ii:ww \s__fp ; @ + ; , ~ , ~ @ \s_stop + } +\cs_new:Npn \__fp_array_to_clist_i:wwww #1; #2 \s__fp #3; #4 @ + { + #2 + \exp_after:wN \__fp_array_to_clist_i:wwww + \tex_romannumeral:D -`0 \__fp_to_tl:w \s__fp #3 ; ; + #4 , ~ #1 @ + } +\cs_new:Npn \__fp_array_to_clist_ii:ww #1 ; , ~ , ~ #2 @ #3 \s_stop {#2} %% %% File: l3fp-assign.dtx Copyright (C) 2011-2012 The LaTeX3 project %% @@ -4421,7 +4489,14 @@ \cs_generate_variant:Nn \fp_sub:Nn { c } \cs_generate_variant:Nn \fp_gsub:Nn { c } \cs_new_protected:Npn \fp_show:N #1 - { \__msg_show_variable:x { > \fp_to_tl:N #1 } } + { + \fp_if_exist:NTF #1 + { \__msg_show_variable:x { > \fp_to_tl:N #1 } } + { + \__msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } \cs_new_protected:Npn \fp_show:n #1 { \__msg_show_variable:x { > \fp_to_tl:n {#1} } } \cs_generate_variant:Nn \fp_show:N { c } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index 531f0a0e7c9..25667fc8c75 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3int.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3int.dtx 4121 2012-08-17 01:36:30Z bruno $ {L3 Integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -329,11 +329,11 @@ } \cs_new:Npn \int_until_do:nNnn #1#2#3#4 { - \int_compare:nNnF {#1} #2 {#3} - { - #4 - \int_until_do:nNnn {#1} #2 {#3} {#4} - } + \int_compare:nNnF {#1} #2 {#3} + { + #4 + \int_until_do:nNnn {#1} #2 {#3} {#4} + } } \cs_new:Npn \int_do_while:nNnn #1#2#3#4 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index 3845880de85..0d717006172 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3msg.dtx 4077 2012-08-10 23:30:52Z bruno $ +\GetIdInfo$Id: l3msg.dtx 4147 2012-08-28 10:27:33Z bruno $ {L3 Messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -591,7 +591,7 @@ \c_msg_coding_error_text_tl Code-level~functions~must~contain~':'~to~separate~the~ argument~specification~from~the~function~name.~This~is~ - needed~when~defining~conditionals~or~when~building~a~ + needed~when~defining~conditionals~or~variants,~or~when~building~a~ parameter~text~from~the~number~of~arguments~of~the~function. } \__msg_kernel_new:nnnn { kernel } { protected-predicate } @@ -630,6 +630,14 @@ with~a~signature~starting~with~'#1',~but~that~is~longer~than~ the~signature~(part~after~the~colon)~of~'#2'. } +\__msg_kernel_new:nnnn { kernel } { invalid-variant } + { Variant~form~'#1'~invalid~for~base~form~'#2'. } + { + \c_msg_coding_error_text_tl + LaTeX~has~been~asked~to~create~a~variant~of~the~function~'#2'~ + with~a~signature~starting~with~'#1',~but~cannot~change~an~argument~ + from~type~'#3'~to~type~'#4'. + } \__msg_kernel_new:nnn { kernel } { bad-variable } { Erroneous~variable~#1 used! } \__msg_kernel_new:nnn { kernel } { misused-sequence } @@ -736,7 +744,7 @@ \cs_if_exist:NTF #1 { \__msg_term:nnn { LaTeX / kernel } { show- #2 } {#1} - \__msg_show_variable:x {#3} + \__msg_show_variable:x { \tl_to_str:n {#3} } } { \__msg_kernel_error:nnx { kernel } { variable-not-defined } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 22fa6688784..93ef25ee4b6 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3prg.dtx 4061 2012-08-08 15:19:07Z bruno $ +\GetIdInfo$Id: l3prg.dtx 4114 2012-08-16 01:57:02Z bruno $ {L3 Control structures} %% \ProvidesExplPackage @@ -106,8 +106,8 @@ \cs_new_protected:Npn \bool_show:n #1 { \bool_if:nTF {#1} - { \__msg_show_variable:x { > true } } - { \__msg_show_variable:x { > false } } + { \__msg_show_variable:n { > true } } + { \__msg_show_variable:n { > false } } } \cs_generate_variant:Nn \bool_show:N { c } \bool_new:N \l_tmpa_bool diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty index e65ebc5e2bc..1e692963872 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3prop.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3prop.dtx 4092 2012-08-14 14:04:41Z bruno $ {L3 Property lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -295,9 +295,7 @@ { \__prg_map_break:Nn \prop_map_break: } \cs_new_protected:Npn \prop_show:N #1 { - \__msg_show_variable:Nnn - #1 - { prop } + \__msg_show_variable:Nnx #1 { prop } { \prop_map_function:NN #1 \__msg_show_item:nn } } \cs_generate_variant:Nn \prop_show:N { c } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 5b4fe8c3790..58e3b205359 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3seq.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3seq.dtx 4092 2012-08-14 14:04:41Z bruno $ {L3 Sequences and stacks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -433,9 +433,7 @@ \prg_new_eq_conditional:NNn \seq_gpop:cN \seq_gpop_left:cN { T , F , TF } \cs_new_protected:Npn \seq_show:N #1 { - \__msg_show_variable:Nnn - #1 - { seq } + \__msg_show_variable:Nnx #1 { seq } { \seq_map_function:NN #1 \__msg_show_item:n } } \cs_generate_variant:Nn \seq_show:N { c } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty index 8888a5b9056..adbdbc68d8c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty @@ -47,7 +47,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3skip.dtx 3991 2012-07-16 19:00:35Z joseph $ +\GetIdInfo$Id: l3skip.dtx 4121 2012-08-17 01:36:30Z bruno $ {L3 Dimensions and skips} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -- cgit v1.2.3