summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx70
1 files changed, 19 insertions, 51 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
index e6ce10175fa..685274306b0 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
@@ -22,7 +22,7 @@
%
%<*driver>
\documentclass[full]{l3doc}
-\GetIdInfo$Id: l3fp-traps.dtx 6805 2016-12-28 22:15:52Z joseph $
+\GetIdInfo$Id: l3fp-traps.dtx 6923 2017-02-14 03:07:25Z bruno $
{L3 Floating-point exception trapping}
\begin{document}
\DocInput{\jobname.dtx}
@@ -72,51 +72,19 @@
%
% \subsection{Flags}
%
-% \begin{macro}{\fp_flag_off:n}
-% Function to turn a flag off. Simply undefine it.
-% \begin{macrocode}
-\cs_new_protected:Npn \fp_flag_off:n #1
- { \cs_set_eq:cN { l_@@_ #1 _flag_token } \tex_undefined:D }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\fp_flag_on:n}
-% Function to turn a flag on expandably: use \TeX{}'s automatic
-% assignment to \cs{scan_stop:}.
-% \begin{macrocode}
-\cs_new:Npn \fp_flag_on:n #1
- { \exp_args:Nc \use_none:n { l_@@_ #1 _flag_token } }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP,pTF]{\fp_if_flag_on:n}
-% Returns true if the flag is on, false otherwise.
-% \begin{macrocode}
-\prg_new_conditional:Npnn \fp_if_flag_on:n #1 { p , T , F , TF }
- {
- \if_cs_exist:w l_@@_ #1 _flag_token \cs_end:
- \prg_return_true:
- \else:
- \prg_return_false:
- \fi:
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{variable}[aux]
+% \begin{variable}
% {
-% \l_@@_invalid_operation_flag_token ,
-% \l_@@_division_by_zero_flag_token ,
-% \l_@@_overflow_flag_token ,
-% \l_@@_underflow_flag_token ,
+% flag fp_invalid_operation,
+% flag fp_division_by_zero,
+% flag fp_overflow,
+% flag fp_underflow
% }
-% The \textsc{ieee} standard defines five exceptions. We currently
-% don't support the \enquote{inexact} exception.
+% Flags to denote exceptions.
% \begin{macrocode}
-\cs_new_eq:NN \l_@@_invalid_operation_flag_token \tex_undefined:D
-\cs_new_eq:NN \l_@@_division_by_zero_flag_token \tex_undefined:D
-\cs_new_eq:NN \l_@@_overflow_flag_token \tex_undefined:D
-\cs_new_eq:NN \l_@@_underflow_flag_token \tex_undefined:D
+\flag_new:n { fp_invalid_operation }
+\flag_new:n { fp_division_by_zero }
+\flag_new:n { fp_overflow }
+\flag_new:n { fp_underflow }
% \end{macrocode}
% \end{variable}
%
@@ -124,7 +92,7 @@
%
% Exceptions can be trapped to obtain custom behaviour. When an invalid
% operation or a division by zero is trapped, the trap receives as
-% arguments the result as an $N$-type floating point number, the
+% arguments the result as an |N|-type floating point number, the
% function name (multiple letters for prefix operations, or a single
% symbol for infix operations), and the operand(s). When an overflow or
% underflow is trapped, the trap receives the resulting overly large or
@@ -199,7 +167,7 @@
{
#1
\@@_error:nnfn { invalid } {##2} { \fp_to_tl:n { ##3; } } { }
- \fp_flag_on:n { invalid_operation }
+ \flag_raise:n { fp_invalid_operation }
##1
}
\exp_args:Nno \use:n
@@ -208,7 +176,7 @@
#1
\@@_error:nffn { invalid-ii }
{ \fp_to_tl:n { ##2; } } { \fp_to_tl:n { ##3; } } {##1}
- \fp_flag_on:n { invalid_operation }
+ \flag_raise:n { fp_invalid_operation }
\exp_after:wN \c_nan_fp
}
\exp_args:Nno \use:n
@@ -216,7 +184,7 @@
{
#1
\@@_error:nffn { invalid } {##1} {##2} { }
- \fp_flag_on:n { invalid_operation }
+ \flag_raise:n { fp_invalid_operation }
\exp_after:wN \c_nan_fp
}
}
@@ -249,7 +217,7 @@
{
#1
\@@_error:nnfn { zero-div } {##2} { \fp_to_tl:n { ##3; } } { }
- \fp_flag_on:n { division_by_zero }
+ \flag_raise:n { fp_division_by_zero }
\exp_after:wN ##1
}
\exp_args:Nno \use:n
@@ -258,7 +226,7 @@
#1
\@@_error:nffn { zero-div-ii }
{ \fp_to_tl:n { ##3; } } { \fp_to_tl:n { ##4; } } {##2}
- \fp_flag_on:n { division_by_zero }
+ \flag_raise:n { fp_division_by_zero }
\exp_after:wN ##1
}
}
@@ -321,7 +289,7 @@
{ \fp_to_tl:n { \s_@@ \@@_chk:w ##1##2##3; } }
{ \token_if_eq_meaning:NNF 0 ##2 { - } #4 }
{#2}
- \fp_flag_on:n {#2}
+ \flag_raise:n { fp_#2 }
#3 ##2
}
}
@@ -337,7 +305,7 @@
% \@@_division_by_zero_o:Nnw, \@@_division_by_zero_o:NNww,
% \@@_overflow:w , \@@_underflow:w
% }
-% Initialize the two control sequences (to log properly their
+% Initialize the control sequences (to log properly their
% existence). Then set invalid operations to trigger an error, and
% division by zero, overflow, and underflow to act silently on their
% flag.