summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xint.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-11-08 23:51:15 +0000
committerKarl Berry <karl@freefriends.org>2014-11-08 23:51:15 +0000
commit9a870ba0873e5855067323ca60f8211fedfa23cc (patch)
treee5d74dfe6a59a441aefbe010a4818ab72a71a775 /Master/texmf-dist/tex/generic/xint/xint.sty
parent4435db29aea2c716c788f96372d03d17a7cc6486 (diff)
xint (8nov14)
git-svn-id: svn://tug.org/texlive/trunk@35545 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.sty113
1 files changed, 88 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index b105b592d96..94ed59c37c0 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 v1.1 (2014/10/28)
+%% The xint bundle v1.1a (2014/11/07)
%% Copyright (C) 2013-2014 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}%
- [2014/10/28 v1.1 Expandable operations on big integers (jfB)]%
+ [2014/11/07 v1.1a 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}%
@@ -85,6 +85,8 @@
\else\expandafter\xint_firstofthree_thenstop
\fi
}%
+\def\xintiiIsOne {\romannumeral0\xintiiisone }%
+\def\xintiiisone #1{\expandafter\XINT_isone\romannumeral-`0#1\W\Z }%
\def\xintIsOne {\romannumeral0\xintisone }%
\def\xintisone #1{\expandafter\XINT_isone\romannumeral0\xintnum{#1}\W\Z }%
\def\XINT_isOne #1{\romannumeral0\XINT_isone #1\W\Z }%
@@ -220,6 +222,15 @@
\expandafter\xint_firstoftwo_thenstop
\fi
}%
+\def\xintiiifOne {\romannumeral0\xintiiifone }%
+\def\xintiiifone #1%
+{%
+ \if1\xintiiIsOne{#1}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
\def\xintifOne {\romannumeral0\xintifone }%
\def\xintifone #1%
{%
@@ -242,6 +253,15 @@
\else\expandafter\xint_firstofthree_thenstop
\fi
}%
+\def\xintiiifCmp {\romannumeral0\xintiiifcmp }%
+\def\xintiiifcmp #1#2%
+{%
+ \ifcase\xintiiCmp {#1}{#2}
+ \expandafter\xint_secondofthree_thenstop
+ \or\expandafter\xint_thirdofthree_thenstop
+ \else\expandafter\xint_firstofthree_thenstop
+ \fi
+}%
\def\xintifEq {\romannumeral0\xintifeq }%
\def\xintifeq #1#2%
{%
@@ -250,6 +270,14 @@
\else\expandafter\xint_secondoftwo_thenstop
\fi
}%
+\def\xintiiifEq {\romannumeral0\xintiiifeq }%
+\def\xintiiifeq #1#2%
+{%
+ \if0\xintiiCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else\expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
\def\xintifGt {\romannumeral0\xintifgt }%
\def\xintifgt #1#2%
{%
@@ -258,6 +286,14 @@
\else\expandafter\xint_secondoftwo_thenstop
\fi
}%
+\def\xintiiifGt {\romannumeral0\xintiiifgt }%
+\def\xintiiifgt #1#2%
+{%
+ \if1\xintiiCmp{#1}{#2}%
+ \expandafter\xint_firstoftwo_thenstop
+ \else\expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
\def\xintifLt {\romannumeral0\xintiflt }%
\def\xintiflt #1#2%
{%
@@ -266,6 +302,23 @@
\else \expandafter\xint_secondoftwo_thenstop
\fi
}%
+\def\xintiiifLt {\romannumeral0\xintiiiflt }%
+\def\xintiiiflt #1#2%
+{%
+ \ifnum\xintiiCmp{#1}{#2}<\xint_c_
+ \expandafter\xint_firstoftwo_thenstop
+ \else \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
+\def\xintiiifOdd {\romannumeral0\xintiiifodd }%
+\def\xintiiifodd #1%
+{%
+ \if\xintiiOdd{#1}1%
+ \expandafter\xint_firstoftwo_thenstop
+ \else
+ \expandafter\xint_secondoftwo_thenstop
+ \fi
+}%
\def\xintifOdd {\romannumeral0\xintifodd }%
\def\xintifodd #1%
{%
@@ -284,6 +337,15 @@
{%
\expandafter\XINT_cmp_fork \romannumeral0\xintnum{#2}\Z #1\Z
}%
+\def\xintiiCmp {\romannumeral0\xintiicmp }%
+\def\xintiicmp #1%
+{%
+ \expandafter\xint_iicmp\expandafter{\romannumeral-`0#1}%
+}%
+\def\xint_iicmp #1#2%
+{%
+ \expandafter\XINT_cmp_fork \romannumeral-`0#2\Z #1\Z
+}%
\def\XINT_Cmp #1#2{\romannumeral0\XINT_cmp_fork #2\Z #1\Z }%
\def\XINT_cmp_fork #1#2\Z #3#4\Z
{%
@@ -381,15 +443,18 @@
\def\XINT_OneIfPositive_finish #1\W\X\Y\Z{ 1}%
\def\xint_OneIfPositive_backtomain 0\XINT_OneIfPositive_finish 0%
{\XINT_OneIfPositive_main }%
-\def\xintEq {\romannumeral0\xinteq }%
-\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}%
-\def\xintGt {\romannumeral0\xintgt }%
-\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}%
-\def\xintLt {\romannumeral0\xintlt }%
-\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
+\def\xintEq {\romannumeral0\xinteq }\def\xinteq #1#2{\xintifeq{#1}{#2}{1}{0}}%
+\def\xintGt {\romannumeral0\xintgt }\def\xintgt #1#2{\xintifgt{#1}{#2}{1}{0}}%
+\def\xintLt {\romannumeral0\xintlt }\def\xintlt #1#2{\xintiflt{#1}{#2}{1}{0}}%
\def\xintLtorEq #1#2{\romannumeral0\xintifgt {#1}{#2}{0}{1}}%
\def\xintGtorEq #1#2{\romannumeral0\xintiflt {#1}{#2}{0}{1}}%
\def\xintNeq #1#2{\romannumeral0\xintifeq {#1}{#2}{0}{1}}%
+\def\xintiiEq #1#2{\romannumeral0\xintiiifeq{#1}{#2}{1}{0}}%
+\def\xintiiGt #1#2{\romannumeral0\xintiiifgt{#1}{#2}{1}{0}}%
+\def\xintiiLt #1#2{\romannumeral0\xintiiiflt{#1}{#2}{1}{0}}%
+\def\xintiiLtorEq #1#2{\romannumeral0\xintiiifgt {#1}{#2}{0}{1}}%
+\def\xintiiGtorEq #1#2{\romannumeral0\xintiiiflt {#1}{#2}{0}{1}}%
+\def\xintiiNeq #1#2{\romannumeral0\xintiiifeq {#1}{#2}{0}{1}}%
\def\xintIsZero {\romannumeral0\xintiszero }%
\def\xintiszero #1{\if0\xintSgn{#1}\xint_afterfi{ 1}\else\xint_afterfi{ 0}\fi}%
\def\xintIsNotZero {\romannumeral0\xintisnotzero }%
@@ -1331,20 +1396,19 @@
{%
\noexpand\expandafter\space\noexpand\the\numexpr #1#2#3#4#5#6#7\relax
}%
-\def\xintiiSqrt {\romannumeral0\xintiisqrt }%
-\def\xintiisqrt
- {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }%
-\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z
- \W\W\W\W\W\W\W\W }%
+\def\xintiiSqrt {\romannumeral0\xintiisqrt }%
+\def\xintiiSqrtR {\romannumeral0\xintiisqrtr }%
\def\xintiiSquareRoot {\romannumeral0\xintiisquareroot }%
-\def\xintiisquareroot #1%
- {\expandafter\XINT_sqrt_checkin\romannumeral-`0#1\Z}%
-\def\xintiSqrt {\romannumeral0\xintisqrt }%
-\def\xintisqrt
- {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }%
-\def\xintiSquareRoot {\romannumeral0\xintisquareroot }%
-\def\xintisquareroot #1%
- {\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\Z}%
+\def\xintiSqrt {\romannumeral0\xintisqrt }%
+\def\xintiSquareRoot {\romannumeral0\xintisquareroot }%
+\def\xintisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintisquareroot }%
+\def\xintiisqrt {\expandafter\XINT_sqrt_post\romannumeral0\xintiisquareroot }%
+\def\xintiisqrtr {\expandafter\XINT_sqrtr_post\romannumeral0\xintiisquareroot }%
+\def\XINT_sqrt_post #1#2{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W }%
+\def\XINT_sqrtr_post #1#2{\xintiiifLt {#2}{#1}% Lt <-> a<b
+ { #1}{\XINT_dec_pos #1\R\R\R\R\R\R\R\R\Z \W\W\W\W\W\W\W\W }}%
+\def\xintisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral0\xintnum{#1}\Z }%
+\def\xintiisquareroot #1{\expandafter\XINT_sqrt_checkin\romannumeral-`0#1\Z }%
\def\XINT_sqrt_checkin #1%
{%
\xint_UDzerominusfork
@@ -1353,12 +1417,11 @@
0-{\XINT_sqrt #1}%
\krof
}%
-\def\XINT_sqrt_iszero #1\Z { 1.}%
-\edef\XINT_sqrt_isneg #1\Z {\noexpand\xintError:RootOfNegative\space 1.}%
+\def\XINT_sqrt_iszero #1\Z { 11}%
+\edef\XINT_sqrt_isneg #1\Z {\noexpand\xintError:RootOfNegative\space 11}%
\def\XINT_sqrt #1\Z
{%
- \expandafter\XINT_sqrt_start\expandafter
- {\romannumeral0\xintlength {#1}}{#1}%
+ \expandafter\XINT_sqrt_start\expandafter {\romannumeral0\xintlength {#1}}{#1}%
}%
\def\XINT_sqrt_start #1%
{%