aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/realzero.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-03-12 17:04:43 +0000
committerdos-reis <gdr@axiomatics.org>2011-03-12 17:04:43 +0000
commit52fddea19454dc2b9bcb54c6edd5a4cd4f5765a9 (patch)
tree4b13ccc6d57c7c1ee615c83615b246c98eae388a /src/algebra/realzero.spad.pamphlet
parent42d38bee45a64edfc12641053e58581c20584363 (diff)
downloadopen-axiom-52fddea19454dc2b9bcb54c6edd5a4cd4f5765a9.tar.gz
* src/algebra/: Systematically use negative? when comparing for
less than 0.
Diffstat (limited to 'src/algebra/realzero.spad.pamphlet')
-rw-r--r--src/algebra/realzero.spad.pamphlet14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/algebra/realzero.spad.pamphlet b/src/algebra/realzero.spad.pamphlet
index 5f5d3235..cee4a98e 100644
--- a/src/algebra/realzero.spad.pamphlet
+++ b/src/algebra/realzero.spad.pamphlet
@@ -158,12 +158,12 @@ RealZeroPackage(Pol): T == C where
rootBound(F : Pol) == --returns power of 2 that is a bound
--for the positive roots of F
- if leadingCoefficient(F) < 0 then F := -F
+ if negative? leadingCoefficient(F) then F := -F
lcoef := leadingCoefficient(F)
F := reductum(F)
i : Integer := 0
while not (F = 0) repeat
- if (an := leadingCoefficient(F)) < 0 then i := i - an
+ if negative?(an := leadingCoefficient(F)) then i := i - an
F := reductum(F)
b : Integer := 1
while (b * lcoef) <= i repeat
@@ -241,9 +241,9 @@ RealZeroPackage(Pol): T == C where
i : Integer := 0
LastCoef : Boolean
next : Boolean
- LastCoef := leadingCoefficient(F) < 0
+ LastCoef := negative? leadingCoefficient(F)
while not ((F := reductum(F)) = 0) repeat
- next := leadingCoefficient(F) < 0
+ next := negative? leadingCoefficient(F)
if ((not LastCoef) and next) or
((not next) and LastCoef) then i := i+1
LastCoef := next
@@ -251,7 +251,7 @@ RealZeroPackage(Pol): T == C where
refine(F : Pol, int : Interval, bounds : Interval) ==
lseg := min(int.right,bounds.right) - max(int.left,bounds.left)
- lseg < 0 => "failed"
+ negative? lseg => "failed"
lseg = 0 =>
pt :=
int.left = bounds.right => int.left
@@ -278,14 +278,14 @@ RealZeroPackage(Pol): T == C where
v:=elt(transMultInv(bd, F), bn)
u:=elt(transMultInv(ad, F), an)
if u > 0 then (F:=-F;v:=-v)
- if v < 0 then
+ if negative? v then
error [int, "is not a valid isolation interval for", F]
if eps <= 0 then error "precision must be positive"
while (b - a) >= eps repeat
mid : RN := (b + a) * (1/2)
midn : Integer := numer(mid)
midd : Integer := denom(mid)
- (v := elt(transMultInv(midd, F), midn)) < 0 =>
+ negative?(v := elt(transMultInv(midd, F), midn)) =>
a := mid
an := midn
ad := midd