summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx29
1 files changed, 27 insertions, 2 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
index 4481093d01c..8740c1c7351 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
@@ -38,7 +38,7 @@
% {latex-team@latex-project.org}^^A
% }^^A
% }
-% \date{Released 2018-10-31}
+% \date{Released 2018-11-19}
%
% \maketitle
%
@@ -73,6 +73,7 @@
% \begin{macro}[EXP]
% {
% \@@_parse_word_abs:N ,
+% \@@_parse_word_logb:N ,
% \@@_parse_word_sign:N ,
% \@@_parse_word_sqrt:N ,
% }
@@ -80,6 +81,8 @@
% \begin{macrocode}
\cs_new:Npn \@@_parse_word_abs:N
{ \@@_parse_unary_function:NNN \@@_set_sign_o:w 0 }
+\cs_new:Npn \@@_parse_word_logb:N
+ { \@@_parse_unary_function:NNN \@@_logb_o:w ? }
\cs_new:Npn \@@_parse_word_sign:N
{ \@@_parse_unary_function:NNN \@@_sign_o:w ? }
\cs_new:Npn \@@_parse_word_sqrt:N
@@ -2029,7 +2032,29 @@
% \end{macrocode}
% \end{macro}
%
-% \subsection{About the sign}
+% \subsection{About the sign and exponent}
+%
+% \begin{macro}[EXP]{\@@_logb_o:w, \@@_logb_aux_o:w}
+% The exponent of a normal number is its \meta{exponent} minus one.
+% \begin{macrocode}
+\cs_new:Npn \@@_logb_o:w ? \s_@@ \@@_chk:w #1#2; @
+ {
+ \if_case:w #1 \exp_stop_f:
+ \@@_case_use:nw
+ { \@@_division_by_zero_o:Nnw \c_minus_inf_fp { logb } }
+ \or: \exp_after:wN \@@_logb_aux_o:w
+ \or: \@@_case_return_o:Nw \c_inf_fp
+ \else: \@@_case_return_same_o:w
+ \fi:
+ \s_@@ \@@_chk:w #1 #2;
+ }
+\cs_new:Npn \@@_logb_aux_o:w \s_@@ \@@_chk:w #1 #2 #3 #4 ;
+ {
+ \exp_after:wN \@@_parse:n \exp_after:wN
+ { \int_value:w \int_eval:w #3 - 1 \exp_after:wN }
+ }
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}[EXP]{\@@_sign_o:w}
% \begin{macro}[EXP]{\@@_sign_aux_o:w}