From 82c37dcf73b52a88faef522a2f1a294351deea1a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 27 Jun 2013 16:31:25 +0000
Subject: xint (16jun13)

git-svn-id: svn://tug.org/texlive/trunk@30978 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/generic/xint/xintfrac.sty | 858 ++++++++++++++++--------
 1 file changed, 586 insertions(+), 272 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 a6678ac73c6..162aa549471 100644
--- a/Master/texmf-dist/tex/generic/xint/xintfrac.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintfrac.sty
@@ -22,7 +22,7 @@
 %% in the same archive or directory.)
 %%
 %%----------------------------------------------------------------
-%% The xint bundle (version 1.07a of May 26, 2013)
+%% The xint bundle (version 1.08b of June 14, 2013)
 %% xintfrac: Expandable operations on fractions
 %% Copyright (C) 2013 by Jean-Francois Burnol
 %%----------------------------------------------------------------
@@ -114,9 +114,9 @@
       \endgroup
       \edef\XINT_frac_restorecatcodes_endinput
       {%
-        \catcode94=\the\catcode94   % ^
         \catcode93=\the\catcode93   % ]
         \catcode91=\the\catcode91   % [
+        \catcode94=\the\catcode94   % ^
         \catcode96=\the\catcode96   % `
         \catcode47=\the\catcode47   % /
         \catcode41=\the\catcode41   % )
@@ -139,10 +139,9 @@
         \catcode61=\the\catcode61\relax   % =
         \noexpand\endinput
       }%
-      \XINT_setcatcodes
+      \XINT_setcatcodes % defined in xint.sty
       \catcode91=12 % [
       \catcode93=12 % ]
-      \catcode94=7  % ^
   }%
 \x
 \begingroup
@@ -166,7 +165,11 @@
   \fi
 \expandafter\x\csname ver@xintfrac.sty\endcsname
 \ProvidesPackage{xintfrac}%
-  [2013/05/26 v1.07a Expandable operations on fractions (jfB)]%
+  [2013/06/14 v1.08b Expandable operations on fractions (jfB)]%
+\chardef\xint_c_vi     6
+\chardef\xint_c_vii    7
+\chardef\xint_c_xviii 18
+\mathchardef\xint_c_x^iv 10000
 \def\xintLen {\romannumeral0\xintlen }%
 \def\xintlen #1%
 {%
@@ -177,6 +180,35 @@
     \expandafter\space
     \the\numexpr -1+\XINT_Abs {#1}+\XINT_Len {#2}+\XINT_Len {#3}\relax
 }%
+\def\XINT_lenrord_loop #1#2#3#4#5#6#7#8#9%
+{%  faire \romannumeral-`0\XINT_lenrord_loop 0{}#1\Z\W\W\W\W\W\W\W\Z
+    \xint_gob_til_W #9\XINT_lenrord_W\W
+    \expandafter\XINT_lenrord_loop\expandafter
+    {\the\numexpr #1+7}{#9#8#7#6#5#4#3#2}%
+}%
+\def\XINT_lenrord_W\W\expandafter\XINT_lenrord_loop\expandafter #1#2#3\Z
+{%
+    \expandafter\XINT_lenrord_X\expandafter {#1}#2\Z
+}%
+\def\XINT_lenrord_X #1#2\Z
+{%
+    \XINT_lenrord_Y #2\R\R\R\R\R\R\T {#1}%
+}%
+\def\XINT_lenrord_Y #1#2#3#4#5#6#7#8\T
+{%
+    \xint_gob_til_W
+            #7\XINT_lenrord_Z \xint_c_viii
+            #6\XINT_lenrord_Z \xint_c_vii
+            #5\XINT_lenrord_Z \xint_c_vi
+            #4\XINT_lenrord_Z \xint_c_v
+            #3\XINT_lenrord_Z \xint_c_iv
+            #2\XINT_lenrord_Z \xint_c_iii
+            \W\XINT_lenrord_Z \xint_c_ii   \Z
+}%
+\def\XINT_lenrord_Z #1#2\Z #3% retourne: {longueur}renverse\Z
+{%
+    \expandafter{\the\numexpr #3-#1\relax}%
+}%
 \def\XINT_outfrac #1#2#3%
 {%
     \ifcase\XINT_Sgn{#3}
@@ -345,7 +377,7 @@
 }%
 \def\XINT_cuz_cnt_loop #1#2#3#4#5#6#7#8#9%
 {%
-    \xint_gob_til_r #9\XINT_cuz_cnt_toofara \R
+    \xint_gob_til_R #9\XINT_cuz_cnt_toofara \R
     \expandafter\XINT_cuz_cnt_checka\expandafter
     {\the\numexpr #1+8\relax}{#2#3#4#5#6#7#8#9}%
 }%
@@ -357,7 +389,7 @@
 \def\XINT_cuz_cnt_toofarb #1#2\Z {\XINT_cuz_cnt_toofarc #2\Z {#1}}%
 \def\XINT_cuz_cnt_toofarc #1#2#3#4#5#6#7#8%
 {%
-    \xint_gob_til_r #2\XINT_cuz_cnt_toofard 7%
+    \xint_gob_til_R #2\XINT_cuz_cnt_toofard 7%
             #3\XINT_cuz_cnt_toofard 6%
             #4\XINT_cuz_cnt_toofard 5%
             #5\XINT_cuz_cnt_toofard 4%
@@ -374,7 +406,7 @@
 }%
 \def\XINT_cuz_cnt_toofare #1#2#3#4#5#6#7#8%
 {%
-    \xint_gob_til_r #2\XINT_cuz_cnt_stopc 1%
+    \xint_gob_til_R #2\XINT_cuz_cnt_stopc 1%
             #3\XINT_cuz_cnt_stopc 2%
             #4\XINT_cuz_cnt_stopc 3%
             #5\XINT_cuz_cnt_stopc 4%
@@ -389,7 +421,7 @@
 }%
 \def\XINT_cuz_cnt_checkb #1%
 {%
-    \xint_gob_til_zero #1\expandafter\XINT_cuz_cnt_loop\xint_gob_til_z
+    \xint_gob_til_zero #1\expandafter\XINT_cuz_cnt_loop\xint_gob_til_Z
     0\XINT_cuz_cnt_stopa #1%
 }%
 \def\XINT_cuz_cnt_stopa #1\Z
@@ -398,7 +430,7 @@
 }%
 \def\XINT_cuz_cnt_stopb #1#2#3#4#5#6#7#8#9%
 {%
-    \xint_gob_til_r #2\XINT_cuz_cnt_stopc 1%
+    \xint_gob_til_R #2\XINT_cuz_cnt_stopc 1%
             #3\XINT_cuz_cnt_stopc 2%
             #4\XINT_cuz_cnt_stopc 3%
             #5\XINT_cuz_cnt_stopc 4%
@@ -487,14 +519,15 @@
 \def\xintFrac {\romannumeral0\xintfrac }%
 \def\xintfrac #1%
 {%
-    \expandafter\XINT__frac_A\romannumeral0\XINT_infrac {#1}%
+    \expandafter\XINT_fracfrac_A\romannumeral0\XINT_infrac {#1}%
 }%
-\def\XINT__frac_A #1{\XINT__frac_B #1\Z }%
-\def\XINT__frac_B #1#2\Z
+\def\XINT_fracfrac_A #1{\XINT_fracfrac_B #1\Z }%
+\catcode`^=7
+\def\XINT_fracfrac_B #1#2\Z
 {%
-    \xint_gob_til_zero #1\XINT__frac_C 0\XINT__frac_D {10^{#1#2}}%
+    \xint_gob_til_zero #1\XINT_fracfrac_C 0\XINT_fracfrac_D {10^{#1#2}}%
 }%
-\def\XINT__frac_C #1#2#3#4#5%
+\def\XINT_fracfrac_C #1#2#3#4#5%
 {%
     \ifcase\XINT_isOne {#5}
     \or \xint_afterfi {\expandafter\xint_firstoftwo_andstop\xint_gobble_ii }%
@@ -502,15 +535,15 @@
     \space
     \frac {#4}{#5}%
 }%
-\def\XINT__frac_D #1#2#3%
+\def\XINT_fracfrac_D #1#2#3%
 {%
     \ifcase\XINT_isOne {#3}
-    \or \XINT__frac_E
+    \or \XINT_fracfrac_E
     \fi
     \space
     \frac {#2}{#3}#1%
 }%
-\def\XINT__frac_E \fi #1#2#3#4{\fi \space #3\cdot }%
+\def\XINT_fracfrac_E \fi #1#2#3#4{\fi \space #3\cdot }%
 \def\xintSignedFrac {\romannumeral0\xintsignedfrac }%
 \def\xintsignedfrac #1%
 {%
@@ -529,7 +562,7 @@
 }%
 \def\XINT_sgnfrac_P #1\Z #2%
 {%
-    \XINT__frac_A {#2}{#1}%
+    \XINT_fracfrac_A {#2}{#1}%
 }%
 \def\XINT_sgnfrac_N
 {%
@@ -545,6 +578,7 @@
 {%
     \xint_gob_til_zero #1\XINT_fwover_C 0\XINT_fwover_D {10^{#1#2}}%
 }%
+\catcode`^=11
 \def\XINT_fwover_C #1#2#3#4#5%
 {%
     \ifcase\XINT_isOne {#5}
@@ -657,7 +691,7 @@
     \fi
     #2\Z {#3}%
 }%
-\def\XINT_irr_denomisone #1\Z #2{ #1}%
+\def\XINT_irr_denomisone #1\Z #2{ #1/1}% changed in 1.08
 \def\XINT_irr_negative   #1\Z #2{\XINT_irr_D #1\Z #2\Z \xint_minus_andstop}%
 \def\XINT_irr_nonneg     #1\Z #2{\XINT_irr_D #1\Z #2\Z \space}%
 \def\XINT_irr_D #1#2\Z #3#4\Z
@@ -672,7 +706,7 @@
 }%
 \def\XINT_irr_indeterminate #1#2#3#4#5{\xintError:NaN\space 0/0}%
 \def\XINT_irr_divisionbyzero #1#2#3#4#5{\xintError:DivisionByZero #5#2/0}%
-\def\XINT_irr_zero #1#2#3#4#5{ 0}%
+\def\XINT_irr_zero #1#2#3#4#5{ 0/1}% changed in 1.08
 \def\XINT_irr_loop_a #1#2%
 {%
     \expandafter\XINT_irr_loop_d
@@ -696,26 +730,14 @@
 {%
    \expandafter\XINT_irr_finish\expandafter {#2}{#1}%
 }%
-\def\XINT_irr_finish #1#2#3%
-{%
-    \ifcase\XINT_isOne {#2}
-      \xint_afterfi {#3#1/#2}%
-    \or
-      \xint_afterfi {#3#1}%
-    \fi
-}%
+\def\XINT_irr_finish #1#2#3{#3#1/#2}% changed in 1.08
 \def\xintNum {\romannumeral0\xintnum }%
-\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}/\W\Z }%
-\def\XINT_intcheck #1/#2#3\Z
-{%
-    \xint_gob_til_w #2\xint_gobble_ii\W
-    \xintError:NotAnInteger
-    \space #1%
-}%
-\def\xintfFac {\romannumeral0\xintffac }%
-\def\xintffac #1%
+\def\xintnum #1{\expandafter\XINT_intcheck\romannumeral0\xintirr {#1}\Z }%
+\def\XINT_intcheck #1/#2\Z
 {%
-    \expandafter\XINT_fac_fork\expandafter{\the\numexpr \xintNum{#1}}%
+    \ifcase\XINT_isOne {#2}
+      \xintError:NotAnInteger
+    \fi\space #1%
 }%
 \def\xintJrr {\romannumeral0\xintjrr }%
 \def\xintjrr #1%
@@ -735,7 +757,7 @@
     \fi
     #2\Z {#3}%
 }%
-\def\XINT_jrr_denomisone #1\Z #2{ #1}%
+\def\XINT_jrr_denomisone #1\Z #2{ #1/1}% changed in 1.08
 \def\XINT_jrr_negative   #1\Z #2{\XINT_jrr_D #1\Z #2\Z \xint_minus_andstop }%
 \def\XINT_jrr_nonneg     #1\Z #2{\XINT_jrr_D #1\Z #2\Z \space}%
 \def\XINT_jrr_D #1#2\Z #3#4\Z
@@ -750,7 +772,7 @@
 }%
 \def\XINT_jrr_indeterminate #1#2#3#4#5#6#7{\xintError:NaN\space 0/0}%
 \def\XINT_jrr_divisionbyzero #1#2#3#4#5#6#7{\xintError:DivisionByZero #7#2/0}%
-\def\XINT_jrr_zero #1#2#3#4#5#6#7{ 0}%
+\def\XINT_jrr_zero #1#2#3#4#5#6#7{ 0/1}% changed in 1.08
 \def\XINT_jrr_loop_a #1#2%
 {%
     \expandafter\XINT_jrr_loop_b
@@ -923,7 +945,7 @@
 }%
 \def\XINT_round_Daa #1%
 {%
-    \xint_gob_til_z #1\XINT_round_Daz\Z \XINT_round_Da #1%
+    \xint_gob_til_Z #1\XINT_round_Daz\Z \XINT_round_Da #1%
 }%
 \def\XINT_round_Daz\Z \XINT_round_Da \Z { 0\Z }%
 \def\XINT_round_Da #1\Z
@@ -936,7 +958,7 @@
 }%
 \def\XINT_round_Dba #1%
 {%
-    \xint_gob_til_z #1\XINT_round_Dbz\Z \XINT_round_Db #1%
+    \xint_gob_til_Z #1\XINT_round_Dbz\Z \XINT_round_Db #1%
 }%
 \def\XINT_round_Dbz\Z \XINT_round_Db \Z { 1\Z }%
 \def\XINT_round_Db #1\Z
@@ -951,233 +973,261 @@
 \def\xintfloat #1{\XINT_float_chkopt #1\Z }%
 \def\XINT_float_chkopt #1%
 {%
-    \ifx #1[\expandafter\XINT_float_opt
+    \ifx [#1\expandafter\XINT_float_opt
        \else\expandafter\XINT_float_noopt
     \fi  #1%
 }%
 \def\XINT_float_noopt #1\Z
 {%
-    \XINT_float_a \XINT_digits {#1}%
-}%
-\def\XINT_float_opt [\Z #1]%
-{%
-    \expandafter\XINT_float_a\expandafter {\the\numexpr #1}%
+    \expandafter\XINT_float_a\expandafter\XINT_digits
+    \romannumeral0\XINT_infrac {#1}\XINT_float_Q
 }%
-\def\XINT_float_a #1#2%
+\def\XINT_float_opt [\Z #1]#2%
 {%
-    \expandafter\XINT_float_b \romannumeral0\XINT_infrac {#2}{#1}%
+    \expandafter\XINT_float_a\expandafter
+    {\the\numexpr #1\expandafter}%
+    \romannumeral0\XINT_infrac {#2}\XINT_float_Q
 }%
-\def\XINT_float_b #1#2#3%
+\def\XINT_float_a #1#2#3% #1=P, #2=n, #3=A, #4=B
 {%
-    \XINT_float_fork #2\Z {#3}{#1}%
+    \XINT_float_fork #3\Z {#1}{#2}% #1 = precision, #2=n
 }%
 \def\XINT_float_fork #1%
 {%
     \xint_UDzerominusfork
      #1-\dummy  \XINT_float_zero
-     0#1\dummy  \XINT_float_N
-      0-\dummy  {\XINT_float_P #1}%
+     0#1\dummy  \XINT_float_J
+      0-\dummy  {\XINT_float_K #1}%
     \krof
 }%
-\def\XINT_float_zero \Z #1#2#3{ 0.e0}%
-\def\XINT_float_N {\expandafter\xint_minus_andstop\romannumeral0\XINT_float_P }%
-\def\XINT_float_P #1\Z #2#3#4%
-{%
-    \ifcase \romannumeral0\XINT_fgeq_A 011{#3}{#1}{#2}
-       \expandafter\XINT_float_lessthanone_a
-    \or\expandafter\XINT_float_atleastone_b
-    \fi {#3}{#1}{#2}{#3+#4}{#1}{#2}%
-}%
-\def\XINT_float_atleastone_b
+\def\XINT_float_zero #1\Z #2#3#4#5{ 0.e0}%
+\def\XINT_float_J {\expandafter\xint_minus_andstop\romannumeral0\XINT_float_K }%
+\def\XINT_float_K #1\Z #2% #1=A, #2=P, #3=n, #4=B
 {%
-    \expandafter\XINT_float_atleastone_c\romannumeral0\XINT_trunc_B
+    \expandafter\XINT_float_L\expandafter
+    {\the\numexpr\xintLength{#1}\expandafter}\expandafter
+    {\the\numexpr #2+\xint_c_ii}{#1}{#2}%
 }%
-\def\XINT_float_atleastone_c #1\Z #2%
+\def\XINT_float_L #1#2%
 {%
-    \expandafter\XINT_float_c\expandafter
-        {\romannumeral0\xintisub {\xintLength{#1}}{1}}%
-}%
-\def\XINT_float_lessthanone_a #1%
-{%
-    \expandafter\XINT_float_lessthanone_b\expandafter
-    {\the\numexpr -#1}%
+    \ifnum #1>#2
+      \expandafter\XINT_float_Ma
+    \else
+      \expandafter\XINT_float_Mc
+    \fi {#1}{#2}%
+}%
+\def\XINT_float_Ma #1#2#3%
+{%
+    \expandafter\XINT_float_Mb\expandafter
+    {\the\numexpr #1-#2\expandafter}\expandafter
+    {\expandafter\xint_firstoftwo
+     \romannumeral0\XINT_split_fromleft_loop {#2}{}#3\W\W\W\W\W\W\W\W\Z
+     }{#2}%
+}%
+\def\XINT_float_Mb #1#2#3#4#5#6% #2=A', #3=P+2, #4=P, #5=n, #6=B
+{%
+   \expandafter\XINT_float_N\expandafter
+   {\the\numexpr\xintLength{#6}\expandafter}\expandafter
+   {\the\numexpr #3\expandafter}\expandafter
+   {\the\numexpr #1+#5}%
+   {#6}{#3}{#2}{#4}%
+}% long de B, P+2, n', B, |A'|=P+2, A', P
+\def\XINT_float_Mc #1#2#3#4#5#6%
+{%
+   \expandafter\XINT_float_N\expandafter
+   {\romannumeral0\XINT_length{#6}}{#2}{#5}{#6}{#1}{#3}{#4}%
+}% long de B, P+2, n, B, |A|, A, P
+\def\XINT_float_N #1#2%
+{%
+    \ifnum #1>#2
+      \expandafter\XINT_float_O
+    \else
+      \expandafter\XINT_float_P
+    \fi {#1}{#2}%
+}%
+\def\XINT_float_O #1#2#3#4%
+{%
+    \expandafter\XINT_float_P\expandafter
+    {\the\numexpr #2\expandafter}\expandafter
+    {\the\numexpr #2\expandafter}\expandafter
+    {\the\numexpr #3-#1+#2\expandafter}\expandafter
+    {\expandafter\xint_firstoftwo
+     \romannumeral0\XINT_split_fromleft_loop {#2}{}#4\W\W\W\W\W\W\W\W\Z
+     }%
+}% |B|,P+2,n,B,|A|,A,P
+\def\XINT_float_P #1#2#3#4#5#6#7#8%
+{%
+    \expandafter #8\expandafter {\the\numexpr #1-#5+#2-\xint_c_i}%
+    {#6}{#4}{#7}{#3}%
+}% |B|-|A|+P+1,A,B,P,n
+\def\XINT_float_Q #1%
+{%
+    \ifnum #1<\xint_c_
+      \expandafter\XINT_float_Ri
+    \else
+      \expandafter\XINT_float_Rii
+    \fi {#1}%
 }%
-\def\XINT_float_lessthanone_b #1#2#3%
+\def\XINT_float_Ri #1#2#3%
 {%
-    \expandafter\XINT_float_lessthanone_c
-    \romannumeral0\XINT_trunc_B {#1}{#3}{#2}%
+    \expandafter\XINT_float_Sa
+    \romannumeral0\xintiquo {#2}%
+         {\romannumeral-`0\XINT_dsx_addzerosnofuss {-#1}{#3}}\Z {#1}%
 }%
-\def\XINT_float_lessthanone_c #1\Z #2%
+\def\XINT_float_Rii #1#2#3%
 {%
-    \expandafter\XINT_float_c\expandafter
-        {\expandafter-\romannumeral0\xintilen {\xintiSub {#1}{1}}}%
+    \expandafter\XINT_float_Sa
+    \romannumeral0\xintiquo
+         {\romannumeral-`0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}\Z {#1}%
 }%
-\def\XINT_float_c #1#2#3#4%
+\def\XINT_float_Sa #1%
 {%
-    \expandafter\XINT_float_d\expandafter
-       {\the\numexpr #2-#1}{#3}{#4}e#1%
+    \if #19%
+        \xint_afterfi {\XINT_float_Sb\XINT_float_Wb }%
+    \else
+        \xint_afterfi {\XINT_float_Sb\XINT_float_Wa }%
+    \fi #1%
 }%
-\def\XINT_float_d
+\def\XINT_float_Sb #1#2\Z #3#4%
 {%
-    \expandafter\XINT_float_round_B\romannumeral0\XINT_trunc_B
+    \expandafter\XINT_float_T\expandafter
+    {\the\numexpr #4+\xint_c_i\expandafter}%
+    \romannumeral-`0\XINT_lenrord_loop 0{}#2\Z\W\W\W\W\W\W\W\Z #1{#3}{#4}%
 }%
-\def\XINT_float_round_B #1#2\Z #3%
+\def\XINT_float_T #1#2#3%
 {%
-    \ifnum #1=9
-        \xint_afterfi
-        {\romannumeral0\XINT_rord_main {}#1#2\XINT_float_round_S}%
+    \ifnum #2>#1
+      \xint_afterfi{\XINT_float_U\XINT_float_Xb}%
     \else
-        \xint_afterfi
-        {\romannumeral0\XINT_rord_main {}#1#2\XINT_float_round_D}%
+      \xint_afterfi{\XINT_float_U\XINT_float_Xa #3}%
     \fi
-      \xint_relax
-        \xint_undef\xint_undef\xint_undef\xint_undef
-        \xint_undef\xint_undef\xint_undef\xint_undef
-      \xint_relax
-    \Z
 }%
-\def\XINT_float_round_D #1%
+\def\XINT_float_U #1#2%
 {%
-    \ifnum #1<5
-        \expandafter\XINT_float_round_Da
+    \ifnum #2<\xint_c_v
+      \expandafter\XINT_float_Va
     \else
-        \expandafter\XINT_float_round_Db
-    \fi
+      \expandafter\XINT_float_Vb
+    \fi #1%
 }%
-\def\XINT_float_round_Da #1\Z
+\def\XINT_float_Va #1#2\Z #3%
 {%
-    \expandafter\XINT_float_round_f
-    \romannumeral0\XINT_rord_main {}#1%
+    \expandafter#1%
+    \romannumeral0\expandafter\XINT_float_Wa
+    \romannumeral0\XINT_rord_main {}#2%
       \xint_relax
         \xint_undef\xint_undef\xint_undef\xint_undef
         \xint_undef\xint_undef\xint_undef\xint_undef
-      \xint_relax
-}%
-\def\XINT_float_round_Db #1\Z
-{%
-    \expandafter\XINT_float_round_f
-    \romannumeral0\XINT_addm_A 0{}1000\W\X\Y\Z #1000\W\X\Y\Z
-}%
-\def\XINT_float_round_f #1{ #1.}%
-\def\XINT_float_round_S #1%
-{%
-    \ifnum #1<5
-        \expandafter\XINT_float_round_Da
-    \else
-        \expandafter\XINT_float_round_Sb
-    \fi
+      \xint_relax \Z
 }%
-\def\XINT_float_round_Sb #1\Z
+\def\XINT_float_Vb #1#2\Z #3%
 {%
-    \expandafter\XINT_float_round_g
-    \romannumeral0\XINT_addm_A 0{}1000\W\X\Y\Z #1000\W\X\Y\Z
+    \expandafter #1%
+    \romannumeral0\expandafter #3%
+    \romannumeral0\XINT_addm_A 0{}1000\W\X\Y\Z #2000\W\X\Y\Z \Z
 }%
-\def\XINT_float_round_g #1%
+\def\XINT_float_Wa #1{ #1.}%
+\def\XINT_float_Wb #1#2%
+    {\if #11\xint_afterfi{ 10.}\else\xint_afterfi{ #1.#2}\fi }%
+\def\XINT_float_Xa #1\Z #2#3#4%
 {%
-    \ifnum #1=1 \expandafter\XINT_float_round_h\fi
-    \space #1.%
+    \expandafter\XINT_float_Y\expandafter
+    {\the\numexpr #3+#4-#2}{#1}%
 }%
-\def\XINT_float_round_h\space 1.0{ 10.}%
-\def\XINT_inFloat [#1]%
+\def\XINT_float_Xb #1\Z #2#3#4%
 {%
-    \expandafter\XINT_infloat\expandafter {\the\numexpr #1}%
+    \expandafter\XINT_float_Y\expandafter
+    {\the\numexpr #3+#4+\xint_c_i-#2}{#1}%
 }%
-\def\XINT_infloat #1#2%
+\def\XINT_float_Y #1#2{ #2e#1}%
+\def\XINT_inFloat [#1]#2%
 {%
-    \expandafter\XINT_infloat_a \romannumeral0\XINT_infrac {#2}{#1}%
+    \expandafter\XINT_infloat_a\expandafter
+    {\the\numexpr #1\expandafter}%
+    \romannumeral0\XINT_infrac {#2}\XINT_infloat_Q
 }%
-\def\XINT_infloat_a #1#2#3%
+\def\XINT_infloat_a #1#2#3% #1=P, #2=n, #3=A, #4=B
 {%
-    \XINT_infloat_fork #2\Z {#3}{#1}%
+    \XINT_infloat_fork #3\Z {#1}{#2}% #1 = precision, #2=n
 }%
 \def\XINT_infloat_fork #1%
 {%
     \xint_UDzerominusfork
      #1-\dummy  \XINT_infloat_zero
-     0#1\dummy  \XINT_infloat_N
-      0-\dummy  {\XINT_infloat_P #1}%
+     0#1\dummy  \XINT_infloat_J
+      0-\dummy  {\XINT_float_K #1}%
     \krof
 }%
-\def\XINT_infloat_zero\Z #1#2#3{0[0]}%
-\def\XINT_infloat_N {\expandafter-\romannumeral-`0\XINT_infloat_P }%
-\def\XINT_infloat_P #1\Z #2#3#4%
-{%
-    \ifcase \romannumeral0\XINT_fgeq_A 011{#3}{#1}{#2}
-       \expandafter\XINT_infloat_lessthanone_a
-    \or\expandafter\XINT_infloat_atleastone_b
-    \fi {#3}{#1}{#2}{#3+#4}{#1}{#2}{#4}%
-}%
-\def\XINT_infloat_atleastone_b
-{%
-    \expandafter\XINT_infloat_atleastone_c\romannumeral0\XINT_trunc_B
-}%
-\def\XINT_infloat_atleastone_c #1\Z #2%
-{%
-    \expandafter\XINT_infloat_c\expandafter
-        {\romannumeral0\xintisub {\xintLength{#1}}{1}}%
-}%
-\def\XINT_infloat_lessthanone_a #1%
-{%
-    \expandafter\XINT_infloat_lessthanone_b\expandafter
-    {\the\numexpr -#1}%
-}%
-\def\XINT_infloat_lessthanone_b #1#2#3%
+\def\XINT_infloat_zero #1\Z #2#3#4#5{0[0]}%
+\def\XINT_infloat_J {\expandafter-\romannumeral-`0\XINT_float_K }%
+\def\XINT_infloat_Q #1%
 {%
-    \expandafter\XINT_infloat_lessthanone_c
-    \romannumeral0\XINT_trunc_B {#1}{#3}{#2}%
+    \ifnum #1<\xint_c_
+      \expandafter\XINT_infloat_Ri
+    \else
+      \expandafter\XINT_infloat_Rii
+    \fi {#1}%
 }%
-\def\XINT_infloat_lessthanone_c #1\Z #2%
+\def\XINT_infloat_Ri #1#2#3%
 {%
-    \expandafter\XINT_infloat_c\expandafter
-        {\expandafter-\romannumeral0\xintilen {\xintiSub {#1}{1}}}%
+    \expandafter\XINT_infloat_S\expandafter
+    {\romannumeral0\xintiquo {#2}%
+         {\romannumeral-`0\XINT_dsx_addzerosnofuss {-#1}{#3}}}{#1}%
 }%
-\def\XINT_infloat_c #1#2#3#4%
+\def\XINT_infloat_Rii #1#2#3%
 {%
-    \expandafter\XINT_infloat_d\expandafter
-           {\the\numexpr #2-#1}{#3}{#4}{#1}%
+    \expandafter\XINT_infloat_S\expandafter
+    {\romannumeral0\xintiquo
+         {\romannumeral-`0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}}{#1}%
 }%
-\def\XINT_infloat_d
+\def\XINT_infloat_S #1#2#3%
 {%
-    \expandafter\XINT_infloat_round_B\romannumeral0\XINT_trunc_B
+    \expandafter\XINT_infloat_T\expandafter
+    {\the\numexpr #3+\xint_c_i\expandafter}%
+    \romannumeral-`0\XINT_lenrord_loop 0{}#1\Z\W\W\W\W\W\W\W\Z
+    {#2}%
 }%
-\def\XINT_infloat_round_B #1\Z #2%
+\def\XINT_infloat_T #1#2#3%
 {%
-    \expandafter\XINT_infloat_round_D
-    \romannumeral0\XINT_rord_main {}#1%
-      \xint_relax
-        \xint_undef\xint_undef\xint_undef\xint_undef
-        \xint_undef\xint_undef\xint_undef\xint_undef
-      \xint_relax
-    \Z
+    \ifnum #2>#1
+      \xint_afterfi{\XINT_infloat_U\XINT_infloat_Wb}%
+    \else
+      \xint_afterfi{\XINT_infloat_U\XINT_infloat_Wa #3}%
+    \fi
 }%
-\def\XINT_infloat_round_D #1%
+\def\XINT_infloat_U #1#2%
 {%
-    \ifnum #1<5
-        \expandafter\XINT_infloat_round_Da
+    \ifnum #2<\xint_c_v
+      \expandafter\XINT_infloat_Va
     \else
-        \expandafter\XINT_infloat_round_Db
-    \fi
+      \expandafter\XINT_infloat_Vb
+    \fi #1%
 }%
-\def\XINT_infloat_round_Da #1\Z
+\def\XINT_infloat_Va #1#2\Z
 {%
-    \expandafter\XINT_infloat_round_f
-    \romannumeral0\XINT_rord_main {}#1%
+    \expandafter#1%
+    \romannumeral0\XINT_rord_main {}#2%
       \xint_relax
         \xint_undef\xint_undef\xint_undef\xint_undef
         \xint_undef\xint_undef\xint_undef\xint_undef
       \xint_relax \Z
 }%
-\def\XINT_infloat_round_Db #1\Z
+\def\XINT_infloat_Vb #1#2\Z
+{%
+    \expandafter #1%
+    \romannumeral0\XINT_addm_A 0{}1000\W\X\Y\Z #2000\W\X\Y\Z \Z
+}%
+\def\XINT_infloat_Wa #1\Z #2#3%
 {%
-    \expandafter\XINT_infloat_round_f
-    \romannumeral0\XINT_addm_A 0{}1000\W\X\Y\Z #1000\W\X\Y\Z \Z
+    \expandafter\XINT_infloat_X\expandafter
+    {\the\numexpr #3+\xint_c_i-#2}{#1}%
 }%
-\def\XINT_infloat_round_f #1\Z #2#3%
+\def\XINT_infloat_Wb #1\Z #2#3%
 {%
-    \expandafter\XINT_infloat_round_g\expandafter
-    {\the\numexpr #2-#3+1}{#1}%
+    \expandafter\XINT_infloat_X\expandafter
+    {\the\numexpr #3+\xint_c_ii-#2}{#1}%
 }%
-\def\XINT_infloat_round_g #1#2{#2[#1]}%
+\def\XINT_infloat_X #1#2{ #2[#1]}%
 \def\xintAdd {\romannumeral0\xintadd }%
 \def\xintadd #1%
 {%
@@ -1288,16 +1338,7 @@
 {%
     \expandafter\xint_fpow\expandafter {\romannumeral0\XINT_infrac {#1}}%
 }%
-\def\xintfPow {\romannumeral0\xintfpow }%
-\def\xintfpow #1%
-{%
-    \expandafter\xint_ffpow\expandafter {\romannumeral0\XINT_infrac {#1}}%
-}%
 \def\xint_fpow #1#2%
-{%
-    \expandafter\XINT_fpow_fork\the\numexpr #2\relax\Z #1%
-}%
-\def\xint_ffpow #1#2%
 {%
     \expandafter\XINT_fpow_fork\the\numexpr \xintNum{#2}\relax\Z #1%
 }%
@@ -1333,6 +1374,11 @@
     \expandafter\XINT_fpow_pos_B\expandafter {#3}{#1}{#2}%
 }%
 \def\XINT_fpow_pos_B #1#2{\XINT_outfrac {#2}{#1}}%
+\def\xintFac {\romannumeral0\xintfac }%
+\def\xintfac #1%
+{%
+    \expandafter\XINT_fac_fork\expandafter{\the\numexpr \xintNum{#1}}%
+}%
 \def\xintPrd {\romannumeral0\xintprd }%
 \def\xintprd #1{\xintprdexpr #1\relax }%
 \def\xintPrdExpr {\romannumeral0\xintprdexpr }%
@@ -1372,111 +1418,201 @@
     \expandafter{#3}{#1}{#2}%
 }%
 \def\XINT_fdiv_C #1#2{\XINT_outfrac {#2}{#1}}%
-\def\xintCmp {\romannumeral0\xintcmp }%
-\def\xintcmp #1%
+\def\xintGeq {\romannumeral0\xintgeq }%
+\def\xintgeq #1%
 {%
-    \expandafter\xint_fcmp\expandafter {\romannumeral0\XINT_infrac {#1}}%
+    \expandafter\xint_fgeq\expandafter {\romannumeral0\xintabs {#1}}%
 }%
-\def\xint_fcmp #1#2{\expandafter\XINT_fcmp_A\romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fcmp_A #1#2#3#4%
+\def\xint_fgeq #1#2%
 {%
-    \ifnum #4 > #1
-       \xint_afterfi {\XINT_fcmp_B {#1}}%
-    \else
-       \xint_afterfi {\XINT_fcmp_B {#4}}%
-    \fi
-    {#1}{#4}{#2}{#3}%
+    \expandafter\XINT_fgeq_A \romannumeral0\xintabs {#2}#1%
 }%
-\def\XINT_fcmp_B #1#2#3#4#5#6#7%
+\def\XINT_fgeq_A #1%
 {%
-    \xinticmp
-    {\romannumeral0\xintimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
-    {\romannumeral0\xintimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
+    \xint_gob_til_zero #1\XINT_fgeq_Zii 0%
+    \XINT_fgeq_B #1%
 }%
-\def\xintGeq {\romannumeral0\xintgeq }%
-\def\xintgeq #1%
+\def\XINT_fgeq_Zii 0\XINT_fgeq_B #1[#2]#3[#4]{ 1}%
+\def\XINT_fgeq_B #1/#2[#3]#4#5/#6[#7]%
 {%
-    \expandafter\xint_fgeq\expandafter {\romannumeral0\XINT_infrac {#1}}%
+    \xint_gob_til_zero #4\XINT_fgeq_Zi 0%
+    \expandafter\XINT_fgeq_C\expandafter
+    {\the\numexpr #7-#3\expandafter}\expandafter
+    {\romannumeral0\xintimul {#4#5}{#2}}%
+    {\romannumeral0\xintimul {#6}{#1}}%
 }%
-\def\xint_fgeq #1#2%
+\def\XINT_fgeq_Zi 0#1#2#3#4#5#6#7{ 0}%
+\def\XINT_fgeq_C #1#2#3%
 {%
-    \expandafter\XINT_fgeq_A \romannumeral0\XINT_infrac {#2}#1%
+    \expandafter\XINT_fgeq_D\expandafter
+    {#3}{#1}{#2}%
 }%
-\def\XINT_fgeq_A #1#2#3#4%
+\def\XINT_fgeq_D #1#2#3%
 {%
-    \ifnum #4 > #1
-       \xint_afterfi {\XINT_fgeq_B {#1}}%
-    \else
-       \xint_afterfi {\XINT_fgeq_B {#4}}%
-    \fi
-    {#1}{#4}{#2}{#3}%
+    \xintSgnFork
+    {\xintiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+    { 0}{\XINT_fgeq_E #2\Z {#3}{#1}}{ 1}%
 }%
-\def\XINT_fgeq_B #1#2#3#4#5#6#7%
+\def\XINT_fgeq_E #1%
 {%
-    \expandafter\XINT_fgeq_C\expandafter
-    {\romannumeral0\xintimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
-    {\romannumeral0\xintimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
+    \xint_UDsignfork
+        #1\dummy  \XINT_fgeq_Fd
+         -\dummy {\XINT_fgeq_Fn #1}%
+    \krof
 }%
-\def\XINT_fgeq_C #1#2%
+\def\XINT_fgeq_Fd #1\Z #2#3%
 {%
-    \expandafter\XINT_geq_fork #2\Z #1\Z
+    \expandafter\XINT_fgeq_Fe\expandafter
+    {\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#3}}{#2}%
+}%
+\def\XINT_fgeq_Fe #1#2{\XINT_geq_pre {#2}{#1}}%
+\def\XINT_fgeq_Fn #1\Z #2#3%
+{%
+    \expandafter\XINT_geq_pre\expandafter
+    {\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}%
 }%
 \def\xintMax {\romannumeral0\xintmax }%
 \def\xintmax #1%
 {%
-    \expandafter\xint_fmax\expandafter {\romannumeral0\XINT_infrac {#1}}%
+    \expandafter\xint_fmax\expandafter {\romannumeral0\xintraw {#1}}%
 }%
-\def\xint_fmax #1#2{\expandafter\XINT_outfrac
-                    \romannumeral0\expandafter\XINT_fmax_A
-                    \romannumeral0\XINT_infrac {#2}#1}%
-\def\XINT_fmax_A #1#2#3#4#5#6%
+\def\xint_fmax #1#2%
 {%
-    \ifnum #4 > #1
-       \xint_afterfi {\XINT_fmax_B {#1}}%
-    \else
-       \xint_afterfi {\XINT_fmax_B {#4}}%
-    \fi
-    {#1}{#4}{#2}{#3}{#5}{#6}{{#4}{#5}{#6}}{{#1}{#2}{#3}}%
+    \expandafter\XINT_fmax_A\romannumeral0\xintraw {#2}#1%
 }%
-\def\XINT_fmax_B #1#2#3#4#5#6#7%
+\def\XINT_fmax_A #1#2/#3[#4]#5#6/#7[#8]%
 {%
-    \expandafter\XINT_fmax_C\expandafter
-    {\romannumeral0\xintimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
-    {\romannumeral0\xintimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
+    \xint_UDsignsfork
+      #1#5\dummy \XINT_fmax_minusminus
+       -#5\dummy \XINT_fmax_firstneg
+       #1-\dummy \XINT_fmax_secondneg
+        --\dummy \XINT_fmax_nonneg_a
+    \krof
+    #1#5{#2/#3[#4]}{#6/#7[#8]}%
 }%
-\def\XINT_fmax_C #1#2%
+\def\XINT_fmax_minusminus --%
+   {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmin_nonneg_b }%
+\def\XINT_fmax_firstneg #1-#2#3{ #1#2}%
+\def\XINT_fmax_secondneg -#1#2#3{ #1#3}%
+\def\XINT_fmax_nonneg_a #1#2#3#4%
 {%
-    \expandafter\XINT_max_fork #2\Z #1\Z
+    \XINT_fmax_nonneg_b {#1#3}{#2#4}%
+}%
+\def\XINT_fmax_nonneg_b #1#2%
+{%
+    \ifcase\romannumeral0\XINT_fgeq_A #1#2
+        \xint_afterfi{ #1}%
+    \or \xint_afterfi{ #2}%
+    \fi
 }%
 \def\xintMin {\romannumeral0\xintmin }%
 \def\xintmin #1%
 {%
-    \expandafter\xint_fmin\expandafter {\romannumeral0\XINT_infrac {#1}}%
+    \expandafter\xint_fmin\expandafter {\romannumeral0\xintraw {#1}}%
 }%
 \def\xint_fmin #1#2%
 {%
-    \expandafter\XINT_outfrac
-    \romannumeral0\expandafter\XINT_fmin_A
-    \romannumeral0\XINT_infrac {#2}#1%
+    \expandafter\XINT_fmin_A\romannumeral0\xintraw {#2}#1%
 }%
-\def\XINT_fmin_A #1#2#3#4#5#6%
+\def\XINT_fmin_A #1#2/#3[#4]#5#6/#7[#8]%
 {%
-    \ifnum #4 > #1
-       \xint_afterfi {\XINT_fmin_B {#1}}%
-    \else
-       \xint_afterfi {\XINT_fmin_B {#4}}%
+    \xint_UDsignsfork
+      #1#5\dummy \XINT_fmin_minusminus
+       -#5\dummy \XINT_fmin_firstneg
+       #1-\dummy \XINT_fmin_secondneg
+        --\dummy \XINT_fmin_nonneg_a
+    \krof
+    #1#5{#2/#3[#4]}{#6/#7[#8]}%
+}%
+\def\XINT_fmin_minusminus --%
+   {\expandafter\xint_minus_andstop\romannumeral0\XINT_fmax_nonneg_b }%
+\def\XINT_fmin_firstneg #1-#2#3{ -#3}%
+\def\XINT_fmin_secondneg -#1#2#3{ -#2}%
+\def\XINT_fmin_nonneg_a #1#2#3#4%
+{%
+    \XINT_fmin_nonneg_b {#1#3}{#2#4}%
+}%
+\def\XINT_fmin_nonneg_b #1#2%
+{%
+    \ifcase\romannumeral0\XINT_fgeq_A #1#2
+        \xint_afterfi{ #2}%
+    \or \xint_afterfi{ #1}%
     \fi
-    {#1}{#4}{#2}{#3}{#5}{#6}{{#4}{#5}{#6}}{{#1}{#2}{#3}}%
 }%
-\def\XINT_fmin_B #1#2#3#4#5#6#7%
+\def\xintCmp {\romannumeral0\xintcmp }%
+\def\xintcmp #1%
 {%
-    \expandafter\XINT_fmin_C\expandafter
-    {\romannumeral0\xintimul {\xintDSH {\the\numexpr -#3+#1\relax}{#6}}{#5}}%
-    {\romannumeral0\xintimul {#7}{\xintDSH {\the\numexpr -#2+#1\relax}{#4}}}%
+    \expandafter\xint_fcmp\expandafter {\romannumeral0\xintraw {#1}}%
+}%
+\def\xint_fcmp #1#2%
+{%
+    \expandafter\XINT_fcmp_A\romannumeral0\xintraw {#2}#1%
+}%
+\def\XINT_fcmp_A #1#2/#3[#4]#5#6/#7[#8]%
+{%
+    \xint_UDsignsfork
+      #1#5\dummy \XINT_fcmp_minusminus
+       -#5\dummy \XINT_fcmp_firstneg
+       #1-\dummy \XINT_fcmp_secondneg
+        --\dummy \XINT_fcmp_nonneg_a
+    \krof
+    #1#5{#2/#3[#4]}{#6/#7[#8]}%
 }%
-\def\XINT_fmin_C #1#2%
+\def\XINT_fcmp_minusminus --#1#2{\XINT_fcmp_B #2#1}%
+\def\XINT_fcmp_firstneg #1-#2#3{ -1}%
+\def\XINT_fcmp_secondneg -#1#2#3{ 1}%
+\def\XINT_fcmp_nonneg_a #1#2%
 {%
-    \expandafter\XINT_min_fork #2\Z #1\Z
+    \xint_UDzerosfork
+      #1#2\dummy \XINT_fcmp_zerozero
+       0#2\dummy \XINT_fcmp_firstzero
+       #10\dummy \XINT_fcmp_secondzero
+        00\dummy \XINT_fcmp_pos
+    \krof
+    #1#2%
+}%
+\def\XINT_fcmp_zerozero   #1[#2]#3[#4]{ 0}%
+\def\XINT_fcmp_firstzero  #1[#2]#3[#4]{ -1}%
+\def\XINT_fcmp_secondzero #1[#2]#3[#4]{ 1}%
+\def\XINT_fcmp_pos #1#2#3#4%
+{%
+    \XINT_fcmp_B #1#3#2#4%
+}%
+\def\XINT_fcmp_B #1/#2[#3]#4/#5[#6]%
+{%
+    \expandafter\XINT_fcmp_C\expandafter
+    {\the\numexpr #6-#3\expandafter}\expandafter
+    {\romannumeral0\xintimul {#4}{#2}}%
+    {\romannumeral0\xintimul {#5}{#1}}%
+}%
+\def\XINT_fcmp_C #1#2#3%
+{%
+    \expandafter\XINT_fcmp_D\expandafter
+    {#3}{#1}{#2}%
+}%
+\def\XINT_fcmp_D #1#2#3%
+{%
+    \xintSgnFork
+    {\xintiSgn{\the\numexpr #2+\xintLength{#3}-\xintLength{#1}\relax}}%
+    { -1}{\XINT_fcmp_E #2\Z {#3}{#1}}{ 1}%
+}%
+\def\XINT_fcmp_E #1%
+{%
+    \xint_UDsignfork
+        #1\dummy  \XINT_fcmp_Fd
+         -\dummy {\XINT_fcmp_Fn #1}%
+    \krof
+}%
+\def\XINT_fcmp_Fd #1\Z #2#3%
+{%
+    \expandafter\XINT_fcmp_Fe\expandafter
+    {\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#3}}{#2}%
+}%
+\def\XINT_fcmp_Fe #1#2{\XINT_cmp_pre {#2}{#1}}%
+\def\XINT_fcmp_Fn #1\Z #2#3%
+{%
+    \expandafter\XINT_cmp_pre\expandafter
+    {\romannumeral0\XINT_dsx_addzerosnofuss {#1}{#2}}{#3}%
 }%
 \def\xintAbs {\romannumeral0\xintabs }%
 \def\xintabs #1%
@@ -1564,7 +1700,7 @@
 \def\XINTinfloatadd #1{\XINT_fladd_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_fladd_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_fladd_opt
+    \ifx [#2\expandafter\XINT_fladd_opt
        \else\expandafter\XINT_fladd_noopt
     \fi  #1#2%
 }%
@@ -1611,7 +1747,7 @@
 \def\XINTinfloatsub #1{\XINT_flsub_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_flsub_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_flsub_opt
+    \ifx [#2\expandafter\XINT_flsub_opt
        \else\expandafter\XINT_flsub_noopt
     \fi  #1#2%
 }%
@@ -1629,7 +1765,7 @@
 \def\XINTinfloatmul #1{\XINT_flmul_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_flmul_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_flmul_opt
+    \ifx [#2\expandafter\XINT_flmul_opt
        \else\expandafter\XINT_flmul_noopt
     \fi  #1#2%
 }%
@@ -1657,7 +1793,7 @@
 \def\XINTinfloatdiv  #1{\XINT_fldiv_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_fldiv_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_fldiv_opt
+    \ifx [#2\expandafter\XINT_fldiv_opt
        \else\expandafter\XINT_fldiv_noopt
     \fi  #1#2%
 }%
@@ -1685,7 +1821,7 @@
 \def\XINTinfloatpow #1{\XINT_flpow_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_flpow_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_flpow_opt
+    \ifx [#2\expandafter\XINT_flpow_opt
        \else\expandafter\XINT_flpow_noopt
     \fi
      #1#2%
@@ -1824,7 +1960,7 @@
 \def\XINTinfloatpower #1{\XINT_flpower_chkopt \XINT_inFloat #1\Z }%
 \def\XINT_flpower_chkopt #1#2%
 {%
-    \ifx #2[\expandafter\XINT_flpower_opt
+    \ifx [#2\expandafter\XINT_flpower_opt
        \else\expandafter\XINT_flpower_noopt
     \fi
      #1#2%
@@ -1917,6 +2053,184 @@
 {%
    \XINT_flpower_loop {#1}{#2}{#3}%
 }%
+\def\xintFloatSqrt     {\romannumeral0\xintfloatsqrt }%
+\def\xintfloatsqrt   #1{\XINT_flsqrt_chkopt \xintfloat #1\Z }%
+\def\XINTinFloatSqrt   {\romannumeral-`0\XINTinfloatsqrt }%
+\def\XINTinfloatsqrt #1{\XINT_flsqrt_chkopt \XINT_inFloat #1\Z }%
+\def\XINT_flsqrt_chkopt #1#2%
+{%
+    \ifx [#2\expandafter\XINT_flsqrt_opt
+       \else\expandafter\XINT_flsqrt_noopt
+    \fi  #1#2%
+}%
+\def\XINT_flsqrt_noopt #1#2\Z
+{%
+    #1[\XINT_digits]{\XINT_FL_sqrt \XINT_digits {#2}}%
+}%
+\def\XINT_flsqrt_opt #1[\Z #2]#3%
+{%
+    #1[#2]{\XINT_FL_sqrt {#2}{#3}}%
+}%
+\def\XINT_FL_sqrt #1%
+{%
+    \ifnum\numexpr #1<\xint_c_xviii
+        \xint_afterfi {\XINT_FL_sqrt_a\xint_c_xviii}%
+    \else
+        \xint_afterfi {\XINT_FL_sqrt_a {#1+\xint_c_i}}%
+    \fi
+}%
+\def\XINT_FL_sqrt_a #1#2%
+{%
+    \expandafter\XINT_FL_sqrt_checkifzeroorneg
+    \romannumeral-`0\XINT_inFloat [#1]{#2}%
+}%
+\def\XINT_FL_sqrt_checkifzeroorneg #1%
+{%
+    \xint_UDzerominusfork
+     #1-\dummy  \XINT_FL_sqrt_iszero
+     0#1\dummy  \XINT_FL_sqrt_isneg
+      0-\dummy {\XINT_FL_sqrt_b #1}%
+    \krof
+}%
+\def\XINT_FL_sqrt_iszero #1[#2]{0[0]}%
+\def\XINT_FL_sqrt_isneg  #1[#2]{\xintError:RootOfNegative 0[0]}%
+\def\XINT_FL_sqrt_b #1[#2]%
+{%
+    \ifodd #2
+        \xint_afterfi{\XINT_FL_sqrt_c 01}%
+    \else
+        \xint_afterfi{\XINT_FL_sqrt_c {}0}%
+    \fi
+    {#1}{#2}%
+}%
+\def\XINT_FL_sqrt_c #1#2#3#4%
+{%
+    \expandafter\XINT_flsqrt\expandafter {\the\numexpr #4-#2}{#3#1}%
+}%
+\def\XINT_flsqrt #1#2%
+{%
+    \expandafter\XINT_sqrt_a
+    \expandafter{\romannumeral0\XINT_length {#2}}\XINT_flsqrt_big_d {#2}{#1}%
+}%
+\def\XINT_flsqrt_big_d #1\or #2\fi #3%
+{%
+   \fi
+   \ifodd #3
+     \xint_afterfi{\expandafter\XINT_flsqrt_big_eB}%
+   \else
+     \xint_afterfi{\expandafter\XINT_flsqrt_big_eA}%
+   \fi
+   \expandafter {\the\numexpr (#3-\xint_c_i)/\xint_c_ii }{#1}%
+}%
+\def\XINT_flsqrt_big_eA  #1#2#3%
+{%
+    \XINT_flsqrt_big_eA_a #3\Z {#2}{#1}{#3}%
+}%
+\def\XINT_flsqrt_big_eA_a #1#2#3#4#5#6#7#8#9\Z
+{%
+    \XINT_flsqrt_big_eA_b {#1#2#3#4#5#6#7#8}%
+}%
+\def\XINT_flsqrt_big_eA_b #1#2%
+{%
+    \expandafter\XINT_flsqrt_big_f
+    \romannumeral0\XINT_flsqrt_small_e {#2001}{#1}%
+}%
+\def\XINT_flsqrt_big_eB #1#2#3%
+{%
+    \XINT_flsqrt_big_eB_a #3\Z {#2}{#1}{#3}%
+}%
+\def\XINT_flsqrt_big_eB_a #1#2#3#4#5#6#7#8#9%
+{%
+    \XINT_flsqrt_big_eB_b {#1#2#3#4#5#6#7#8#9}%
+}%
+\def\XINT_flsqrt_big_eB_b #1#2\Z #3%
+{%
+    \expandafter\XINT_flsqrt_big_f
+    \romannumeral0\XINT_flsqrt_small_e {#30001}{#1}%
+}%
+\def\XINT_flsqrt_small_e #1#2%
+{%
+   \expandafter\XINT_flsqrt_small_f\expandafter
+   {\the\numexpr #1*#1-#2-\xint_c_i}{#1}%
+}%
+\def\XINT_flsqrt_small_f #1#2%
+{%
+   \expandafter\XINT_flsqrt_small_g\expandafter
+   {\the\numexpr (#1+#2)/(2*#2)-\xint_c_i }{#1}{#2}%
+}%
+\def\XINT_flsqrt_small_g #1%
+{%
+    \ifnum #1>\xint_c_
+       \expandafter\XINT_flsqrt_small_h
+    \else
+       \expandafter\XINT_flsqrt_small_end
+    \fi
+    {#1}%
+}%
+\def\XINT_flsqrt_small_h #1#2#3%
+{%
+    \expandafter\XINT_flsqrt_small_f\expandafter
+    {\the\numexpr #2-\xint_c_ii*#1*#3+#1*#1\expandafter}\expandafter
+    {\the\numexpr #3-#1}%
+}%
+\def\XINT_flsqrt_small_end #1#2#3%
+{%
+    \expandafter\space\expandafter
+    {\the\numexpr \xint_c_i+#3*\xint_c_x^iv-
+                      (#2*\xint_c_x^iv+#3)/(\xint_c_ii*#3)}%
+}%
+\def\XINT_flsqrt_big_f #1%
+{%
+    \expandafter\XINT_flsqrt_big_fa\expandafter
+    {\romannumeral0\xintisqr {#1}}{#1}%
+}%
+\def\XINT_flsqrt_big_fa #1#2#3#4%
+{%
+    \expandafter\XINT_flsqrt_big_fb\expandafter
+    {\romannumeral-`0\XINT_dsx_addzerosnofuss
+                     {\numexpr #3-\xint_c_viii\relax}{#2}}%
+    {\romannumeral0\xintisub
+      {\XINT_dsx_addzerosnofuss
+           {\numexpr \xint_c_ii*(#3-\xint_c_viii)\relax}{#1}}{#4}}%
+    {#3}%
+}%
+\def\XINT_flsqrt_big_fb #1#2%
+{%
+    \expandafter\XINT_flsqrt_big_g\expandafter {#2}{#1}%
+}%
+\def\XINT_flsqrt_big_g #1#2%
+{%
+    \expandafter\XINT_flsqrt_big_j
+    \romannumeral0\xintidivision
+    {#1}{\romannumeral0\XINT_dbl_pos #2\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W }{#2}%
+}%
+\def\XINT_flsqrt_big_j #1%
+{%
+    \ifcase\XINT_Sgn {#1}
+        \expandafter \XINT_flsqrt_big_end_a
+    \or \expandafter \XINT_flsqrt_big_k
+    \fi {#1}%
+}%
+\def\XINT_flsqrt_big_k #1#2#3%
+{%
+    \expandafter\XINT_flsqrt_big_l\expandafter
+    {\romannumeral0\XINT_sub_pre {#3}{#1}}%
+    {\romannumeral0\xintiadd {#2}{\romannumeral0\XINT_sqr {#1}}}%
+}%
+\def\XINT_flsqrt_big_l #1#2%
+{%
+   \expandafter\XINT_flsqrt_big_g\expandafter
+   {#2}{#1}%
+}%
+\def\XINT_flsqrt_big_end_a #1#2#3#4#5%
+{%
+   \expandafter\XINT_flsqrt_big_end_b\expandafter
+   {\the\numexpr -#4+#5/\xint_c_ii\expandafter}\expandafter
+   {\romannumeral0\xintisub
+    {\XINT_dsx_addzerosnofuss {#4}{#3}}%
+    {\xintHalf{\xintiQuo{\XINT_dsx_addzerosnofuss {#4}{#2}}{#3}}}}%
+}%
+\def\XINT_flsqrt_big_end_b #1#2{#2[#1]}%
 \XINT_frac_restorecatcodes_endinput%
 \endinput
 %%
-- 
cgit v1.2.3

