summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintfrac.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/xintfrac.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/xintfrac.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintfrac.sty42
1 files changed, 26 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index ab128c57272..4ffec9ded36 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.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
%% xintfrac: Expandable operations on fractions
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintfrac}%
- [2016/03/19 1.2g Expandable operations on fractions (JFB)]%
+ [2016/11/20 1.2h Expandable operations on fractions (JFB)]%
\def\XINT_cntSgnFork #1%
{%
\ifcase #1\expandafter\xint_secondofthree
@@ -2865,17 +2865,25 @@
\the\numexpr \xintNum{#3}\expandafter.%
\the\numexpr \xintNum{#4}.\xint_c_i{#1}{#2[#1]}%
}%
-\def\XINT_FL_pfac_fork #1#2.#3.%
+\def\XINT_FL_pfac_fork #1#2.#3#4.%
{%
- \if-#1\xint_dothis\XINT_FL_pfac_outofrange\fi
- \ifnum #1#2=#3 \xint_dothis\XINT_FL_pfac_one\fi
- \ifnum #1#2>#3 \xint_dothis\XINT_FL_pfac_outofrange\fi
- \ifnum #3>\xint_c_x^viii_mone
- \xint_dothis\XINT_FL_pfac_outofrange\fi
- \xint_orthat \XINT_FL_pfac_increaseP #1#2.#3.%
+ \unless\ifnum #1#2<#3#4 \xint_dothis\XINT_FL_pfac_one\fi
+ \if-#3\xint_dothis\XINT_FL_pfac_neg \fi
+ \if-#1\xint_dothis\XINT_FL_pfac_zero\fi
+ \ifnum #3#4>\xint_c_x^viii_mone\xint_dothis\XINT_FL_pfac_outofrange\fi
+ \xint_orthat \XINT_FL_pfac_increaseP #1#2.#3#4.%
}%
\def\XINT_FL_pfac_outofrange #1.#2.#3#4#5{\xintError:OutOfRangePFac #5{0[0]}}%
-\def\XINT_FL_pfac_one #1.#2.#3#4#5{#5{1[0]}}%
+\def\XINT_FL_pfac_one #1.#2.#3#4#5{#5{1[0]}}%
+\def\XINT_FL_pfac_zero #1.#2.#3#4#5{#5{0[0]}}%
+\def\XINT_FL_pfac_neg -#1.-#2.%
+{%
+ \ifnum #1>\xint_c_x^viii\xint_dothis\XINT_FL_pfac_outofrange\fi
+ \xint_orthat {%
+ \ifodd\numexpr#2-#1\relax\xint_afterfi{\expandafter-\romannumeral`&&@}\fi
+ \expandafter\XINT_FL_pfac_increaseP}%
+ \the\numexpr #2-\xint_c_i\expandafter.\the\numexpr#1-\xint_c_i.%
+}%
\def\XINT_FL_pfac_increaseP #1.#2.#3#4%
{%
\expandafter\XINT_FL_pfac_a
@@ -3033,20 +3041,22 @@
{%
\expandafter\XINT_FL_binom_fork \the\numexpr #1-#2.#2.#1.%
}%
-\def\XINT_FL_binom_fork #1#2.#3#4.#5.%
+\def\XINT_FL_binom_fork #1#2.#3#4.#5#6.%
{%
- \if-#1\xint_dothis \XINT_FL_binom_outofrange\fi
- \if-#3\xint_dothis \XINT_FL_binom_outofrange\fi
+ \if-#5\xint_dothis \XINT_FL_binom_outofrange\fi
+ \if-#1\xint_dothis \XINT_FL_binom_zero\fi
+ \if-#3\xint_dothis \XINT_FL_binom_zero\fi
\if0#1\xint_dothis \XINT_FL_binom_one\fi
\if0#3\xint_dothis \XINT_FL_binom_one\fi
- \ifnum #5>\xint_c_x^viii_mone \xint_dothis\XINT_FL_binom_outofrange\fi
+ \ifnum #5#6>\xint_c_x^viii_mone \xint_dothis\XINT_FL_binom_outofrange\fi
\ifnum #1#2>#3#4 \xint_dothis\XINT_FL_binom_ab \fi
\xint_orthat\XINT_FL_binom_aa
- #1#2.#3#4.#5.%
+ #1#2.#3#4.#5#6.%
}%
\def\XINT_FL_binom_outofrange #1.#2.#3.#4.#5%
{\xintError:OutOfRangeBinomial #5[#4]{0[0]}}%
-\def\XINT_FL_binom_one #1.#2.#3.#4.#5{#5[#4]{1[0]}}%
+\def\XINT_FL_binom_one #1.#2.#3.#4.#5{#5[#4]{1[0]}}%
+\def\XINT_FL_binom_zero #1.#2.#3.#4.#5{#5[#4]{0[0]}}%
\def\XINT_FL_binom_aa #1.#2.#3.#4.#5%
{%
#5[#4]{\xintDiv{\XINT_FL_pfac_increaseP