diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx | 98 |
1 files changed, 45 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index dd30a2f4ff0..69c8a7dc71a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-convert.dtx Copyright(C) 2011-2014 The LaTeX3 Project +%% File: l3fp-convert.dtx Copyright(C) 2011-2014,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 @@ -36,7 +36,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-convert.dtx 5983 2015-09-10 18:57:56Z joseph $ +\GetIdInfo$Id: l3fp-convert.dtx 6441 2016-03-24 10:11:59Z joseph $ {L3 Floating-point conversion} \begin{document} \DocInput{\jobname.dtx} @@ -138,54 +138,46 @@ % \enquote{invalid_operation} exception. In the normal case, % decrement the exponent and unbrace the $4$ brace groups, then in a % second step grab the first digit (previously hidden in braces) to -% order the various parts correctly. Finally trim zeros. The whole -% construction is within a call to \cs{tl_to_lowercase:n}, responsible -% for creating |e| with category \enquote{other}. +% order the various parts correctly. Finally trim zeros. % \begin{macrocode} -\group_begin: -\char_set_catcode_other:N E -\tl_to_lowercase:n +\cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2 { - \group_end: - \cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2 - { - \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: - \if_case:w #1 \exp_stop_f: - \@@_case_return:nw { 0 } - \or: \exp_after:wN \@@_to_scientific_normal:wnnnnn - \or: - \@@_case_use:nw - { - \@@_invalid_operation:nnw - { - \exp_after:wN 1 - \exp_after:wN E - \int_use:N \c_@@_max_exponent_int - } - { fp_to_scientific } - } - \or: - \@@_case_use:nw + \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: + \if_case:w #1 \exp_stop_f: + \@@_case_return:nw { 0 } + \or: \exp_after:wN \@@_to_scientific_normal:wnnnnn + \or: + \@@_case_use:nw + { + \@@_invalid_operation:nnw { - \@@_invalid_operation:nnw - { 0 } - { fp_to_scientific } + \exp_after:wN 1 + \exp_after:wN e + \int_use:N \c_@@_max_exponent_int } - \fi: - \s_@@ \@@_chk:w #1 #2 - } - \cs_new:Npn \@@_to_scientific_normal:wnnnnn - \s_@@ \@@_chk:w 1 #1 #2 #3#4#5#6 ; - { - \if_int_compare:w #2 = \c_one - \exp_after:wN \@@_to_scientific_normal:wNw - \else: - \exp_after:wN \@@_to_scientific_normal:wNw - \exp_after:wN E - \int_use:N \__int_eval:w #2 - \c_one - \fi: - ; #3 #4 #5 #6 ; - } + { fp_to_scientific } + } + \or: + \@@_case_use:nw + { + \@@_invalid_operation:nnw + { 0 } + { fp_to_scientific } + } + \fi: + \s_@@ \@@_chk:w #1 #2 + } +\cs_new:Npn \@@_to_scientific_normal:wnnnnn + \s_@@ \@@_chk:w 1 #1 #2 #3#4#5#6 ; + { + \if_int_compare:w #2 = \c_one + \exp_after:wN \@@_to_scientific_normal:wNw + \else: + \exp_after:wN \@@_to_scientific_normal:wNw + \exp_after:wN e + \__int_value:w \__int_eval:w #2 - \c_one + \fi: + ; #3 #4 #5 #6 ; } \cs_new:Npn \@@_to_scientific_normal:wNw #1 ; #2#3; { \@@_trim_zeros:w #2.#3 ; #1 } @@ -325,8 +317,8 @@ \if_case:w #1 \exp_stop_f: \@@_case_return:nw { 0 } \or: \exp_after:wN \@@_to_tl_normal:nnnnn - \or: \@@_case_return:nw { \tl_to_str:n {inf} } - \else: \@@_case_return:nw { \tl_to_str:n {nan} } + \or: \@@_case_return:nw { inf } + \else: \@@_case_return:nw { nan } \fi: } \cs_new:Npn \@@_to_tl_normal:nnnnn #1 @@ -360,11 +352,11 @@ % These three public functions rely on \cs{fp_to_decimal:n} % internally. We make sure to produce |pt| with category other. % \begin{macrocode} -\cs_new:Npx \fp_to_dim:N #1 - { \exp_not:N \fp_to_decimal:N #1 \tl_to_str:n {pt} } +\cs_new:Npn \fp_to_dim:N #1 + { \fp_to_decimal:N #1 pt } \cs_generate_variant:Nn \fp_to_dim:N { c } -\cs_new:Npx \fp_to_dim:n #1 - { \exp_not:N \fp_to_decimal:n {#1} \tl_to_str:n {pt} } +\cs_new:Npn \fp_to_dim:n #1 + { \fp_to_decimal:n {#1} pt } % \end{macrocode} % \end{macro} % @@ -433,7 +425,7 @@ \@@_case_return:nw { \exp_after:wN \c_zero_fp } \else: \exp_after:wN \@@_from_dim:wNw - \int_use:N \__int_eval:w #1 - \c_four + \__int_value:w \__int_eval:w #1 - \c_four \if_meaning:w - #2 \exp_after:wN , \exp_after:wN 2 \__int_value:w \else: |