summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xint.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-11-21 22:24:46 +0000
committerKarl Berry <karl@freefriends.org>2016-11-21 22:24:46 +0000
commitf41f19063b4eeb01ac278d4d84341194ac4497c4 (patch)
tree859a01b4cb8ecd3def23f9be9a6e56f04e6c18e4 /Master/texmf-dist/tex/generic/xint/xint.sty
parent4d1331362d70d28653f078bfc64f62e05933bf7b (diff)
xint (21nov16)
git-svn-id: svn://tug.org/texlive/trunk@42550 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xint.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xint.sty34
1 files changed, 23 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index 6cad13c1d89..25a779f3a93 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2g 2016/03/19
+%% The xint bundle 1.2h 2016/11/20
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xint: Expandable operations on big integers
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty)
\XINT_providespackage
\ProvidesPackage{xint}%
- [2016/03/19 1.2g Expandable operations on big integers (JFB)]%
+ [2016/11/20 1.2h Expandable operations on big integers (JFB)]%
\long\def\xint_firstofthree #1#2#3{#1}%
\long\def\xint_secondofthree #1#2#3{#2}%
\long\def\xint_thirdofthree #1#2#3{#3}%
@@ -1510,8 +1510,9 @@
\let\xintibinomial\xintiibinomial
\def\XINT_binom_fork #1#2.#3#4.#5#6.%
{%
- \if-#1\xint_dothis {\xintError:OutOfRangeBinomial\space 0}\fi
- \if-#3\xint_dothis {\xintError:OutOfRangeBinomial\space 0}\fi
+ \if-#5\xint_dothis{\xintError:OutOfRangeBinomial\space 0}\fi
+ \if-#1\xint_dothis{ 0}\fi
+ \if-#3\xint_dothis{ 0}\fi
\if0#1\xint_dothis{ 1}\fi
\if0#3\xint_dothis{ 1}\fi
\ifnum #5#6>\xint_c_x^viii_mone\xint_dothis{\xintError:OutOfRangeBinomial\space 0}\fi
@@ -1750,13 +1751,24 @@
}%
\def\xintiPFactorial{\romannumeral0\xintipfactorial}%
\let\xintipfactorial\xintiipfactorial
-\def\XINT_pfac_fork #1#2.#3.%
-{%
- \if-#1\xint_dothis {\xintError:OutOfRangePFac\space 0}\fi
- \ifnum #1#2=#3 \xint_dothis{ 1}\fi
- \ifnum #1#2>#3 \xint_dothis{\xintError:OutOfRangePFac\space 0}\fi
- \ifnum #3>\xint_c_x^viii_mone\xint_dothis{\xintError:OutOfRangePFac\space 0}\fi
- \xint_orthat {\XINT_pfac_a #1#2.#3.}%
+\def\XINT_pfac_fork #1#2.#3#4.%
+{%
+ \unless\ifnum #1#2<#3#4 \xint_dothis\XINT_pfac_one\fi
+ \if-#3\xint_dothis\XINT_pfac_neg\fi
+ \if-#1\xint_dothis\XINT_pfac_zero\fi
+ \ifnum #3#4>\xint_c_x^viii_mone\xint_dothis\XINT_pfac_outofrange\fi
+ \xint_orthat \XINT_pfac_a #1#2.#3#4.%
+}%
+\def\XINT_pfac_outofrange #1.#2.{\xintError:OutOfRangePFac\space 0}%
+\def\XINT_pfac_one #1.#2.{ 1}%
+\def\XINT_pfac_zero #1.#2.{ 0}%
+\def\XINT_pfac_neg -#1.-#2.%
+{%
+ \ifnum #1>\xint_c_x^viii\xint_dothis\XINT_pfac_outofrange\fi
+ \xint_orthat
+ {\ifodd\numexpr#2-#1\relax\xint_afterfi{\expandafter-\romannumeral`&&@}\fi
+ \expandafter\XINT_pfac_a }%
+ \the\numexpr #2-\xint_c_i\expandafter.\the\numexpr#1-\xint_c_i.%
}%
\def\XINT_pfac_a #1.#2.%
{%