summaryrefslogtreecommitdiff
path: root/macros/generic/polexpr/polexprsturm.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/polexpr/polexprsturm.tex')
-rw-r--r--macros/generic/polexpr/polexprsturm.tex31
1 files changed, 16 insertions, 15 deletions
diff --git a/macros/generic/polexpr/polexprsturm.tex b/macros/generic/polexpr/polexprsturm.tex
index f2ac7c0d17..317b9cbcd3 100644
--- a/macros/generic/polexpr/polexprsturm.tex
+++ b/macros/generic/polexpr/polexprsturm.tex
@@ -1,4 +1,4 @@
-%% This file polexprsturm.tex is part of the polexpr package (0.8.3, 2021/05/27)
+%% This file polexprsturm.tex is part of the polexpr package (0.8.4, 2021/11/01)
%% Sturm Algorithm (polexpr 0.4)
%% 0.5 uses primitive polynomials for faster evaluations afterwards
%% 0.6 corrects misuse of \@ifstar! (mumble). \PolToSturm* was broken.
@@ -196,17 +196,7 @@
\edef\POL@sturm@N{\@nameuse{PolSturmChainLength_\POL@sturmname}}%
% isolate the roots (detects case of constant polynomial)
\PolSturmIsolateZeros@{\POL@sturmname}%
- \ifnum\POL@isolz@NbOfRoots=\z@
- % no real roots, define empty arrays nevertheless
- \begingroup\globaldefs\@ne
- \expandafter\xintAssignArray\expandafter\to\csname POL_ZM\POL@sturmname*\endcsname
- \expandafter\xintAssignArray\expandafter\to\csname POL_RI\POL@sturmname*\endcsname
- \endgroup
- \else
- % all we currently know is that multiplicities are at least one
- \begingroup\globaldefs\@ne
- \expandafter\POL@initarray\csname POL_ZM\POL@sturmname*\endcsname{1}%
- \endgroup
+ % 0.8.4 fix: these declarations were formerly not executed in absence of roots!
% on ne va pas utiliser de Horner, mais des divisions par X - x, et ces
% choses vont évoluer, ainsi que le coefficient dominant entier
% (pour \POL@divide entre autres if faut des noms de user pol)
@@ -218,6 +208,17 @@
\expandafter\let
\csname POLuserpol@\POL@sturmname\POL@norr\expandafter\endcsname
\csname POLuserpol@\POL@sturmname _0_\endcsname
+ \ifnum\POL@isolz@NbOfRoots=\z@
+ % no real roots, define empty arrays nevertheless
+ \begingroup\globaldefs\@ne
+ \expandafter\xintAssignArray\expandafter\to\csname POL_ZM\POL@sturmname*\endcsname
+ \expandafter\xintAssignArray\expandafter\to\csname POL_RI\POL@sturmname*\endcsname
+ \endgroup
+ \else
+ % all we currently know is that multiplicities are at least one
+ \begingroup\globaldefs\@ne
+ \expandafter\POL@initarray\csname POL_ZM\POL@sturmname*\endcsname{1}%
+ \endgroup
% attention formé avec\xintREZ d'où le \xintAbs pas \xintiiAbs
% D and its exponent E will get updated along the way
\edef\POL@findrat@D{\xintAbs{\PolLeadingCoeff{\POL@sturmname _0}}}%
@@ -243,12 +244,12 @@
\def\POL@findrat@index{1}%
\POL@findrat@loop@secondpass
\fi
- % declare the new polynomials
- \POL@newpol{\POL@sturmname\POL@sqfnorr}% without multiplicities
- \POL@newpol{\POL@sturmname\POL@norr}% with multiplicities
% declare the array holding the interval indices for the rational roots
\expandafter\POL@findrat@doRRarray\csname POL_RI\POL@sturmname*\endcsname
\fi
+ % declare the new polynomials (also if no real roots exist)
+ \POL@newpol{\POL@sturmname\POL@sqfnorr}% without multiplicities
+ \POL@newpol{\POL@sturmname\POL@norr}% with multiplicities
}%
\def\POL@findrat@doRRarray#1{%
% il faudrait un \xintAssignArray* qui fasse même expansion que \xintFor*