summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx20
1 files changed, 16 insertions, 4 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx
index 5610b11fc4c..9bedd90aab2 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2019-08-14}
+% \date{Released 2019-08-25}
%
% \maketitle
%
@@ -483,14 +483,26 @@
% \@@_round_special:NwwNnn ,
% \@@_round_special_aux:Nw
% }
+% If the number of digits to round to is an integer or infinity all is
+% good; if it is \texttt{nan} then just produce a \texttt{nan};
+% otherwise invalid as we have something like |round(1,3.14)| where
+% the number of digits is not an integer.
% \begin{macrocode}
\cs_new:Npn \@@_round:Nww #1#2 ; #3 ;
{
\@@_small_int:wTF #3; { \@@_round:Nwn #1#2; }
{
- \@@_invalid_operation_tl_o:ff
- { \@@_round_name_from_cs:N #1 }
- { \@@_array_to_clist:n { #2; #3; } }
+ \if:w 3 \@@_kind:w #3 ;
+ \exp_after:wN \use_i:nn
+ \else:
+ \exp_after:wN \use_ii:nn
+ \fi:
+ { \exp_after:wN \c_nan_fp }
+ {
+ \@@_invalid_operation_tl_o:ff
+ { \@@_round_name_from_cs:N #1 }
+ { \@@_array_to_clist:n { #2; #3; } }
+ }
}
}
\cs_new:Npn \@@_round:Nwn #1 \s_@@ \@@_chk:w #2#3#4; #5