summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xint.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-06 22:02:47 +0000
committerKarl Berry <karl@freefriends.org>2019-01-06 22:02:47 +0000
commit3354abdc519630ad9975bfce46bada2882fcd6af (patch)
treef803a9bf96bd1c8eb2b618218f06fb20306bf387 /Master/texmf-dist/tex/generic/xint/xint.sty
parentbee0d2fefd913952b342b909a4a278ce72712e51 (diff)
xint (6jan19)
git-svn-id: svn://tug.org/texlive/trunk@49617 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.sty145
1 files changed, 100 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty
index 8e8e9405307..f8413488235 100644
--- a/Master/texmf-dist/tex/generic/xint/xint.sty
+++ b/Master/texmf-dist/tex/generic/xint/xint.sty
@@ -21,8 +21,8 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.3c 2018/06/17
-%% Copyright (C) 2013-2018 by Jean-Francois Burnol
+%% The xint bundle 1.3d 2019/01/06
+%% Copyright (C) 2013-2019 by Jean-Francois Burnol
%% xint: Expandable operations on big integers
%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
@@ -70,13 +70,13 @@
\XINTsetupcatcodes% defined in xintkernel.sty (loaded by xintcore.sty)
\XINT_providespackage
\ProvidesPackage{xint}%
- [2018/06/17 1.3c Expandable operations on big integers (JFB)]%
+ [2019/01/06 1.3d 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}%
-\long\def\xint_firstofthree_thenstop #1#2#3{ #1}% 1.09i
-\long\def\xint_secondofthree_thenstop #1#2#3{ #2}%
-\long\def\xint_thirdofthree_thenstop #1#2#3{ #3}%
+\long\def\xint_stop_atfirstofthree #1#2#3{ #1}%
+\long\def\xint_stop_atsecondofthree #1#2#3{ #2}%
+\long\def\xint_stop_atthirdofthree #1#2#3{ #3}%
\ifdefined\xint_texuniformdeviate
\unless\ifdefined\xint_c_nine_x^viii
\csname newcount\endcsname\xint_c_nine_x^viii
@@ -255,7 +255,7 @@
\def\XINT_dshr_xzeroorneg #1;{ 0}%
\def\XINT_dshr_xpositive
{%
- \expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_dsx_xisPos
+ \expandafter\xint_stop_atsecondoftwo\romannumeral0\XINT_dsx_xisPos
}%
\def\xintDSH {\romannumeral0\xintdsh }%
\def\xintdsh #1#2%
@@ -273,7 +273,7 @@
\def\XINT_dsh_xiszero #1.#2;{ #2}%
\def\XINT_dsh_xisPos
{%
- \expandafter\xint_firstoftwo_thenstop\romannumeral0\XINT_dsx_xisPos
+ \expandafter\xint_stop_atfirstoftwo\romannumeral0\XINT_dsx_xisPos
}%
\def\xintDSx {\romannumeral0\xintdsx }%
\def\xintdsx #1#2%
@@ -442,87 +442,87 @@
\def\xintSgnFork {\romannumeral0\xintsgnfork }%
\def\xintsgnfork #1%
{%
- \ifcase #1 \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
+ \ifcase #1 \expandafter\xint_stop_atsecondofthree
+ \or\expandafter\xint_stop_atthirdofthree
+ \else\expandafter\xint_stop_atfirstofthree
\fi
}%
\def\xintiiifSgn {\romannumeral0\xintiiifsgn }%
\def\xintiiifsgn #1%
{%
\ifcase \xintiiSgn{#1}
- \expandafter\xint_secondofthree_thenstop
- \or\expandafter\xint_thirdofthree_thenstop
- \else\expandafter\xint_firstofthree_thenstop
+ \expandafter\xint_stop_atsecondofthree
+ \or\expandafter\xint_stop_atthirdofthree
+ \else\expandafter\xint_stop_atfirstofthree
\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
+ \expandafter\xint_stop_atsecondofthree
+ \or\expandafter\xint_stop_atthirdofthree
+ \else\expandafter\xint_stop_atfirstofthree
\fi
}%
\def\xintiiifEq {\romannumeral0\xintiiifeq }%
\def\xintiiifeq #1#2%
{%
\if0\xintiiCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else\expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintiiifGt {\romannumeral0\xintiiifgt }%
\def\xintiiifgt #1#2%
{%
\if1\xintiiCmp{#1}{#2}%
- \expandafter\xint_firstoftwo_thenstop
- \else\expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else\expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintiiifLt {\romannumeral0\xintiiiflt }%
\def\xintiiiflt #1#2%
{%
\ifnum\xintiiCmp{#1}{#2}<\xint_c_
- \expandafter\xint_firstoftwo_thenstop
- \else \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
+ \else \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintiiifZero {\romannumeral0\xintiiifzero }%
\def\xintiiifzero #1%
{%
\if0\xintiiSgn{#1}%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintiiifNotZero {\romannumeral0\xintiiifnotzero }%
\def\xintiiifnotzero #1%
{%
\if0\xintiiSgn{#1}%
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\else
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\fi
}%
\def\xintiiifOne {\romannumeral0\xintiiifone }%
\def\xintiiifone #1%
{%
\if1\xintiiIsOne{#1}%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintiiifOdd {\romannumeral0\xintiiifodd }%
\def\xintiiifodd #1%
{%
\if\xintiiOdd{#1}1%
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
}%
\def\xintifTrueAelseB {\romannumeral0\xintiiifnotzero}%
@@ -592,17 +592,17 @@
\krof }%
\krof
#3#1#2\xint:#4\xint:
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\else
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\fi
{#3#4}{#1#2}%
}%
-\def\XINT_max_zerozero #1\fi{\xint_firstoftwo_thenstop }%
-\def\XINT_max_zeroplus #1\fi{\xint_secondoftwo_thenstop }%
-\def\XINT_max_pluszero #1\fi{\xint_firstoftwo_thenstop }%
-\def\XINT_max_minusplus #1\fi{\xint_secondoftwo_thenstop }%
-\def\XINT_max_plusminus #1\fi{\xint_firstoftwo_thenstop }%
+\def\XINT_max_zerozero #1\fi{\xint_stop_atfirstoftwo }%
+\def\XINT_max_zeroplus #1\fi{\xint_stop_atsecondoftwo }%
+\def\XINT_max_pluszero #1\fi{\xint_stop_atfirstoftwo }%
+\def\XINT_max_minusplus #1\fi{\xint_stop_atsecondoftwo }%
+\def\XINT_max_plusminus #1\fi{\xint_stop_atfirstoftwo }%
\def\XINT_max_plusplus
{%
\if1\romannumeral0\XINT_geq_plusplus
@@ -634,17 +634,17 @@
\krof }%
\krof
#3#1#2\xint:#4\xint:
- \expandafter\xint_secondoftwo_thenstop
+ \expandafter\xint_stop_atsecondoftwo
\else
- \expandafter\xint_firstoftwo_thenstop
+ \expandafter\xint_stop_atfirstoftwo
\fi
{#3#4}{#1#2}%
}%
-\def\XINT_min_zerozero #1\fi{\xint_firstoftwo_thenstop }%
-\def\XINT_min_zeroplus #1\fi{\xint_firstoftwo_thenstop }%
-\def\XINT_min_pluszero #1\fi{\xint_secondoftwo_thenstop }%
-\def\XINT_min_minusplus #1\fi{\xint_firstoftwo_thenstop }%
-\def\XINT_min_plusminus #1\fi{\xint_secondoftwo_thenstop }%
+\def\XINT_min_zerozero #1\fi{\xint_stop_atfirstoftwo }%
+\def\XINT_min_zeroplus #1\fi{\xint_stop_atfirstoftwo }%
+\def\XINT_min_pluszero #1\fi{\xint_stop_atsecondoftwo }%
+\def\XINT_min_minusplus #1\fi{\xint_stop_atfirstoftwo }%
+\def\XINT_min_plusminus #1\fi{\xint_stop_atsecondoftwo }%
\def\XINT_min_plusplus
{%
\if1\romannumeral0\XINT_geq_plusplus
@@ -1378,6 +1378,61 @@
\def\xintBool #1{\romannumeral`&&@%
\csname if#1\endcsname\expandafter1\else\expandafter0\fi }%
\def\xintToggle #1{\romannumeral`&&@\iftoggle{#1}{1}{0}}%
+\def\xintiiGCD {\romannumeral0\xintiigcd }%
+\def\xintiigcd #1{\expandafter\XINT_iigcd\romannumeral0\xintiiabs#1\xint:}%
+\def\XINT_iigcd #1#2\xint:#3%
+{%
+ \expandafter\XINT_gcd_fork\expandafter#1%
+ \romannumeral0\xintiiabs#3\xint:#1#2\xint:
+}%
+\def\XINT_gcd_fork #1#2%
+{%
+ \xint_UDzerofork
+ #1\XINT_gcd_Aiszero
+ #2\XINT_gcd_Biszero
+ 0\XINT_gcd_loop
+ \krof
+ #2%
+}%
+\def\XINT_gcd_AisZero #1\xint:#2\xint:{ #1}%
+\def\XINT_gcd_BisZero #1\xint:#2\xint:{ #2}%
+\def\XINT_gcd_loop #1\xint:#2\xint:
+{%
+ \expandafter\expandafter\expandafter\XINT_gcd_CheckRem
+ \expandafter\xint_secondoftwo
+ \romannumeral0\XINT_div_prepare {#1}{#2}\xint:#1\xint:
+}%
+\def\XINT_gcd_CheckRem #1%
+{%
+ \xint_gob_til_zero #1\XINT_gcd_end0\XINT_gcd_loop #1%
+}%
+\def\XINT_gcd_end0\XINT_gcd_loop #1\xint:#2\xint:{ #2}%
+\def\xintiiLCM {\romannumeral0\xintiilcm}%
+\def\xintiilcm #1{\expandafter\XINT_iilcm\romannumeral0\xintiiabs#1\xint:}%
+\def\XINT_iilcm #1#2\xint:#3%
+{%
+ \expandafter\XINT_lcm_fork\expandafter#1%
+ \romannumeral0\xintiiabs#3\xint:#1#2\xint:
+}%
+\def\XINT_lcm_fork #1#2%
+{%
+ \xint_UDzerofork
+ #1\XINT_lcm_iszero
+ #2\XINT_lcm_iszero
+ 0\XINT_lcm_notzero
+ \krof
+ #2%
+}%
+\def\XINT_lcm_iszero #1\xint:#2\xint:{ 0}%
+\def\XINT_lcm_notzero #1\xint:#2\xint:
+{%
+ \expandafter\XINT_lcm_end\romannumeral0%
+ \expandafter\expandafter\expandafter\XINT_gcd_CheckRem
+ \expandafter\xint_secondoftwo
+ \romannumeral0\XINT_div_prepare {#1}{#2}\xint:#1\xint:
+ \xint:#1\xint:#2\xint:
+}%
+\def\XINT_lcm_end #1\xint:#2\xint:#3\xint:{\xintiimul {#2}{\xintiiQuo{#3}{#1}}}%
\def\xintRandomDigits{\romannumeral0\xintrandomdigits}%
\def\xintrandomdigits#1%
{%