From cfa2367936c9c7cf864687e098482ca255082a90 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 25 Apr 2013 22:33:49 +0000
Subject: xint (25apr13)

git-svn-id: svn://tug.org/texlive/trunk@30107 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/xint/xintseries.sty | 178 ++++++++++++++++++----
 1 file changed, 152 insertions(+), 26 deletions(-)

(limited to 'Master/texmf-dist/tex/generic/xint/xintseries.sty')

diff --git a/Master/texmf-dist/tex/generic/xint/xintseries.sty b/Master/texmf-dist/tex/generic/xint/xintseries.sty
index 6cde51e7928..0412e9e17ef 100644
--- a/Master/texmf-dist/tex/generic/xint/xintseries.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintseries.sty
@@ -22,7 +22,7 @@
 %% in the same archive or directory.)
 %%
 %%----------------------------------------------------------------
-%% The xint bundle (version 1.03 of April 14, 2013)
+%% The xint bundle (version 1.04 of April 25, 2013)
 %% xintseries: Expandable partial sums with xint package
 %% Copyright (C) 2013 by Jean-Francois Burnol
 %%----------------------------------------------------------------
@@ -162,7 +162,7 @@
   \fi
 \expandafter\x\csname ver@xintseries.sty\endcsname
 \ProvidesPackage{xintseries}%
-  [2013/04/14 v1.03 Expandable partial sums with xint package (jfB)]%
+  [2013/04/25 v1.04 Expandable partial sums with xint package (jfB)]%
 \def\xintSeries {\romannumeral0\xintseries }%
 \def\xintseries #1#2%
 {%
@@ -254,38 +254,130 @@
       \xint@afterfi { 0[0]}%
    \else
       \xint@afterfi
-      {\expandafter\XINT@powseries@loop@pre\expandafter
-          {\romannumeral0\xintpow {#4}{#1}}{#1}{#4}{#2}{#3}%
-      }%
+      {\XINT@powseries@loop@i {#3{#2}}{#1}{#2}{#3}{#4}}%
    \fi
 }%
-\def\XINT@powseries@loop@pre #1#2#3#4#5%
-{%
-    \ifnum #4>#2 \else\XINT@powseries@dont@i \fi
-    \expandafter\XINT@powseries@loop@i\expandafter
-    {\the\numexpr #2+1\expandafter}\expandafter
-    {\romannumeral0\xintmul {#5{#2}}{#1}}{#1}{#3}{#4}{#5}%
-}%
-\def\XINT@powseries@dont@i \fi\expandafter\XINT@powseries@loop@i
-    {\fi \expandafter\XINT@powseries@dont@ii }%
-\def\XINT@powseries@dont@ii #1#2#3#4#5#6{ #2}%
 \def\XINT@powseries@loop@i #1#2#3#4#5%
 {%
-    \ifnum #5>#1 \else \XINT@powseries@exit@i \fi
+    \ifnum #3>#2 \else\XINT@powseries@exit@i\fi
     \expandafter\XINT@powseries@loop@ii\expandafter
-    {\romannumeral0\xintmul {#3}{#4}}{#1}{#4}{#2}{#5}%
+    {\the\numexpr #3-1\expandafter}\expandafter
+    {\romannumeral0\xintmul {#1}{#5}}{#2}{#4}{#5}%
 }%
-\def\XINT@powseries@loop@ii #1#2#3#4#5#6%
+\def\XINT@powseries@loop@ii #1#2#3#4%
 {%
-    \expandafter\XINT@powseries@loop@i\expandafter
-    {\the\numexpr #2+1\expandafter}\expandafter
-    {\romannumeral0\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
-    {#1}{#3}{#5}{#6}%
+   \expandafter\XINT@powseries@loop@i\expandafter
+   {\romannumeral0\xintadd {#4{#1}}{#2}}{#3}{#1}{#4}%
+}%
+\def\XINT@powseries@exit@i\fi #1#2#3#4#5#6#7#8#9%
+{%
+    \fi \XINT@powseries@exit@ii  #6{#7}%
 }%
-\def\XINT@powseries@exit@i\fi \expandafter\XINT@powseries@loop@ii
-   {\fi \expandafter\XINT@powseries@exit@ii }%
 \def\XINT@powseries@exit@ii #1#2#3#4#5#6%
-   {\xintadd {#4}{\xintMul {#6{#2}}{#1}}}%
+{%
+    \xintmul{\xintPow {#5}{#6}}{#4}%
+}%
+\def\xintPowerSeriesX {\romannumeral0\xintpowerseriesx }%
+\def\xintpowerseriesx #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@powseriesx@i
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@powseriesx@i #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@powseriesx@ii
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@powseriesx@ii #1#2#3#4%
+{%
+   \ifnum #2<#1
+      \xint@afterfi { 0[0]}%
+   \else
+      \xint@afterfi
+      {\expandafter\expandafter\expandafter\XINT@powseriesx@pre
+       \expandafter\expandafter\expandafter {#4}{#1}{#2}{#3}}%
+   \fi
+}%
+\def\XINT@powseriesx@pre #1#2#3#4%
+{%
+    \XINT@powseries@loop@i {#4{#3}}{#2}{#3}{#4}{#1}%
+}%
+\def\xintRationalSeries {\romannumeral0\xintratseries }%
+\def\xintratseries #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@ratseries@i
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@ratseries@i #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@ratseries@ii
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@ratseries@ii #1#2#3#4%
+{%
+   \ifnum #2<#1
+      \xint@afterfi { 0[0]}%
+   \else
+      \xint@afterfi
+      {\XINT@ratseries@loop {#2}{1}{#1}{#4}{#3}}%
+   \fi
+}%
+\def\XINT@ratseries@loop #1#2#3#4%
+{%
+    \ifnum #1>#3 \else\XINT@ratseries@exit@i\fi
+    \expandafter\XINT@ratseries@loop\expandafter
+    {\the\numexpr #1-1\expandafter}\expandafter
+    {\romannumeral0\xintadd {1}{\xintMul {#2}{#4{#1}}}}{#3}{#4}%
+}%
+\def\XINT@ratseries@exit@i\fi #1#2#3#4#5#6#7#8%
+{%
+    \fi \XINT@ratseries@exit@ii  #6%
+}%
+\def\XINT@ratseries@exit@ii #1#2#3#4#5%
+{%
+    \XINT@ratseries@exit@iii #5%
+}%
+\def\XINT@ratseries@exit@iii #1#2#3#4%
+{%
+    \xintmul{#2}{#4}%
+}%
+\def\xintRationalSeriesX {\romannumeral0\xintratseriesx }%
+\def\xintratseriesx #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@ratseriesx@i
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@ratseriesx@i #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@ratseriesx@ii
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@ratseriesx@ii #1#2#3#4#5%
+{%
+   \ifnum #2<#1
+      \xint@afterfi { 0[0]}%
+   \else
+      \xint@afterfi
+      {\expandafter\expandafter\expandafter\XINT@ratseriesx@pre
+       \expandafter\expandafter\expandafter {#5}{#2}{#1}{#4}{#3}}%
+   \fi
+}%
+\def\XINT@ratseriesx@pre #1#2#3#4#5%
+{%
+    \XINT@ratseries@loop {#2}{1}{#3}{#4{#1}}{#5{#1}}%
+}%
 \def\xintFxPtPowerSeries {\romannumeral0\xintfxptpowerseries }%
 \def\xintfxptpowerseries #1#2%
 {%
@@ -304,7 +396,7 @@
 \def\XINT@fppowseries@ii #1#2#3#4#5%
 {%
    \ifnum #2<#1
-      \xint@afterfi {\xinttrunc {#5}{0[0]}}%
+      \xint@afterfi { 0}%
    \else
       \xint@afterfi
         {\expandafter\XINT@fppowseries@loop@pre\expandafter
@@ -343,6 +435,40 @@
 \def\XINT@fppowseries@exit@ii #1#2#3#4#5#6#7%
    {\xinttrunc {#7}%
     {\xintiAdd {#4}{\xintiTrunc {#7}{\xintMul {#6{#2}}{#1}}}[-#7]}}%
+\def\xintFxPtPowerSeriesX {\romannumeral0\xintfxptpowerseriesx }%
+\def\xintfxptpowerseriesx #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@fppowseriesx@i
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@i #1#2%
+{%
+    \expandafter\expandafter\expandafter
+        \XINT@fppowseriesx@ii
+    \expandafter\expandafter\expandafter
+        {#2}{#1}%
+}%
+\def\XINT@fppowseriesx@ii #1#2#3#4#5%
+{%
+   \ifnum #2<#1
+      \xint@afterfi { 0}%
+   \else
+      \xint@afterfi
+        {\expandafter\expandafter\expandafter
+         \XINT@fppowseriesx@pre
+         \expandafter\expandafter\expandafter
+         {#4}{#1}{#2}{#3}{#5}%
+        }%
+   \fi
+}%
+\def\XINT@fppowseriesx@pre #1#2#3#4#5%
+{%
+    \expandafter\XINT@fppowseries@loop@pre\expandafter
+       {\romannumeral0\xinttrunc {#5}{\xintPow {#1}{#2}}}%
+       {#2}{#1}{#3}{#4}{#5}%
+}%
 \XINT@series@restorecatcodes@endinput%
 \endinput
 %%
-- 
cgit v1.2.3

