From 59d321e899ed5a0ba1607c5c2ffc39192feea615 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sat, 7 Jan 2017 23:38:44 +0000
Subject: xint (8jan17)

git-svn-id: svn://tug.org/texlive/trunk@42892 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/xint/xintfrac.sty | 581 +++++++++++-------------
 1 file changed, 274 insertions(+), 307 deletions(-)

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

diff --git a/Master/texmf-dist/tex/generic/xint/xintfrac.sty b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
index 7228abe0198..eed97cde276 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.2j 2016/12/22
-%% Copyright (C) 2013-2016 by Jean-Francois Burnol
+%% The xint bundle 1.2k 2017/01/06
+%% Copyright (C) 2013-2017 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}%
-  [2016/12/22 1.2j Expandable operations on fractions (JFB)]%
+  [2017/01/06 1.2k Expandable operations on fractions (JFB)]%
 \def\XINT_cntSgnFork #1%
 {%
     \ifcase #1\expandafter\xint_secondofthree
@@ -83,16 +83,16 @@
 {%
     \expandafter\XINT_flen\romannumeral0\XINT_infrac {#1}%
 }%
-\def\XINT_flen #1#2#3%
+\def\XINT_flen#1{\def\XINT_flen ##1##2##3%
 {%
-    \expandafter\space
-    \the\numexpr \XINT_abs#1+\XINT_length_loop
-    #2#3\xint_relax\xint_relax\xint_relax\xint_relax
+    \expandafter#1%
+    \the\numexpr \XINT_abs##1+%
+    \XINT_len_fork ##2##3\xint_relax\xint_relax\xint_relax\xint_relax
       \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
       \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
       \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-\xint_c_i
     \relax
-}%
+}}\XINT_flen{ }%
 \def\XINT_outfrac #1#2#3%
 {%
     \ifcase\XINT_cntSgn #3\Z
@@ -733,7 +733,7 @@
 \def\XINT_trunc_a #1#2#3#4.#5%
 {%
     \if0\XINT_Sgn#2\Z\xint_dothis\XINT_trunc_zero\fi
-    \if1\XINT_iSone#3XY\xint_dothis\XINT_trunc_sp_b\fi
+    \if1\XINT_is_one#3XY\xint_dothis\XINT_trunc_sp_b\fi
     \xint_orthat\XINT_trunc_b #1+#4.{#2}{#3}#5#4.%
 }%
 \def\XINT_trunc_zero #1.#2.{ 0}%
@@ -852,7 +852,7 @@
 \def\XINT_round_a #1#2#3#4.%
 {%
     \if0\XINT_Sgn#2\Z\xint_dothis\XINT_trunc_zero\fi
-    \if1\XINT_iSone#3XY\xint_dothis\XINT_trunc_sp_b\fi
+    \if1\XINT_is_one#3XY\xint_dothis\XINT_trunc_sp_b\fi
     \xint_orthat\XINT_trunc_b #1+#4.{#2}{#3}%
 }%
 \def\XINT_round_A{\expandafter\XINT_trunc_G\romannumeral0\XINT_round_B}%
@@ -1659,176 +1659,33 @@
 }%
 \def\XINT_float_noopt #1\xint_relax
 {%
-    \expandafter\XINT_float_a\expandafter\XINTdigits\expandafter.%
-    \romannumeral0\XINT_infrac {#1}\XINT_float_Q
-}%
-\def\XINT_float_opt [\xint_relax #1]#2%
-{%
-    \expandafter\XINT_float_a\the\numexpr #1\expandafter.%
-    \romannumeral0\XINT_infrac {#2}\XINT_float_Q
-}%
-\def\XINT_float_a #1.#2#3#4%
-{%
-    \if1\XINT_iSone#4XY\expandafter\XINT_float_sp
-    \else\expandafter\XINT_float_fork\fi #3.{#1}{#2}{#4}%
+    \expandafter\XINT_float_post
+    \romannumeral0\XINTinfloat[\XINTdigits]{#1}\XINTdigits.%
 }%
-\def\XINT_float_sp #1%
+\def\XINT_float_opt [\xint_relax #1]%
 {%
-    \xint_UDzerominusfork
-     #1-\XINT_float_spzero
-     0#1\XINT_float_spneg
-      0-{\XINT_float_sppos #1}%
-    \krof
+    \expandafter\XINT_float_opt_a\the\numexpr #1.%
 }%
-\def\XINT_float_spzero .#1#2#3#4{ 0.e0}%
-\def\XINT_float_spneg {\expandafter-\romannumeral0\XINT_float_sppos}%
-\def\XINT_float_sppos #1.#2#3#4#5%
+\def\XINT_float_opt_a #1.#2%
 {%
-    \expandafter\XINT_float_sp_b\the\numexpr#2-\xintLength{#1}.#1.#2.#3.%
+    \expandafter\XINT_float_post
+    \romannumeral0\XINTinfloat[#1]{#2}#1.%
 }%
-\def\XINT_float_sp_b #1%
+\def\XINT_float_post #1%
 {%
     \xint_UDzerominusfork
-     #1-\XINT_float_sp_quick
-     0#1\XINT_float_sp_c
-      0-{\XINT_float_sp_addzeros #1}%
-    \krof
-}%
-\def\XINT_float_sp_quick .#1.#2.#3.%
-{%
-    \expandafter\XINT_float_sp_done\the\numexpr #3+#2-\xint_c_i.#1;%
-}%
-\def\XINT_float_sp_addzeros #1.#2.#3.#4.%
-{%
-    \expandafter\XINT_float_sp_done
-    \the\numexpr #4-#1+#3-\xint_c_i\expandafter.%
-    \romannumeral0\XINT_dsx_addzeros {#1}#2;;%
-}%
-\def\XINT_float_sp_done #1.#2#3;{ #2.#3e#1}%
-\def\XINT_float_sp_c #1.#2%
-{%
-    \if #29\xint_dothis {\XINT_float_sp_d\XINT_float_Wb }\fi
-           \xint_orthat {\XINT_float_sp_d\XINT_float_Wa }#1.#2%
-}%
-\def\XINT_float_sp_d #1#2.#3.#4.#5.%
-{%
-    \expandafter\XINT_float_sp_e
-    \the\numexpr #5+#2+#4-\xint_c_i\expandafter.%
-    \romannumeral0\XINT_split_fromleft
-    (\xint_c_i+#4).#3\xint_bye2345678\xint_bye..#1%
-}%
-\def\XINT_float_sp_e #1.#2.#3.#4%
-{%
-    \expandafter#4\romannumeral0\XINT_dsrr#2%
-    \xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax e#1%
-}%
-\def\XINT_float_fork #1%
-{%
-    \xint_UDsignfork
-     #1\XINT_float_J
-     -{\XINT_float_K #1}%
-    \krof
-}%
-\def\XINT_float_J {\expandafter-\romannumeral0\XINT_float_K }%
-\def\XINT_float_K #1.#2%
-{%
-    \expandafter\XINT_float_L
-    \the\numexpr\xintLength{#1}\expandafter.\the\numexpr #2+\xint_c_ii.{#1}{#2}%
-}%
-\def\XINT_float_L #1.#2.%
-{%
-    \ifnum #1>#2
-      \expandafter\XINT_float_Ma
-    \else
-      \expandafter\XINT_float_Mb
-    \fi #1.#2.%
-}%
-\def\XINT_float_Ma #1.#2.#3%
-{%
-    \expandafter\XINT_float_MatoN
-    \the\numexpr #1-#2\expandafter.%
-    \romannumeral0\XINT_split_fromleft#2.#3\xint_bye2345678\xint_bye..{#2}%
-}%
-\def\XINT_float_MatoN #1.#2.#3.#4#5#6#7%
-{%
-   \expandafter\XINT_float_N
-   \the\numexpr\xintLength{#7}\expandafter.\the\numexpr #1+#6.#4.%
-   {#7}{#4}{#2}{#5}%
-}%
-\def\XINT_float_Mb #1.#2.#3#4#5#6%
-{%
-   \expandafter\XINT_float_N
-   \romannumeral0\xintlength{#6}.#5.#2.{#6}{#1}{#3}{#4}%
-}%
-\def\XINT_float_N #1.#2.#3.%
-{%
-    \ifnum #1>#3
-         \expandafter\XINT_float_N_Blong
-    \else\expandafter\XINT_float_P\fi
-    #1.#2.#3.%
-}%
-\def\XINT_float_N_Blong #1.#2.#3.#4%
-{%
-    \expandafter\XINT_float_NaP
-    \the\numexpr #2-#1+#3\expandafter.%
-    \romannumeral0\XINT_split_fromleft#3.#4\xint_bye2345678\xint_bye..{#3}%
-}%
-\def\XINT_float_NaP #1.#2.#3.#4{\XINT_float_P #4.#1.#4.{#2}}%
-\def\XINT_float_P #1.#2.#3.#4#5#6#7#8%
-{%
-    \expandafter #8\the\numexpr #1-#5+#3-\xint_c_i.{#6}{#4}{#7}{#2}%
-}%
-\def\XINT_float_Q #1.#2#3%
-{%
-    \expandafter\XINT_float_Sa
-    \romannumeral0\xintiiquo{\XINT_dsx_addzeros {#1}#2;}{#3}\Z {#1}%
-}%
-\def\XINT_float_Sa #1%
-{%
-    \if #19\xint_dothis {\XINT_float_Sb\XINT_float_Wb }\fi
-           \xint_orthat {\XINT_float_Sb\XINT_float_Wa }#1%
-}%
-\def\XINT_float_Sb #1#2\Z #3#4%
-{%
-    \expandafter\XINT_float_T
-    \the\numexpr\XINT_length_loop
-    #2\xint_relax\xint_relax\xint_relax\xint_relax
-      \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
-      \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
-      \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
-    {#2}#1{#3}{#4}%
-}%
-\def\XINT_float_T #1.%
-{%
-    \if2#1\expandafter\XINT_float_Ub\else\expandafter\XINT_float_Ua\fi
-}%
-\def\XINT_float_Ua #1#2%
-{%
-    \expandafter\XINT_float_Xa
-    \romannumeral0\expandafter#2%
-    \romannumeral0\XINT_dsrr
-    #1\xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax;%
-}%
-\def\XINT_float_Ub #1#2%
-{%
-    \expandafter\XINT_float_Xb
-    \romannumeral0\expandafter#2%
-    \romannumeral0\expandafter\XINT_dsrr
-    \romannumeral0\XINT_dsr
-    #1\xint_bye\xint_Bye3456789\xint_bye+\xint_c_v)/\xint_c_x-\xint_c_i\relax
-    \xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax;%
-}%
-\def\XINT_float_Wa #1{ #1.}%
-\def\XINT_float_Wb #1#2{\if #11\xint_dothis{ 10.}\fi\xint_orthat{ #1.#2}}%
-\def\XINT_float_Xa #1;#2#3#4%
-{%
-    \expandafter\XINT_float_Y\the\numexpr #3+#4-#2.{#1}%
-}%
-\def\XINT_float_Xb #1;#2#3#4%
+      #1-\XINT_float_zero
+       0#1\XINT_float_neg
+       0-\XINT_float_pos
+    \krof #1%
+}%[
+\def\XINT_float_zero #1]#2.{ 0.e0}%
+\def\XINT_float_neg-{\expandafter-\romannumeral0\XINT_float_pos}%
+\def\XINT_float_pos #1#2[#3]#4.%
 {%
-    \expandafter\XINT_float_Y\the\numexpr #3+#4+\xint_c_i-#2.{#1}%
+    \expandafter\XINT_float_pos_done\the\numexpr#3+#4-\xint_c_i.#1.#2;%
 }%
-\def\XINT_float_Y #1.#2{ #2e#1}%
+\def\XINT_float_pos_done #1.#2;{ #2e#1}%
 \def\XINTinFloat {\romannumeral0\XINTinfloat }%
 \def\XINTinfloat
    {\expandafter\XINT_infloat_clean\romannumeral0\XINT_infloat}%
@@ -1850,28 +1707,30 @@
 \def\XINT_infloat [#1]#2%
 {%
     \expandafter\XINT_infloat_a\the\numexpr #1\expandafter.%
-    \romannumeral0\XINT_infrac {#2}\XINT_infloat_Q
+    \romannumeral0\XINT_infrac {#2}%
 }%
 \def\XINT_infloat_a #1.#2#3#4%
 {%
-    \if1\XINT_iSone#4XY\expandafter\XINT_infloat_sp
-    \else\expandafter\XINT_float_fork\fi #3.{#1}{#2}{#4}%
+    \if1\XINT_is_one#4XY%
+      \expandafter\XINT_infloat_sp
+    \else\expandafter\XINT_infloat_fork
+    \fi #3.{#1}{#2}{#4}%
 }%
 \def\XINT_infloat_sp #1%
 {%
     \xint_UDzerominusfork
      #1-\XINT_infloat_spzero
      0#1\XINT_infloat_spneg
-      0-{\XINT_infloat_sppos #1}%
-    \krof
+      0-\XINT_infloat_sppos
+    \krof #1%
 }%
-\def\XINT_infloat_spzero .#1#2#3#4{ 0[0]}%
-\def\XINT_infloat_spneg
+\def\XINT_infloat_spzero 0.#1#2#3{ 0[0]}%
+\def\XINT_infloat_spneg-%
     {\expandafter\XINT_infloat_spnegend\romannumeral0\XINT_infloat_sppos}%
 \def\XINT_infloat_spnegend #1%
     {\if#1!\expandafter\XINT_infloat_spneg_needzeros\fi -#1}%
 \def\XINT_infloat_spneg_needzeros -!#1.{!#1.-}%
-\def\XINT_infloat_sppos #1.#2#3#4#5%
+\def\XINT_infloat_sppos #1.#2#3#4%
 {%
     \expandafter\XINT_infloat_sp_b\the\numexpr#2-\xintLength{#1}.#1.#2.#3.%
 }%
@@ -1880,70 +1739,154 @@
     \xint_UDzerominusfork
      #1-\XINT_infloat_sp_quick
      0#1\XINT_infloat_sp_c
-      0-{\XINT_infloat_sp_needzeros #1}%
-    \krof
+      0-\XINT_infloat_sp_needzeros
+    \krof #1%
 }%
-\def\XINT_infloat_sp_quick .#1.#2.#3.{ #1[#3]}%
+\def\XINT_infloat_sp_quick 0.#1.#2.#3.{ #1[#3]}%
 \def\XINT_infloat_sp_needzeros #1.#2.#3.#4.{!#1.#2[#4]}%
-\def\XINT_infloat_sp_c #1.#2%
+\def\XINT_infloat_sp_c -#1.#2#3.#4.#5.%
 {%
-    \if #29\xint_dothis {\XINT_infloat_sp_d\XINT_infloat_Wb }\fi
-           \xint_orthat {\XINT_infloat_sp_d .}#1.#2%
+    \expandafter\XINT_infloat_Y
+    \the\numexpr #5+#1\expandafter.%
+    \romannumeral0\expandafter\XINT_infloat_sp_round
+    \romannumeral0\XINT_split_fromleft
+    (\xint_c_i+#4).#2#3\xint_bye2345678\xint_bye..#2%
 }%
-\def\XINT_infloat_sp_d #1#2.#3.#4.%#5.%
+\def\XINT_infloat_sp_round #1.#2.%
 {%
-    \expandafter\XINT_infloat_sp_e
-    \romannumeral0\XINT_split_fromleft
-    (\xint_c_i+#4).#3\xint_bye2345678\xint_bye..#1#2.%
+    \XINT_dsrr#1\xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax.%
 }%
-\def\XINT_infloat_sp_e #1.#2.#3#4.#5.%
+\def\XINT_infloat_fork #1%
 {%
-    \expandafter\XINT_infloat_done
-    \the\numexpr#4+#5\expandafter#3\romannumeral0\XINT_dsrr
-    #1\xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax;%
+    \xint_UDsignfork
+     #1\XINT_infloat_J
+     -\XINT_infloat_K
+    \krof #1%
 }%
-\def\XINT_infloat_Q #1.#2#3%
+\def\XINT_infloat_J-{\expandafter-\romannumeral0\XINT_infloat_K }%
+\def\XINT_infloat_K #1.#2%
 {%
-    \expandafter\XINT_infloat_Sa
-    \romannumeral0\xintiiquo{\XINT_dsx_addzeros {#1}#2;}{#3}\Z {#1}%
+    \expandafter\XINT_infloat_L
+    \the\numexpr\xintLength{#1}\expandafter.\the\numexpr #2+\xint_c_iv.{#1}{#2}%
 }%
-\def\XINT_infloat_Sa #1%
+\def\XINT_infloat_L #1.#2.%
 {%
-    \if #19\xint_dothis {\XINT_infloat_Sb\XINT_infloat_Wb }\fi
-           \xint_orthat {\XINT_infloat_Sb .}#1%
+    \ifnum #1>#2
+      \expandafter\XINT_infloat_Ma
+    \else
+      \expandafter\XINT_infloat_Mb
+    \fi #1.#2.%
 }%
-\def\XINT_infloat_Sb #1#2\Z #3#4%
+\def\XINT_infloat_Ma #1.#2.#3%
 {%
-    \expandafter\XINT_infloat_T
-    \the\numexpr\XINT_length_loop
-    #2\xint_relax\xint_relax\xint_relax\xint_relax
-      \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
-      \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
-      \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye-#4.%
-    {#2}#1{#3}%
+    \expandafter\XINT_infloat_MtoN\expandafter-\expandafter0\expandafter.%
+    \romannumeral0\XINT_split_fromleft#2.#3\xint_bye2345678\xint_bye..%
+    #2.#1.{#3}%
 }%
-\def\XINT_infloat_T #1.%
+\def\XINT_infloat_Mb #1.#2.#3%
 {%
-    \if2#1\expandafter\XINT_infloat_Ub\else\expandafter\XINT_infloat_Ua\fi
+    \expandafter\XINT_infloat_MtoN\the\numexpr#2-#1.%
+    #3..#2.#1.{#3}%
 }%
-\def\XINT_infloat_Ua #1#2#3#4%
+\def\XINT_infloat_MtoN #1.#2.#3.#4.#5.#6#7#8#9%
 {%
-    \expandafter\XINT_infloat_done
-    \the\numexpr\xint_c_i+#4-#3\romannumeral0\expandafter#2%
-    \romannumeral0\XINT_dsrr
-    #1\xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax;%
+   \expandafter\XINT_infloat_N
+   \the\numexpr\xintLength{#9}.#4.{#9}#1.#2.#7.#5.#8.{#6}{#9}%
 }%
-\def\XINT_infloat_Ub #1#2#3#4%
+\def\XINT_infloat_N #1.#2.%
 {%
-    \expandafter\XINT_infloat_done
-    \the\numexpr\xint_c_ii+#4-#3\romannumeral0\expandafter#2%
-    \romannumeral0\expandafter\XINT_dsrr
-    \romannumeral0\XINT_dsr
-    #1\xint_bye\xint_Bye3456789\xint_bye+\xint_c_v)/\xint_c_x-\xint_c_i\relax
-    \xint_bye\xint_Bye3456789\xint_bye/\xint_c_x\relax;%
-}%
-\def\XINT_infloat_Wb #1#2%
-    {\if #11\xint_dothis{+\xint_c_i.1}\fi\xint_orthat{.#1#2}}%
+    \ifnum #1>#2
+      \expandafter\XINT_infloat_Oa
+    \else
+      \expandafter\XINT_infloat_Ob
+    \fi #1.#2.%
+}%
+\def\XINT_infloat_Oa #1.#2.#3%
+{%
+    \expandafter\XINT_infloat_P\expandafter-\expandafter0\expandafter.%
+    \romannumeral0\XINT_split_fromleft#2.#3\xint_bye2345678\xint_bye..%
+    #1.%
+}%
+\def\XINT_infloat_Ob #1.#2.#3%
+{%
+    \expandafter\XINT_infloat_P\the\numexpr#2-#1.#3..#1.%
+}%
+\def\XINT_infloat_P #1#2.#3.#4.#5.#6#7.#8.#9.%
+{%
+   \csname XINT_infloat_Q\if-#1\else\if-#6\else q\fi\fi\expandafter\endcsname
+   \romannumeral0\xintiiquo
+   {\romannumeral0\XINT_dsx_addzerosnofuss
+      {#6#7-#1#2+#9+\xint_c_iii\if-#1\else\if-#6\else-\xint_c_ii\fi\fi}#8;}%
+   {#3}.#9.#5.%
+}%
+\def\XINT_infloat_Qq #1.#2.%
+{%
+    \expandafter\XINT_infloat_Rq
+    \romannumeral0\XINT_split_fromleft#2.#1\xint_bye2345678\xint_bye..#2.%
+}%
+\def\XINT_infloat_Rq #1.#2#3.%
+{%
+    \ifnum#2<\xint_c_v
+         \expandafter\XINT_infloat_SEq
+    \else\expandafter\XINT_infloat_SUp
+    \fi
+    {\if.#3.\xint_c_\else\xint_c_i\fi}#1.%
+}%
+\def\XINT_infloat_Q #1.#2.%
+{%
+    \expandafter\XINT_infloat_R
+    \romannumeral0\XINT_split_fromleft#2.#1\xint_bye2345678\xint_bye..#2.%
+}%
+\def\XINT_infloat_R #1.#2#3#4#5.%
+{%
+    \if.#5.\expandafter\XINT_infloat_Sa\else\expandafter\XINT_infloat_Sb\fi
+    #2#3#4#5.#1.%
+}%
+\def\XINT_infloat_Sa #1.%
+{%
+    \ifnum#1>500 \xint_dothis\XINT_infloat_SUp\fi
+    \ifnum#1<499 \xint_dothis\XINT_infloat_SEq\fi
+    \xint_orthat\XINT_infloat_X\xint_c_
+}%
+\def\XINT_infloat_Sb #1.%
+{%
+    \ifnum#1>5009 \xint_dothis\XINT_infloat_SUp\fi
+    \ifnum#1<4990 \xint_dothis\XINT_infloat_SEq\fi
+    \xint_orthat\XINT_infloat_X\xint_c_i
+}%
+\def\XINT_infloat_SEq #1#2.#3.#4.#5.#6.#7#8%
+{%
+    \expandafter\XINT_infloat_SY
+    \the\numexpr #6+#5-#4-#3+#1.#2.%
+}%
+\def\XINT_infloat_SY #1.#2.{ #2[#1]}%
+\def\XINT_infloat_SUp #1#2#3.#4.#5.#6.#7.#8#9%
+{%
+    \expandafter\XINT_infloat_Y
+    \the\numexpr#7+#6-#5-#4+#1\expandafter.%
+    \romannumeral0\xintinc{#2#3}.#2%
+}%
+\def\XINT_infloat_X #1#2#3.#4.#5.#6.#7.#8#9%
+{%
+   \expandafter\XINT_infloat_Y
+   \the\numexpr #7+#6-#5-#4+#1\expandafter.%
+   \romannumeral`&&@\romannumeral0\xintiiiflt
+     {\xintDSH{#6-#5-#4+#1}{\xintDouble{#8}}}%
+     {\xintiiMul{\xintInc{\xintDouble{#2#3}}}{#9}}%
+   \xint_firstofone
+   \xintinc{#2#3}.#2%
+}%
+\def\XINT_infloat_Y #1{%
+\def\XINT_infloat_Y ##1.##2##3.##4%
+{%
+   \if##49\if##21\expandafter\expandafter\expandafter\XINT_infloat_Z\fi\fi
+   #1##2##3[##1]%
+}}\XINT_infloat_Y{ }%
+\def\XINT_infloat_Z #1#2#3[#4]%
+{%
+    \expandafter\XINT_infloat_ZZ\the\numexpr#4+\xint_c_i.#3.%
+}%
+\def\XINT_infloat_ZZ #1.#2.{ 1#2[#1]}%
 \def\xintPFloat   {\romannumeral0\xintpfloat }%
 \def\xintpfloat #1{\XINT_pfloat_chkopt #1\xint_relax }%
 \def\XINT_pfloat_chkopt #1%
@@ -1957,7 +1900,7 @@
     \expandafter\XINT_pfloat_a
     \romannumeral0\xintfloat [\XINTdigits]{#1};\XINTdigits.%
 }%
-\def\XINT_pfloat_opt [\xint_relax #1]%#2%
+\def\XINT_pfloat_opt [\xint_relax #1]%
 {%
     \expandafter\XINT_pfloat_opt_a \the\numexpr #1.%
 }%
@@ -1970,48 +1913,48 @@
     \xint_UDzerominusfork
         #1-\XINT_pfloat_zero
         0#1\XINT_pfloat_neg
-        0-{\XINT_pfloat_pos #1}%
-    \krof
+        0-\XINT_pfloat_pos
+    \krof #1%
 }%
 \def\XINT_pfloat_zero #1;#2.{ 0.}%
-\def\XINT_pfloat_neg {\expandafter-\romannumeral0\XINT_pfloat_pos }%
-\def\XINT_pfloat_pos #1e#2;#3.%
-{%
-    \ifnum #2>\xint_c_v  \xint_dothis\XINT_pfloat_no\fi
-    \ifnum #2<-\xint_c_v \xint_dothis\XINT_pfloat_no\fi
-    \ifnum #2<\xint_c_   \xint_dothis\XINT_pfloat_N\fi
-    \ifnum #2>\numexpr #3-\xint_c_i\relax \xint_dothis\XINT_pfloat_Ps\fi
-    \xint_orthat\XINT_pfloat_P #1e#2;%
-}%
-\def\XINT_pfloat_no #1;{ #1}%
-\def\XINT_pfloat_N #1#2.#3e#4;%
-{%
-    \csname XINT_pfloat_N\romannumeral-#4\endcsname #2#10.#3;%
-}%
-\def\XINT_pfloat_Ni  #1#2#3.#4;{ #2.#1#4}%
-\def\XINT_pfloat_Nii #1#2#3.#4;{ 0.#2#1#4}%
-\def\XINT_pfloat_Niii#1#2#3.#4;{ 0.0#2#1#4}%
-\def\XINT_pfloat_Niv #1#2#3.#4;{ 0.00#2#1#4}%
-\def\XINT_pfloat_Nv  #1#2#3.#4;{ 0.000#2#1#4}%
-\def\XINT_pfloat_P #1#2.#3e#4;%
-{%
-    \csname XINT_pfloat_P_\romannumeral#4\endcsname #3.#1#2;%
-}%
-\def\XINT_pfloat_P_   #1.#2;{ #2.#1}%
-\def\XINT_pfloat_P_i  #1#2.#3;{ #3#1.#2}%
-\def\XINT_pfloat_P_ii #1#2#3.#4;{ #4#1#2.#3}%
-\def\XINT_pfloat_P_iii#1#2#3#4.#5;{ #5#1#2#3.#4}%
-\def\XINT_pfloat_P_iv #1#2#3#4#5.#6;{ #6#1#2#3#4.#5}%
-\def\XINT_pfloat_P_v  #1#2#3#4#5#6.#7;{ #7#1#2#3#4#5.#6}%
-\def\XINT_pfloat_Ps #1#2.#3e#4;%
-{%
-    \csname XINT_pfloat_Ps\romannumeral#4\endcsname #300000.#1#2;%
-}%
-\def\XINT_pfloat_Psi  #1#2.#3;{ #3#1.}%
-\def\XINT_pfloat_Psii #1#2#3.#4;{ #4#1#2.}%
-\def\XINT_pfloat_Psiii#1#2#3#4.#5;{ #5#1#2#3.}%
-\def\XINT_pfloat_Psiv #1#2#3#4#5.#6;{ #6#1#2#3#4.}%
-\def\XINT_pfloat_Psv  #1#2#3#4#5#6.#7;{ #7#1#2#3#4#5.}%
+\def\XINT_pfloat_neg-{\expandafter-\romannumeral0\XINT_pfloat_pos }%
+\def\XINT_pfloat_pos #1.#2e#3;#4.%
+{%
+    \ifnum #3>\xint_c_v  \xint_dothis\XINT_pfloat_no\fi
+    \ifnum #3<-\xint_c_v \xint_dothis\XINT_pfloat_no\fi
+    \ifnum #3<\xint_c_   \xint_dothis\XINT_pfloat_N\fi
+    \ifnum #3>\numexpr #4-\xint_c_i\relax \xint_dothis\XINT_pfloat_Ps\fi
+    \xint_orthat\XINT_pfloat_P #1#2e#3;%
+}%
+\def\XINT_pfloat_no #1#2;{ #1.#2}%
+\def\XINT_pfloat_N #1e-#2;%
+{%
+    \csname XINT_pfloat_N_\romannumeral#2\endcsname #1%
+}%
+\def\XINT_pfloat_N_i  { 0.}%
+\def\XINT_pfloat_N_ii { 0.0}%
+\def\XINT_pfloat_N_iii{ 0.00}%
+\def\XINT_pfloat_N_iv { 0.000}%
+\def\XINT_pfloat_N_v  { 0.0000}%
+\def\XINT_pfloat_P #1e#2;%
+{%
+    \csname XINT_pfloat_P_\romannumeral#2\endcsname #1%
+}%
+\def\XINT_pfloat_P_   #1{ #1.}%
+\def\XINT_pfloat_P_i  #1#2{ #1#2.}%
+\def\XINT_pfloat_P_ii #1#2#3{ #1#2#3.}%
+\def\XINT_pfloat_P_iii#1#2#3#4{ #1#2#3#4.}%
+\def\XINT_pfloat_P_iv #1#2#3#4#5{ #1#2#3#4#5.}%
+\def\XINT_pfloat_P_v  #1#2#3#4#5#6{ #1#2#3#4#5#6.}%
+\def\XINT_pfloat_Ps #1e#2;%
+{%
+    \csname XINT_pfloat_Ps\romannumeral#2\endcsname #100000;%
+}%
+\def\XINT_pfloat_Psi  #1#2#3;{ #1#2.}%
+\def\XINT_pfloat_Psii #1#2#3#4;{ #1#2#3.}%
+\def\XINT_pfloat_Psiii#1#2#3#4#5;{ #1#2#3#4.}%
+\def\XINT_pfloat_Psiv #1#2#3#4#5#6;{ #1#2#3#4#5.}%
+\def\XINT_pfloat_Psv  #1#2#3#4#5#6#7;{ #1#2#3#4#5#6.}%
 \def\XINTinFloatFracdigits {\romannumeral0\XINTinfloatfracdigits }%
 \def\XINTinfloatfracdigits #1%
 {%
@@ -2046,7 +1989,7 @@
 {%
     \xint_gob_til_zero #1\XINT_FL_add_zero 0\XINT_FL_add_b #1%
 }%
-\def\XINT_FL_add_zero #1.#2{#2}%
+\def\XINT_FL_add_zero #1.#2{#2}%[[
 \def\XINT_FL_add_b #1]#2.#3%
 {%
     \expandafter\XINT_FL_add_c\romannumeral0\XINTinfloat[#2]{#3}#2.#1]%
@@ -2113,7 +2056,7 @@
 {%
     \expandafter\XINT_FL_mul_b\romannumeral0\XINTinfloatS[#3]{#4}#1[#2]%
 }%
-\def\XINT_FL_mul_b #1[#2]#3[#4]{\xintE{\xintiiMul {#3}{#1}}{#4+#2}}%
+\def\XINT_FL_mul_b #1[#2]#3[#4]{\xintiiMul{#3}{#1}/1[#4+#2]}%
 \def\xintFloatDiv   {\romannumeral0\xintfloatdiv   }%
 \def\xintfloatdiv   #1{\XINT_fldiv_chkopt \xintfloat #1\xint_relax }%
 \def\XINTinFloatDiv {\romannumeral0\XINTinfloatdiv }%
@@ -2128,7 +2071,7 @@
 {%
     #1[\XINTdigits]%
     {\expandafter\XINT_FL_div_a
-     \romannumeral0\XINTinfloatS[\XINTdigits]{#2}\XINTdigits.{#3}}%
+     \romannumeral0\XINTinfloatS[\XINTdigits]{#3}\XINTdigits.{#2}}%
 }%
 \def\XINT_fldiv_opt #1[\xint_relax #2]%#3#4%
 {%
@@ -2136,13 +2079,13 @@
 }%
 \def\XINT_fldiv_opt_a #1.#2#3#4%
 {%
-    #2[#1]{\expandafter\XINT_FL_div_a\romannumeral0\XINTinfloatS[#1]{#3}#1.{#4}}%
+    #2[#1]{\expandafter\XINT_FL_div_a\romannumeral0\XINTinfloatS[#1]{#4}#1.{#3}}%
 }%
 \def\XINT_FL_div_a #1[#2]#3.#4%
 {%
-    \expandafter\XINT_FL_div_b\romannumeral0\XINTinfloatS[#3]{#4}#1[#2]%
+    \expandafter\XINT_FL_div_b\romannumeral0\XINTinfloatS[#3]{#4}/#1e#2%
 }%
-\def\XINT_FL_div_b #1[#2]#3[#4]{\xintE{#3/#1}{#4-#2}}%
+\def\XINT_FL_div_b #1[#2]{#1e#2}%
 \def\xintFloatPow   {\romannumeral0\xintfloatpow}%
 \def\xintfloatpow #1{\XINT_flpow_chkopt \xintfloat #1\xint_relax }%
 \def\XINTinFloatPow {\romannumeral0\XINTinfloatpow }%
@@ -2290,7 +2233,7 @@
 {%
     \expandafter\XINT_flpow_IIIend
     \xint_UDsignfork
-        #5{{\xintNum{1/#3[\xint_c_ii*#4-\xint_c_i]}[\xint_c_i-\xint_c_ii*#4-#2]}}%
+         #5{{1/#3[-#2]}}%
          -{{#3[#2]}}%
     \krof #1%
 }%
@@ -2300,34 +2243,43 @@
 \def\xintfloatpower #1{\XINT_flpower_chkopt \xintfloat #1\xint_relax }%
 \def\XINTinFloatPower {\romannumeral0\XINTinfloatpower }%
 \def\XINTinfloatpower #1{\XINT_flpower_chkopt \XINTinfloatS #1\xint_relax }%
-\def\XINTinFloatPowerH {\romannumeral0\XINTinfloatpowerH }%
-\def\XINTinfloatpowerH #1#2%
-   {\expandafter\XINT_flpowerh_a \romannumeral0\xinttrunc 1{#2}.0;%
-    \XINTdigits.{#1}{\XINTinfloatS[\XINTdigits]}}%
-\def\XINT_flpowerh_a #1.#2%
+\def\XINTinFloatPowerH {\romannumeral0\XINTinfloatpowerh }%
+\def\XINTinfloatpowerh #1#2%
+{%
+    \expandafter\XINT_flpowerh_a\romannumeral0\xintitrunc1{#2};%
+    \XINTdigits.{#1}{\XINTinfloatS[\XINTdigits]}%
+}%
+\def\XINT_flpowerh_a #1;%
 {%
-    \ifnum#2>\xint_c_iv\xint_dothis\XINT_flpowerh_b\fi
-    \xint_orthat\XINT_flpowerh_i #1.#2%
+    \if0\xintiiLDg{#1}\expandafter\XINT_flpowerh_int
+        \else\expandafter\XINT_flpowerh_b
+    \fi #1.%
 }%
-\def\XINT_flpowerh_i #1.#2;%
-   {\expandafter\XINT_flpower_checkB_a\romannumeral0\xintinum{#1}.}%
-\def\XINT_flpowerh_b #1%
+\def\XINT_flpowerh_int #1%
 {%
-    \if#1-\xint_dothis\XINT_flpowerh_bneg\fi
-          \xint_orthat{\XINT_flpowerh_bpos #1}%
+    \if0#1\expandafter\XINT_flpower_BisZero
+     \else\expandafter\XINT_flpowerh_i
+    \fi #1%
 }%
-\def\XINT_flpowerh_bpos #1.#2;\XINTdigits.#3#4%
+\def\XINT_flpowerh_i #10.{\expandafter\XINT_flpower_checkB_a#1.}%
+\def\XINT_flpowerh_b #1.%
 {%
-    \expandafter\XINT_flpower_checkB_a
-    \romannumeral0\xintinc{\xintDouble{#1}}.%
-    \XINTdigits.{#3}{\XINTinfloatsqrt[\XINTdigits]}%
+   \expandafter\XINT_flpowerh_c\romannumeral0\xintdsrr{\xintDouble{#1}}.%
 }%
-\def\XINT_flpowerh_bneg #1.#2;\XINTdigits.#3#4%
+\def\XINT_flpowerh_c #1.%
 {%
-    \expandafter\XINT_flpower_checkB_a
-    \expandafter-\romannumeral0\xintinc{\xintDouble{#1}}.%
-    \XINTdigits.{#3}{\XINTinfloatsqrt[\XINTdigits]}%
+    \ifodd\xintiiLDg{#1} %<- intentional space
+        \expandafter\XINT_flpowerh_d\else\expandafter\XINT_flpowerh_e
+    \fi #1.%
 }%
+\def\XINT_flpowerh_d #1.\XINTdigits.#2#3%
+{%
+   \XINT_flpower_checkB_a #1.\XINTdigits.{#2}\XINT_flpowerh_finish
+}%
+\def\XINT_flpowerh_finish #1%
+   {\XINTinfloatS[\XINTdigits]{\XINTinFloatSqrt[\XINTdigits+\xint_c_iii]{#1}}}%
+\def\XINT_flpowerh_e #1.%
+   {\expandafter\XINT_flpower_checkB_a\romannumeral0\xinthalf{#1}.}%
 \def\XINT_flpower_chkopt #1#2%
 {%
     \ifx [#2\expandafter\XINT_flpower_opt
@@ -2352,12 +2304,12 @@
 \def\XINT_flpower_checkB_a #1%
 {%
     \xint_UDzerominusfork
-      #1-\XINT_flpower_BisZero
+      #1-{\XINT_flpower_BisZero 0}%
       0#1{\XINT_flpower_checkB_b -}%
        0-{\XINT_flpower_checkB_b {}#1}%
     \krof
 }%
-\def\XINT_flpower_BisZero .#1.#2#3{#3{1[0]}}%
+\def\XINT_flpower_BisZero 0.#1.#2#3{#3{1[0]}}%
 \def\XINT_flpower_checkB_b #1#2.#3.%
 {%
     \expandafter\XINT_flpower_checkB_c
@@ -2393,8 +2345,9 @@
 \def\XINT_flpower_loopI #1.%
 {%
     \if1\XINT_isOne {#1}\xint_dothis\XINT_flpower_ItoIII\fi
-    \if1\xintiiOdd {#1}\xint_dothis{\expandafter\XINT_flpower_loopI_odd}\fi
-                       \xint_orthat{\expandafter\XINT_flpower_loopI_even}%
+    \ifodd\xintiiLDg{#1} %<- intentional space
+       \xint_dothis{\expandafter\XINT_flpower_loopI_odd}\fi
+    \xint_orthat{\expandafter\XINT_flpower_loopI_even}%
     \romannumeral0\XINT_half
     #1\xint_bye\xint_Bye345678\xint_bye
     *\xint_c_v+\xint_c_v)/\xint_c_x-\xint_c_i\relax.%
@@ -2421,8 +2374,9 @@
 \def\XINT_flpower_loopII #1.%
 {%
     \if1\XINT_isOne{#1}\xint_dothis\XINT_flpower_IItoIII\fi
-    \if1\xintiiOdd{#1}\xint_dothis{\expandafter\XINT_flpower_loopII_odd}\fi
-                      \xint_orthat{\expandafter\XINT_flpower_loopII_even}%
+    \ifodd\xintiiLDg{#1} %<- intentional space
+        \xint_dothis{\expandafter\XINT_flpower_loopII_odd}\fi
+    \xint_orthat{\expandafter\XINT_flpower_loopII_even}%
     \romannumeral0\XINT_half#1\xint_bye\xint_Bye345678\xint_bye
     *\xint_c_v+\xint_c_v)/\xint_c_x-\xint_c_i\relax.%
 }%
@@ -2994,22 +2948,35 @@
 }%
 \def\XINT_floate_noopt #1\xint_relax
 {%
-    \expandafter\XINT_floate_a\expandafter\XINTdigits
-                \romannumeral0\XINT_infrac {#1}%
+    \expandafter\XINT_floate_post
+    \romannumeral0\XINTinfloat[\XINTdigits]{#1}\XINTdigits.%
+}%
+\def\XINT_floate_opt [\xint_relax #1]%
+{%
+    \expandafter\XINT_floate_opt_a\the\numexpr #1.%
 }%
-\def\XINT_floate_opt [\xint_relax #1]#2%
+\def\XINT_floate_opt_a #1.#2%
 {%
-    \expandafter\XINT_floate_a\expandafter
-    {\the\numexpr #1\expandafter}\romannumeral0\XINT_infrac {#2}%
+    \expandafter\XINT_floate_post
+    \romannumeral0\XINTinfloat[#1]{#2}#1.%
 }%
-\def\XINT_floate_a #1#2#3#4#5%
+\def\XINT_floate_post #1%
+{%
+    \xint_UDzerominusfork
+      #1-\XINT_floate_zero
+       0#1\XINT_floate_neg
+       0-\XINT_floate_pos
+    \krof #1%
+}%[
+\def\XINT_floate_zero #1]#2.#3{ 0.e0}%
+\def\XINT_floate_neg-{\expandafter-\romannumeral0\XINT_floate_pos}%
+\def\XINT_floate_pos #1#2[#3]#4.#5%
 {%
-    \expandafter\XINT_float_a\the\numexpr#1\expandafter.%
-    \expandafter{\the\numexpr #2+#5}{#3}{#4}\XINT_float_Q
+    \expandafter\XINT_float_pos_done\the\numexpr#3+#4+#5-\xint_c_i.#1.#2;%
 }%
 \def\XINTinFloatE {\romannumeral0\XINTinfloate }%
 \def\XINTinfloate
-   {\expandafter\XINT_infloate\romannumeral0\XINTinfloat [\XINTdigits]}%
+   {\expandafter\XINT_infloate\romannumeral0\XINTinfloat[\XINTdigits]}%
 \def\XINT_infloate #1[#2]#3%
    {\expandafter\XINT_infloate_end\the\numexpr #3+#2.{#1}}%
 \def\XINT_infloate_end #1.#2{ #2[#1]}%
-- 
cgit v1.2.3

