summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintfrac.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-06 22:02:47 +0000
committerKarl Berry <karl@freefriends.org>2019-01-06 22:02:47 +0000
commit3354abdc519630ad9975bfce46bada2882fcd6af (patch)
treef803a9bf96bd1c8eb2b618218f06fb20306bf387 /Master/texmf-dist/tex/generic/xint/xintfrac.sty
parentbee0d2fefd913952b342b909a4a278ce72712e51 (diff)
xint (6jan19)
git-svn-id: svn://tug.org/texlive/trunk@49617 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintfrac.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty86
1 files changed, 57 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index 2b3ac64e27f..09b2c87192d 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -21,8 +21,8 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.3c 2018/06/17
-%% Copyright (C) 2013-2018 by Jean-Francois Burnol
+%% The xint bundle 1.3d 2019/01/06
+%% Copyright (C) 2013-2019 by Jean-Francois Burnol
%% xintfrac: Expandable operations on fractions
%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2018/06/17 1.3c Expandable operations on fractions (JFB)]%
+ [2019/01/06 1.3d Expandable operations on fractions (JFB)]%
\def\XINT_cntSgnFork #1%
{%
\ifcase #1\expandafter\xint_secondofthree
@@ -317,78 +317,78 @@
\def\xintifsgn #1%
{%
\ifcase \xintSgn{#1}
- \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
+ \expandafter\xint_stop_atsecondofthree
+ \or\expandafter\xint_stop_atthirdofthree
+ \else\expandafter\xint_stop_atfirstofthree
\fi
}%
\def\xintifCmp{\romannumeral0\xintifcmp }%
\def\xintifcmp #1#2%
{%
\ifcase\xintCmp {#1}{#2}
- \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
+ \expandafter\xint_stop_atsecondofthree
+ \or\expandafter\xint_stop_atthirdofthree
+ \else\expandafter\xint_stop_atfirstofthree
\fi
}%
\def\xintifEq {\romannumeral0\xintifeq }%
\def\xintifeq #1#2%
{%
\if0\xintCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else\expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifGt {\romannumeral0\xintifgt }%
\def\xintifgt #1#2%
{%
\if1\xintCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else\expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifLt {\romannumeral0\xintiflt }%
\def\xintiflt #1#2%
{%
\ifnum\xintCmp{#1}{#2}<\xint_c_
- \expandafter\xint_firstoftwo_thenstop
- \else \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifZero {\romannumeral0\xintifzero }%
\def\xintifzero #1%
{%
\if0\xintSgn{#1}%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifNotZero{\romannumeral0\xintifnotzero }%
\def\xintifnotzero #1%
{%
\if0\xintSgn{#1}%
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\else
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\fi
}%
\def\xintifOne {\romannumeral0\xintifone }%
\def\xintifone #1%
{%
\if1\xintIsOne{#1}%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifOdd {\romannumeral0\xintifodd }%
\def\xintifodd #1%
{%
\if\xintOdd{#1}1%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintRaw {\romannumeral0\xintraw }%
@@ -513,7 +513,7 @@
\def\XINT_fracfrac_C 0\XINT_fracfrac_D #1#2#3%
{%
\if1\XINT_isOne {#3}%
- \xint_afterfi {\expandafter\xint_firstoftwo_thenstop\xint_gobble_ii }%
+ \xint_afterfi {\expandafter\xint_stop_atfirstoftwo\xint_gobble_ii }%
\fi
\space
\frac {#2}{#3}%
@@ -726,11 +726,14 @@
\def\XINT_ifint #1/#2.%
{%
\if 0\xintiiRem {#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
+\def\xintIsInt {\romannumeral0\xintisint }%
+\def\xintisint #1%
+ {\expandafter\XINT_ifint\romannumeral0\xintrawwithzeros {#1}.10}%
\def\xintJrr {\romannumeral0\xintjrr }%
\def\xintjrr #1%
{%
@@ -1820,6 +1823,28 @@
\def\xintabs #1{\expandafter\XINT_abs\romannumeral0\xintraw {#1}}%
\def\xintOpp {\romannumeral0\xintopp }%
\def\xintopp #1{\expandafter\XINT_opp\romannumeral0\xintraw {#1}}%
+\def\xintInv {\romannumeral0\xintinv }%
+\def\xintinv #1{\expandafter\XINT_inv\romannumeral0\xintraw {#1}}%
+\def\XINT_inv #1%
+{%
+ \xint_UDzerominusfork
+ #1-\XINT_inv_iszero
+ 0#1\XINT_inv_a
+ 0-{\XINT_inv_a {}}%
+ \krof #1%
+}%
+\def\XINT_inv_iszero #1]%
+ {\XINT_signalcondition{DivisionByZero}{Division of 1 by zero (#1])}{}{0/1[0]}}%
+\def\XINT_inv_a #1#2/#3[#4#5]%
+{%
+ \xint_UDzerominusfork
+ #4-\XINT_inv_expiszero
+ 0#4\XINT_inv_b
+ 0-{\XINT_inv_b -#4}%
+ \krof #5.{#1#3/#2}%
+}%
+\def\XINT_inv_expiszero #1.#2{ #2[0]}%
+\def\XINT_inv_b #1.#2{ #2[#1]}%
\def\xintSgn {\romannumeral0\xintsgn }%
\def\xintsgn #1{\expandafter\XINT_sgn\romannumeral0\xintraw {#1}\xint:}%
\def\xintFloat {\romannumeral0\xintfloat }%
@@ -3211,10 +3236,13 @@
\romannumeral0\xintrez{\XINTinFloat[\XINTdigits]{#1}}}%
\def\XINT_iffloatint #1#2/1[#3]%
{%
- \if 0#1\xint_dothis\xint_firstoftwo_thenstop\fi
- \ifnum#3<\xint_c_\xint_dothis\xint_secondoftwo_thenstop\fi
- \xint_orthat\xint_firstoftwo_thenstop
+ \if 0#1\xint_dothis\xint_stop_atfirstoftwo\fi
+ \ifnum#3<\xint_c_\xint_dothis\xint_stop_atsecondoftwo\fi
+ \xint_orthat\xint_stop_atfirstoftwo
}%
+\def\xintFloatIsInt {\romannumeral0\xintfloatisint}%
+\def\xintfloatisint #1{\expandafter\XINT_iffloatint
+ \romannumeral0\xintrez{\XINTinFloat[\XINTdigits]{#1}}10}%
\def\XINTinRandomFloatS{\romannumeral0\XINTinrandomfloatS}%
\def\XINTinRandomFloatSdigits{\XINTinRandomFloatS[\XINTdigits]}%
\def\XINTinrandomfloatS[#1]%