summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintcore.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xintcore.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xintcore.sty83
1 files changed, 62 insertions, 21 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xintcore.sty b/Master/texmf-dist/tex/generic/xint/xintcore.sty
index b1f73e6a6c6..953355c6684 100644
--- a/Master/texmf-dist/tex/generic/xint/xintcore.sty
+++ b/Master/texmf-dist/tex/generic/xint/xintcore.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2o 2017/08/29
+%% The xint bundle 1.2p 2017/12/05
%% Copyright (C) 2013-2017 by Jean-Francois Burnol
%% xintcore: Expandable arithmetic on big integers
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xintcore}%
- [2017/08/29 1.2o Expandable arithmetic on big integers (JFB)]%
+ [2017/12/05 1.2p Expandable arithmetic on big integers (JFB)]%
\csname XINT_Clamped_istrapped\endcsname
\csname XINT_ConversionSyntax_istrapped\endcsname
\csname XINT_DivisionByZero_istrapped\endcsname
@@ -1869,11 +1869,13 @@
\romannumeral`&&@#3\xint:#2\xint:}%
\def\XINT_iidivtrunc_a #1#2% #1 de A, #2 de B.
{%
- \if0#2\xint_dothis{\XINT_iidivround_divbyzero#1#2}\fi
- \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
+ \if0#2\xint_dothis{\XINT_iidivtrunc_divbyzero#1#2}\fi
+ \if0#1\xint_dothis\XINT_iidivtrunc_aiszero\fi
\if-#2\xint_dothis{\XINT_iidivtrunc_bneg #1}\fi
\xint_orthat{\XINT_iidivtrunc_bpos #1#2}%
}%
+\let\XINT_iidivtrunc_divbyzero\XINT_iidivround_divbyzero
+\let\XINT_iidivtrunc_aiszero \XINT_iidivround_aiszero
\def\XINT_iidivtrunc_bpos #1%
{%
\xint_UDsignfork
@@ -1891,36 +1893,75 @@
\def\XINT_iidivtrunc_pos #1#2\xint:#3\xint:
{\expandafter\xint_firstoftwo_thenstop
\romannumeral0\XINT_div_prepare {#2}{#1#3}}%
-\def\xintiMod {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMod}\xintimod }%
-\def\xintimod #1{\expandafter\XINT_iimod\romannumeral0\xintnum{#1}\xint:}%
-\def\xintiiMod {\romannumeral0\xintiimod }%
-\def\xintiimod #1{\expandafter\XINT_iimod\romannumeral`&&@#1\xint:}%
-\def\XINT_iimod #1#2\xint:#3{\expandafter\XINT_iimod_a\expandafter #1%
+\def\xintiMod {\romannumeral0\XINT_signaldeprecated{xintcore}{xintiMod}\xintimod }%
+\def\xintimod #1{\expandafter\XINT_iimodtrunc\romannumeral0\xintnum{#1}\xint:}%
+\def\xintiiModTrunc {\romannumeral0\xintiimodtrunc }%
+\def\xintiimodtrunc #1{\expandafter\XINT_iimodtrunc\romannumeral`&&@#1\xint:}%
+\def\XINT_iimodtrunc #1#2\xint:#3{\expandafter\XINT_iimodtrunc_a\expandafter #1%
\romannumeral`&&@#3\xint:#2\xint:}%
-\def\XINT_iimod_a #1#2% #1 de A, #2 de B.
+\def\XINT_iimodtrunc_a #1#2% #1 de A, #2 de B.
{%
- \if0#2\xint_dothis{\XINT_iidivround_divbyzero#1#2}\fi
- \if0#1\xint_dothis\XINT_iidivround_aiszero\fi
- \if-#2\xint_dothis{\XINT_iimod_bneg #1}\fi
- \xint_orthat{\XINT_iimod_bpos #1#2}%
+ \if0#2\xint_dothis{\XINT_iimodtrunc_divbyzero#1#2}\fi
+ \if0#1\xint_dothis\XINT_iimodtrunc_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iimodtrunc_bneg #1}\fi
+ \xint_orthat{\XINT_iimodtrunc_bpos #1#2}%
}%
-\def\XINT_iimod_bpos #1%
+\let\XINT_iimodtrunc_divbyzero\XINT_iidivround_divbyzero
+\let\XINT_iimodtrunc_aiszero \XINT_iidivround_aiszero
+\def\XINT_iimodtrunc_bpos #1%
{%
\xint_UDsignfork
- #1{\xintiiopp\XINT_iimod_pos {}}%
- -{\XINT_iimod_pos #1}%
+ #1{\xintiiopp\XINT_iimodtrunc_pos {}}%
+ -{\XINT_iimodtrunc_pos #1}%
\krof
}%
-\def\XINT_iimod_bneg #1%
+\def\XINT_iimodtrunc_bneg #1%
{%
\xint_UDsignfork
- #1{\xintiiopp\XINT_iimod_pos {}}%
- -{\XINT_iimod_pos #1}%
+ #1{\xintiiopp\XINT_iimodtrunc_pos {}}%
+ -{\XINT_iimodtrunc_pos #1}%
\krof
}%
-\def\XINT_iimod_pos #1#2\xint:#3\xint:
+\def\XINT_iimodtrunc_pos #1#2\xint:#3\xint:
{\expandafter\xint_secondoftwo_thenstop\romannumeral0\XINT_div_prepare
{#2}{#1#3}}%
+\def\xintiiDivMod {\romannumeral0\xintiidivmod }%
+\def\xintiidivmod #1{\expandafter\XINT_iidivmod\romannumeral`&&@#1\xint:}%
+\def\XINT_iidivmod #1#2\xint:#3{\expandafter\XINT_iidivmod_a\expandafter #1%
+ \romannumeral`&&@#3\xint:#2\xint:}%
+\def\XINT_iidivmod_a #1#2% #1 de A, #2 de B.
+{%
+ \if0#2\xint_dothis{\XINT_iidivmod_divbyzero#1#2}\fi
+ \if0#1\xint_dothis\XINT_iidivmod_aiszero\fi
+ \if-#2\xint_dothis{\XINT_iidivmod_bneg #1}\fi
+ \xint_orthat{\XINT_iidivmod_bpos #1#2}%
+}%
+\def\XINT_iidivmod_divbyzero #1#2\xint:#3\xint:
+{%
+ \XINT_signalcondition{DivisionByZero}{Division by #2 of #1#3}{}%
+ {{0}{0}}% à revoir...
+}%
+\def\XINT_iidivmod_aiszero #1#2\xint:#3\xint:{{0}{0}}%
+\def\XINT_iidivmod_bneg #1%
+{%
+ \expandafter\XINT_iidivmod_bneg_finish
+ \romannumeral0\xint_UDsignfork
+ #1{\XINT_iidivmod_bpos {}}%
+ -{\XINT_iidivmod_bpos {-#1}}%
+ \krof
+}%
+\def\XINT_iidivmod_bneg_finish#1#2%
+{%
+ \expandafter\xint_exchangetwo_keepbraces\expandafter
+ {\romannumeral0\xintiiopp#2}{#1}%
+}%
+\def\XINT_iidivmod_bpos #1#2\xint:#3\xint:{\xintiidivision{#1#3}{#2}}%
+\def\xintiiDivFloor {\romannumeral0\xintiidivfloor}%
+\def\xintiidivfloor {\expandafter\xint_firstoftwo_thenstop
+ \romannumeral0\xintiidivmod}%
+\def\xintiiMod {\romannumeral0\xintiimod}%
+\def\xintiimod {\expandafter\xint_secondoftwo_thenstop
+ \romannumeral0\xintiidivmod}%
\def\xintiiSqr {\romannumeral0\xintiisqr }%
\def\xintiisqr #1%
{%