aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/aggcat.spad.pamphlet10
-rw-r--r--src/algebra/array1.spad.pamphlet14
-rw-r--r--src/algebra/carten.spad.pamphlet6
-rw-r--r--src/algebra/catdef.spad.pamphlet6
-rw-r--r--src/algebra/clip.spad.pamphlet4
-rw-r--r--src/algebra/color.spad.pamphlet6
-rw-r--r--src/algebra/combinat.spad.pamphlet14
-rw-r--r--src/algebra/complet.spad.pamphlet4
-rw-r--r--src/algebra/constant.spad.pamphlet2
-rw-r--r--src/algebra/contfrac.spad.pamphlet6
-rw-r--r--src/algebra/crfp.spad.pamphlet2
-rw-r--r--src/algebra/curve.spad.pamphlet4
-rw-r--r--src/algebra/data.spad.pamphlet6
-rw-r--r--src/algebra/defintef.spad.pamphlet4
-rw-r--r--src/algebra/defintrf.spad.pamphlet2
-rw-r--r--src/algebra/divisor.spad.pamphlet8
-rw-r--r--src/algebra/efstruc.spad.pamphlet4
-rw-r--r--src/algebra/efuls.spad.pamphlet8
-rw-r--r--src/algebra/efupxs.spad.pamphlet16
-rw-r--r--src/algebra/elemntry.spad.pamphlet2
-rw-r--r--src/algebra/float.spad.pamphlet24
-rw-r--r--src/algebra/fnla.spad.pamphlet2
-rw-r--r--src/algebra/formula.spad.pamphlet2
-rw-r--r--src/algebra/fr.spad.pamphlet4
-rw-r--r--src/algebra/fraction.spad.pamphlet8
-rw-r--r--src/algebra/free.spad.pamphlet4
-rw-r--r--src/algebra/fs2expxp.spad.pamphlet8
-rw-r--r--src/algebra/fs2ups.spad.pamphlet10
-rw-r--r--src/algebra/galfact.spad.pamphlet12
-rw-r--r--src/algebra/gaussian.spad.pamphlet2
-rw-r--r--src/algebra/gpol.spad.pamphlet6
-rw-r--r--src/algebra/integer.spad.pamphlet2
-rw-r--r--src/algebra/interval.spad.pamphlet4
-rw-r--r--src/algebra/intfact.spad.pamphlet6
-rw-r--r--src/algebra/intpm.spad.pamphlet4
-rw-r--r--src/algebra/irexpand.spad.pamphlet4
-rw-r--r--src/algebra/kl.spad.pamphlet2
-rw-r--r--src/algebra/laurent.spad.pamphlet28
-rw-r--r--src/algebra/limitps.spad.pamphlet4
-rw-r--r--src/algebra/listgcd.spad.pamphlet2
-rw-r--r--src/algebra/manip.spad.pamphlet2
-rw-r--r--src/algebra/mathml.spad.pamphlet2
-rw-r--r--src/algebra/mlift.spad.pamphlet2
-rw-r--r--src/algebra/moddfact.spad.pamphlet2
-rw-r--r--src/algebra/numquad.spad.pamphlet12
-rw-r--r--src/algebra/numtheor.spad.pamphlet28
-rw-r--r--src/algebra/oderf.spad.pamphlet2
-rw-r--r--src/algebra/opalg.spad.pamphlet2
-rw-r--r--src/algebra/ore.spad.pamphlet2
-rw-r--r--src/algebra/outform.spad.pamphlet4
-rw-r--r--src/algebra/pade.spad.pamphlet2
-rw-r--r--src/algebra/patmatch1.spad.pamphlet2
-rw-r--r--src/algebra/permgrps.spad.pamphlet8
-rw-r--r--src/algebra/puiseux.spad.pamphlet4
-rw-r--r--src/algebra/radix.spad.pamphlet6
-rw-r--r--src/algebra/random.spad.pamphlet2
-rw-r--r--src/algebra/rdeef.spad.pamphlet4
-rw-r--r--src/algebra/rderf.spad.pamphlet6
-rw-r--r--src/algebra/rdesys.spad.pamphlet2
-rw-r--r--src/algebra/realzero.spad.pamphlet14
-rw-r--r--src/algebra/reclos.spad.pamphlet10
-rw-r--r--src/algebra/sf.spad.pamphlet2
-rw-r--r--src/algebra/sgcf.spad.pamphlet8
-rw-r--r--src/algebra/si.spad.pamphlet4
-rw-r--r--src/algebra/solvedio.spad.pamphlet2
-rw-r--r--src/algebra/stream.spad.pamphlet2
-rw-r--r--src/algebra/string.spad.pamphlet14
-rw-r--r--src/algebra/sttaylor.spad.pamphlet4
-rw-r--r--src/algebra/sum.spad.pamphlet4
-rw-r--r--src/algebra/term.spad.pamphlet2
-rw-r--r--src/algebra/tex.spad.pamphlet2
-rw-r--r--src/algebra/twofact.spad.pamphlet2
-rw-r--r--src/algebra/unifact.spad.pamphlet8
-rw-r--r--src/algebra/view2D.spad.pamphlet6
-rw-r--r--src/algebra/view3D.spad.pamphlet6
-rw-r--r--src/algebra/viewDef.spad.pamphlet2
-rw-r--r--src/algebra/wtpol.spad.pamphlet2
-rw-r--r--src/algebra/zerodim.spad.pamphlet2
78 files changed, 230 insertions, 226 deletions
diff --git a/src/algebra/aggcat.spad.pamphlet b/src/algebra/aggcat.spad.pamphlet
index 1241838b..8e9a0b23 100644
--- a/src/algebra/aggcat.spad.pamphlet
+++ b/src/algebra/aggcat.spad.pamphlet
@@ -1742,12 +1742,13 @@ StreamAggregate(S:Type): Category ==
elt(x:%, i:Integer) ==
i := i - minIndex x
- (i < 0) or empty?(x := rest(x, i::NonNegativeInteger)) => error "index out of range"
+ negative? i or empty?(x := rest(x, i::NonNegativeInteger)) =>
+ error "index out of range"
first x
elt(x:%, i:UniversalSegment(Integer)) ==
l := lo(i) - minIndex x
- l < 0 => error "index out of range"
+ negative? l => error "index out of range"
not hasHi i => copy(rest(x, l::NonNegativeInteger))
(h := hi(i) - minIndex x) < l => empty()
first(rest(x, l::NonNegativeInteger), (h - l + 1)::NonNegativeInteger)
@@ -1773,11 +1774,12 @@ StreamAggregate(S:Type): Category ==
setelt(x:%, i:Integer, s:S) ==
i := i - minIndex x
- (i < 0) or empty?(x := rest(x,i::NonNegativeInteger)) => error "index out of range"
+ negative? i or empty?(x := rest(x,i::NonNegativeInteger)) =>
+ error "index out of range"
setfirst!(x, s)
setelt(x:%, i:UniversalSegment(Integer), s:S) ==
- (l := lo(i) - minIndex x) < 0 => error "index out of range"
+ negative?(l := lo(i) - minIndex x) => error "index out of range"
h := if hasHi i then hi(i) - minIndex x else maxIndex x
h < l => s
y := rest(x, l::NonNegativeInteger)
diff --git a/src/algebra/array1.spad.pamphlet b/src/algebra/array1.spad.pamphlet
index 92feee53..0a521e77 100644
--- a/src/algebra/array1.spad.pamphlet
+++ b/src/algebra/array1.spad.pamphlet
@@ -272,21 +272,21 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
delete!(r:%, i1:I) ==
i := i1 - mn
- i < 0 or i > r.logLen => error "index out of range"
+ negative? i or i > r.logLen => error "index out of range"
for k in i..r.logLen-2 repeat r.f.k := r.f.(k+1)
shrink(r, 1)
delete!(r:%, i:U) ==
l := lo i - mn; m := maxIndex r - mn
h := (hasHi i => hi i - mn; m)
- l < 0 or h > m => error "index out of range"
+ negative? l or h > m => error "index out of range"
for j in l.. for k in h+1..m repeat r.f.j := r.f.k
shrink(r, max(0,h-l+1))
insert!(x:S, r:%, i1:I):% ==
i := i1 - mn
n := r.logLen
- i < 0 or i > n => error "index out of range"
+ negative? i or i > n => error "index out of range"
growAndFill(r, 1, x)
for k in n-1 .. i by -1 repeat r.f.(k+1) := r.f.k
r.f.i := x
@@ -296,7 +296,7 @@ IndexedFlexibleArray(S:Type, mn: Integer): Exports == Implementation where
i := i1 - mn
if eq?(a, b) then b := copy b
m := #a; n := #b
- i < 0 or i > n => error "index out of range"
+ negative? i or i > n => error "index out of range"
growAdding(b, m, a)
for k in n-1 .. i by -1 repeat b.f.(m+k) := b.f.k
for k in m-1 .. 0 by -1 repeat b.f.(i+k) := a.f.k
@@ -394,20 +394,20 @@ IndexedOneDimensionalArray(S:Type, mn:Integer):
map!(f, s1) ==
n: Integer := Qmax(s1)
- n < 0 => s1
+ negative? n => s1
for i in 0..n repeat Qsetelt(s1, i, f(%aref(s1,i)))
s1
map(f, s1) ==
n:Integer := Qmax(s1)
- n < 0 => s1
+ negative? n => s1
ss2:% := newArray(n+1)
for i in 0..n repeat Qsetelt(ss2, i, f(%aref(s1,i)))
ss2
map(f, a, b) ==
maxind:Integer := min(Qmax a, Qmax b)
- maxind < 0 => empty()
+ negative? maxind => empty()
c:% := newArray(maxind+1)
for i in 0..maxind repeat
Qsetelt(c, i, f(%aref(a,i),%aref(b,i)))
diff --git a/src/algebra/carten.spad.pamphlet b/src/algebra/carten.spad.pamphlet
index 65630dc3..6d7de173 100644
--- a/src/algebra/carten.spad.pamphlet
+++ b/src/algebra/carten.spad.pamphlet
@@ -262,7 +262,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
sample()==kroneckerDelta()$%
int2index(n: Integer, indv: INDEX): INDEX ==
- n < 0 => error "Index error (too small)"
+ negative? n => error "Index error (too small)"
rnk := #indv
for i in 1..rnk repeat
qr := divide(n, dim)
@@ -275,7 +275,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
n: I := 0
for i in 1..#indv repeat
ix := indv.i - minix
- ix<0 or ix>dim-1 => error "Index error (out of range)"
+ negative? ix or ix>dim-1 => error "Index error (out of range)"
n := dim*n + ix
n
@@ -392,7 +392,7 @@ CartesianTensor(minix, dim, R): Exports == Implementation where
n: I := 0
for ii in i repeat
ix := ii - minix
- ix<0 or ix>dim-1 => error "Index error (out of range)"
+ negative? ix or ix>dim-1 => error "Index error (out of range)"
n := dim*n + ix
get(x,n)
diff --git a/src/algebra/catdef.spad.pamphlet b/src/algebra/catdef.spad.pamphlet
index fdb915fa..2b6ff9d2 100644
--- a/src/algebra/catdef.spad.pamphlet
+++ b/src/algebra/catdef.spad.pamphlet
@@ -654,9 +654,9 @@ DivisionRing(): Category ==
x ** n: Integer ==
zero? n => 1
zero? x =>
- n<0 => error "division by zero"
+ negative? n => error "division by zero"
x
- n<0 =>
+ negative? n =>
expt(inv x,(-n) pretend PositiveInteger)
expt(x,n pretend PositiveInteger)
-- if % has CharacteristicZero() then
@@ -1066,7 +1066,7 @@ Group(): Category == Monoid with
recip(x:%) == inv(x)
x:% ** n:Integer ==
zero? n => 1
- n<0 => expt(inv(x),(-n) pretend PositiveInteger)
+ negative? n => expt(inv(x),(-n) pretend PositiveInteger)
expt(x,n pretend PositiveInteger)
conjugate(p,q) == inv(q) * p * q
commutator(p,q) == inv(p) * inv(q) * p * q
diff --git a/src/algebra/clip.spad.pamphlet b/src/algebra/clip.spad.pamphlet
index 9e735766..5adde3dc 100644
--- a/src/algebra/clip.spad.pamphlet
+++ b/src/algebra/clip.spad.pamphlet
@@ -97,7 +97,7 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
iClipParametric(pointLists,fraction,scale) ==
-- error checks and special cases
- (fraction < 0) or (fraction > 1) =>
+ negative? fraction or (fraction > 1) =>
error "clipDraw: fraction should be between 0 and 1"
empty? pointLists => [nil(),segment(0,0),segment(0,0)]
-- put all points together , sort them according to norm
@@ -207,7 +207,7 @@ TwoDimensionalPlotClipping(): Exports == Implementation where
clip(plot,fraction,scale) ==
-- sayBrightly([" clip: "::OutputForm]$List(OutputForm))$Lisp
- (fraction < 0) or (fraction > 1/2) =>
+ negative? fraction or (fraction > 1/2) =>
error "clipDraw: fraction should be between 0 and 1/2"
xVals := xRange plot
empty?(pointLists := listBranches plot) =>
diff --git a/src/algebra/color.spad.pamphlet b/src/algebra/color.spad.pamphlet
index 4899d450..76b8ea9b 100644
--- a/src/algebra/color.spad.pamphlet
+++ b/src/algebra/color.spad.pamphlet
@@ -112,7 +112,7 @@ Color(): Exports == Implementation where
x := y
y := c
diff := x.hue - y.hue
- if (xHueSmaller:= (diff < 0)) then diff := -diff
+ if (xHueSmaller:= negative? diff) then diff := -diff
if (moreThanHalf:=(diff > totalHues quo 2)) then diff := totalHues-diff
offset : I := wholePart(round (diff::SF/(2::SF)**(x.weight/y.weight)) )
if (xHueSmaller and not moreThanHalf)
@@ -121,7 +121,7 @@ Color(): Exports == Implementation where
ans := x.hue + offset
else
ans := x.hue - offset
- if (ans < 0) then ans := totalHues + ans
+ if negative? ans then ans := totalHues + ans
else if (ans > totalHues) then ans := ans - totalHues
[ans,1]
@@ -136,7 +136,7 @@ Color(): Exports == Implementation where
numberOfHues() == totalHues
color i ==
- if (i<0) or (i>totalHues) then
+ if negative? i or (i>totalHues) then
error concat("Color should be in the range 1..",totalHues::String)
[i::I, 1]
diff --git a/src/algebra/combinat.spad.pamphlet b/src/algebra/combinat.spad.pamphlet
index 990930bb..f597f98f 100644
--- a/src/algebra/combinat.spad.pamphlet
+++ b/src/algebra/combinat.spad.pamphlet
@@ -68,7 +68,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
-- p(n) = sum (-1)**k p(n-j) where 0 < j := (3*k**2+-k) quo 2 <= n
minIndex(P) ~= 0 => error "Partition: must have minIndex of 0"
m := #P
- n < 0 => error "partition is not defined for negative integers"
+ negative? n => error "partition is not defined for negative integers"
n < m::I => P(convert(n)@Z)
concat!(P, new((convert(n+1)@Z - m)::N,0)$IndexedFlexibleArray(I,0))
for i in m..convert(n)@Z repeat
@@ -87,7 +87,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
factorial n ==
s,f,t : I
- n < 0 => error "factorial not defined for negative integers"
+ negative? n => error "factorial not defined for negative integers"
if n <= F.Fn then s := f := 1 else (s, f) := F
for k in convert(s+1)@Z .. convert(n)@Z by 2 repeat
if k::I = n then t := n else t := k::I * (k+1)::I
@@ -97,7 +97,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
binomial(n, m) ==
s,b:I
- n < 0 or m < 0 or m > n => 0
+ negative? n or negative? m or m > n => 0
m = 0 => 1
n < 2*m => binomial(n, n-m)
(s,b) := (0,1)
@@ -115,7 +115,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
B.Bv := b
multinomial(n, m) ==
- for t in m repeat t < 0 => return 0
+ for t in m repeat negative? t => return 0
n < _+/m => 0
s:I := 1
for t in m repeat s := s * factorial t
@@ -123,7 +123,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
permutation(n, m) ==
t:I
- m < 0 or n < m => 0
+ negative? m or n < m => 0
m := n-m
p:I := 1
for k in convert(m+1)@Z .. convert(n)@Z by 2 repeat
@@ -134,7 +134,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
stirling1(n, m) ==
-- Definition: (-1)**(n-m) S[n,m] is the number of
-- permutations of n symbols which have m cycles.
- n < 0 or m < 1 or m > n => 0
+ negative? n or m < 1 or m > n => 0
m = n => 1
S.Sn = n => coefficient(S.Sp, convert(m)@Z :: N)
x := monomial(1, 1)$SUP(I)
@@ -146,7 +146,7 @@ IntegerCombinatoricFunctions(I:IntegerNumberSystem): with
stirling2(n, m) ==
-- definition: SS[n,m] is the number of ways of partitioning
-- a set of n elements into m non-empty subsets
- n < 0 or m < 1 or m > n => 0
+ negative? n or m < 1 or m > n => 0
m = 1 or n = m => 1
s:I := if odd? m then -1 else 1
t:I := 0
diff --git a/src/algebra/complet.spad.pamphlet b/src/algebra/complet.spad.pamphlet
index edc9837e..5ac5d928 100644
--- a/src/algebra/complet.spad.pamphlet
+++ b/src/algebra/complet.spad.pamphlet
@@ -80,7 +80,7 @@ OrderedCompletion(R:SetCategory): Exports == Implementation where
n:Integer * x:% ==
x case inf =>
n > 0 => x
- n < 0 => [not(x.inf)]
+ negative? n => [not(x.inf)]
error "Undefined product"
[n * x.fin]
@@ -104,7 +104,7 @@ OrderedCompletion(R:SetCategory): Exports == Implementation where
fininf(b, r) ==
r > 0 => [b]
- r < 0 => [not b]
+ negative? r => [not b]
error "Undefined product"
x:% * y:% ==
diff --git a/src/algebra/constant.spad.pamphlet b/src/algebra/constant.spad.pamphlet
index 4b8bca4c..34138adc 100644
--- a/src/algebra/constant.spad.pamphlet
+++ b/src/algebra/constant.spad.pamphlet
@@ -88,7 +88,7 @@ InnerAlgebraicNumber(): Exports == Implementation where
one? a == one? numer a and one? denom a
x:% / y:% == mainRatDenom(x /$Rep y)
x:% ** n:Integer ==
- n < 0 => mainRatDenom (x **$Rep n)
+ negative? n => mainRatDenom (x **$Rep n)
x **$Rep n
trueEqual(a,b) ==
-- if two algebraic numbers have the same norm (after deleting repeated
diff --git a/src/algebra/contfrac.spad.pamphlet b/src/algebra/contfrac.spad.pamphlet
index e7291148..c1adc3ea 100644
--- a/src/algebra/contfrac.spad.pamphlet
+++ b/src/algebra/contfrac.spad.pamphlet
@@ -161,7 +161,7 @@ ContinuedFraction(R): Exports == Implementation where
d := denom a
q := n quo d
r := n - q*d
- if r < 0 then q := q - 1
+ if negative? r then q := q - 1
q
eucWhole a
@@ -187,8 +187,8 @@ ContinuedFraction(R): Exports == Implementation where
empty? nums or empty? dens => empty()
n := frst nums
d := frst dens
- n < 0 => error "Numerators must be greater than 0."
- d < 0 => error "Denominators must be greater than 0."
+ negative? n => error "Numerators must be greater than 0."
+ negative? d => error "Denominators must be greater than 0."
concat([n,d]$Rec, delay genFractionA(rst nums,rst dens))
else
continuedFraction(wh,nums,dens) == [[wh,genFractionB(nums,dens)],false]
diff --git a/src/algebra/crfp.spad.pamphlet b/src/algebra/crfp.spad.pamphlet
index d2844503..1ac1ba20 100644
--- a/src/algebra/crfp.spad.pamphlet
+++ b/src/algebra/crfp.spad.pamphlet
@@ -494,7 +494,7 @@ ComplexRootFindingPackage(R, UP): public == private where
absC c == nthRoot(norm(c)$C,2)
absR r ==
- r < 0 => -r
+ negative? r => -r
r
min(fae1,fae2) ==
fae2.error < fae1.error => fae2
diff --git a/src/algebra/curve.spad.pamphlet b/src/algebra/curve.spad.pamphlet
index a7185464..57fd38d3 100644
--- a/src/algebra/curve.spad.pamphlet
+++ b/src/algebra/curve.spad.pamphlet
@@ -275,7 +275,7 @@ FunctionFieldCategory(F, UP, UPUP): Category == Definition where
[represents row(m, i) for i in minRowIndex m .. maxRowIndex m]
integralAtInfinity? f ==
- not any?(infOrder(#1) < 0,
+ not any?(negative? infOrder(#1),
coordinates(f) * inverseIntegralMatrixAtInfinity())$Vector(RF)
numberOfComponents() ==
@@ -311,7 +311,7 @@ FunctionFieldCategory(F, UP, UPUP): Category == Definition where
error "f not locally integral at infinity"
rfmonom n ==
- n < 0 => inv(monomial(1, (-n)::NonNegativeInteger)$UP :: RF)
+ negative? n => inv(monomial(1, (-n)::NonNegativeInteger)$UP :: RF)
monomial(1, n::NonNegativeInteger)$UP :: RF
kmin(m, v) ==
diff --git a/src/algebra/data.spad.pamphlet b/src/algebra/data.spad.pamphlet
index 102cd55e..5a04c4cb 100644
--- a/src/algebra/data.spad.pamphlet
+++ b/src/algebra/data.spad.pamphlet
@@ -113,7 +113,8 @@ SystemInteger(N: PositiveInteger): Public == Private where
Public == OrderedFinite with
sample: % ++ \spad{sample} gives a sample datum of this type.
Private == SubDomain(Integer, length #1 <= N) add
- sample == per(0@Integer)
+ import %icst0: % from Foreign Builtin
+ sample == %icst0
min == per(-shift(1,N-1))
max == per(shift(1,N-1)-1)
size() == (rep max - rep min + 1)::NonNegativeInteger
@@ -195,11 +196,12 @@ SystemNonNegativeInteger(N: PositiveInteger): Public == Private where
sample: %
++ \spad{sample} gives a sample datum of type Byte.
Private == SubDomain(NonNegativeInteger, length #1 <= N) add
+ import %icst0: % from Foreign Builtin
import %bitand: (%,%) -> % from Foreign Builtin
import %bitior: (%,%) -> % from Foreign Builtin
import %bitnot: % -> % from Foreign Builtin
- min == per 0
+ min == %icst0
max == per((shift(1,N)-1) : NonNegativeInteger)
sample == min
bitand(x,y) == %bitand(x,y)
diff --git a/src/algebra/defintef.spad.pamphlet b/src/algebra/defintef.spad.pamphlet
index c7091f29..0253ac93 100644
--- a/src/algebra/defintef.spad.pamphlet
+++ b/src/algebra/defintef.spad.pamphlet
@@ -189,11 +189,11 @@ ElementaryFunctionDefiniteIntegration(R, F): Exports == Implementation where
z :=
(r := retractIfCan(a)@Union(F, "failed")) case "failed" => sign(f, x, a)
sign(f, x, r::F, "right")
- (b1 := z case Z) and z::Z < 0 => true
+ (b1 := z case Z) and negative?(z::Z) => true
z :=
(r := retractIfCan(b)@Union(F, "failed")) case "failed" => sign(f, x, b)
sign(f, x, r::F, "left")
- (b2 := z case Z) and z::Z < 0 => true
+ (b2 := z case Z) and negative?(z::Z) => true
b1 and b2 =>
((w := checkFor0(numer f, k, a, b)) case "failed") or (w::B) => "failed"
false
diff --git a/src/algebra/defintrf.spad.pamphlet b/src/algebra/defintrf.spad.pamphlet
index 1b870a17..f86baafa 100644
--- a/src/algebra/defintrf.spad.pamphlet
+++ b/src/algebra/defintrf.spad.pamphlet
@@ -130,7 +130,7 @@ DefiniteIntegrationTools(R, F): Exports == Implementation where
negative f ==
(u := sign f) case "failed" => "failed"
- u::Z < 0
+ negative?(u::Z)
checkForZero(p, x, a, b, incl?) ==
checkForZero(
diff --git a/src/algebra/divisor.spad.pamphlet b/src/algebra/divisor.spad.pamphlet
index 98bc97e6..4dc651e8 100644
--- a/src/algebra/divisor.spad.pamphlet
+++ b/src/algebra/divisor.spad.pamphlet
@@ -139,7 +139,7 @@ FractionalIdeal(R, F, UP, A): Exports == Implementation where
intIdeal(coefficients(poly i1 * poly i2), denom i1 * denom i2)
i:$ ** m:Integer ==
- m < 0 => inv(i) ** (-m)
+ negative? m => inv(i) ** (-m)
n := m::NonNegativeInteger
v := numer i
intIdeal([qelt(v, j) ** n for j in minIndex v .. maxIndex v],
@@ -698,7 +698,7 @@ HyperellipticFiniteDivisor(F, UP, UPUP, R): Exports == Implementation where
-- if is cheaper to keep on reducing as we exponentiate if d is already reduced
n:Z * d:% ==
zero? n => 0
- n < 0 => (-n) * (-d)
+ negative? n => (-n) * (-d)
divisor(d.principalPart ** n) + divisor(mkIdeal(d.center,d.polyPart) ** n)
divisor(i:ID) ==
@@ -876,10 +876,10 @@ FiniteDivisor(F, UP, UPUP, R): Exports == Implementation where
((n exquo rank()) case "failed") =>
error "divisor: point is singular"
m:N :=
- n < 0 => (-n)::N
+ negative? n => (-n)::N
n::N
g := makeDivisor(d**m,(monomial(1,1)$UPUP - b::UP::RF::UPUP)**m,1)
- n < 0 => -g
+ negative? n => -g
g
reduce d ==
diff --git a/src/algebra/efstruc.spad.pamphlet b/src/algebra/efstruc.spad.pamphlet
index 7d8f8258..414217a8 100644
--- a/src/algebra/efstruc.spad.pamphlet
+++ b/src/algebra/efstruc.spad.pamphlet
@@ -747,10 +747,10 @@ TrigonometricManipulations(R, F): Exports == Implementation where
is?(k, 'nthRoot) =>
arg := argument k
even?(retract(n := second arg)@Z) and ((u := sign(first arg)) case Z)
- and (u::Z < 0) => op(s1, n / 2::F) * op(- first arg, n)
+ and negative?(u::Z) => op(s1, n / 2::F) * op(- first arg, n)
"failed"
is?(k, 'log) and ((u := sign(a := first argument k)) case Z)
- and (u::Z < 0) => op(- a) + ipi
+ and negative?(u::Z) => op(- a) + ipi
"failed"
complexForm f ==
diff --git a/src/algebra/efuls.spad.pamphlet b/src/algebra/efuls.spad.pamphlet
index e149806f..728522ce 100644
--- a/src/algebra/efuls.spad.pamphlet
+++ b/src/algebra/efuls.spad.pamphlet
@@ -214,7 +214,7 @@ ElementaryFunctionsUnivariateLaurentSeries(Coef,UTS,ULS):_
coef := coefficient(uls,0)
(ord := order(uls,0)) = 0 and coef * coef = -1 => "failed"
cc : Coef :=
- ord < 0 =>
+ negative? ord =>
TRANSFCN =>
RATS =>
lc := coefficient(uls,ord)
@@ -234,7 +234,7 @@ ElementaryFunctionsUnivariateLaurentSeries(Coef,UTS,ULS):_
coef := coefficient(uls,0)
(ord := order(uls,0)) = 0 and coef * coef = -1 => "failed"
cc : Coef :=
- ord < 0 =>
+ negative? ord =>
RATS =>
lc := coefficient(uls,ord)
(rat := retractIfCan(lc)@Union(RN,"failed")) case "failed" => 0
@@ -315,7 +315,7 @@ ElementaryFunctionsUnivariateLaurentSeries(Coef,UTS,ULS):_
(ord := order(uls,0)) = 0 and coef * coef = -1 =>
error "atan: series expansion has logarithmic term"
cc : Coef :=
- ord < 0 =>
+ negative? ord =>
TRANSFCN =>
RATS =>
lc := coefficient(uls,ord)
@@ -338,7 +338,7 @@ ElementaryFunctionsUnivariateLaurentSeries(Coef,UTS,ULS):_
(ord := order(uls,0)) = 0 and coef * coef = -1 =>
error "acot: series expansion has logarithmic term"
cc : Coef :=
- ord < 0 =>
+ negative? ord =>
RATS =>
lc := coefficient(uls,ord)
(rat := retractIfCan(lc)@Union(RN,"failed")) case "failed" => 0
diff --git a/src/algebra/efupxs.spad.pamphlet b/src/algebra/efupxs.spad.pamphlet
index 296c2777..88bc7237 100644
--- a/src/algebra/efupxs.spad.pamphlet
+++ b/src/algebra/efupxs.spad.pamphlet
@@ -168,7 +168,7 @@ ElementaryFunctionsUnivariatePuiseuxSeries(Coef,ULS,UPXS,EFULS):_
acothIfCan upxs == applyIfCan(acothIfCan,upxs)
asinIfCan upxs ==
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
(coef := coefficient(upxs,0)) = 0 =>
integrate((1 - upxs*upxs)**(-1/2) * (differentiate upxs))
TRANSFCN =>
@@ -177,14 +177,14 @@ ElementaryFunctionsUnivariatePuiseuxSeries(Coef,ULS,UPXS,EFULS):_
"failed"
acosIfCan upxs ==
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
TRANSFCN =>
cc := acos(coefficient(upxs,0)) :: UPXS
cc + integrate(-(1 - upxs*upxs)**(-1/2) * (differentiate upxs))
"failed"
asecIfCan upxs ==
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
TRANSFCN =>
cc := asec(coefficient(upxs,0)) :: UPXS
f := (upxs*upxs - 1)**(-1/2) * (differentiate upxs)
@@ -193,7 +193,7 @@ ElementaryFunctionsUnivariatePuiseuxSeries(Coef,ULS,UPXS,EFULS):_
"failed"
acscIfCan upxs ==
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
TRANSFCN =>
cc := acsc(coefficient(upxs,0)) :: UPXS
f := -(upxs*upxs - 1)**(-1/2) * (differentiate upxs)
@@ -202,27 +202,27 @@ ElementaryFunctionsUnivariatePuiseuxSeries(Coef,ULS,UPXS,EFULS):_
"failed"
asinhIfCan upxs ==
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
TRANSFCN or (coefficient(upxs,0) = 0) =>
log(upxs + (1 + upxs*upxs)**(1/2))
"failed"
acoshIfCan upxs ==
TRANSFCN =>
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
log(upxs + (upxs*upxs - 1)**(1/2))
"failed"
asechIfCan upxs ==
TRANSFCN =>
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
(rec := recip upxs) case "failed" => "failed"
log((1 + (1 - upxs*upxs)*(1/2)) * (rec :: UPXS))
"failed"
acschIfCan upxs ==
TRANSFCN =>
- order(upxs,0) < 0 => "failed"
+ negative? order(upxs,0) => "failed"
(rec := recip upxs) case "failed" => "failed"
log((1 + (1 + upxs*upxs)*(1/2)) * (rec :: UPXS))
"failed"
diff --git a/src/algebra/elemntry.spad.pamphlet b/src/algebra/elemntry.spad.pamphlet
index 32d3eb21..e102aade 100644
--- a/src/algebra/elemntry.spad.pamphlet
+++ b/src/algebra/elemntry.spad.pamphlet
@@ -277,7 +277,7 @@ ElementaryFunction(R, F): Exports == Implementation where
acsch x == opacsch x
kernel x == retract(x)@K
- posrem(n, m) == ((r := n rem m) < 0 => r + m; r)
+ posrem(n, m) == (negative?(r := n rem m) => r + m; r)
valueOrPole rec == (rec.pole => INV; rec.func)
belong? op == has?(op, 'elem)
diff --git a/src/algebra/float.spad.pamphlet b/src/algebra/float.spad.pamphlet
index ce8ad925..e3e0b5a9 100644
--- a/src/algebra/float.spad.pamphlet
+++ b/src/algebra/float.spad.pamphlet
@@ -275,12 +275,12 @@ Float():
atan(x,y) ==
x = 0 =>
y > 0 => pi()/2
- y < 0 => -pi()/2
+ negative? y => -pi()/2
0
-- Only count on first quadrant being on principal branch.
theta := atan abs(y/x)
- if x < 0 then theta := pi() - theta
- if y < 0 then theta := - theta
+ if negative? x then theta := pi() - theta
+ if negative? y then theta := - theta
theta
atan x ==
@@ -466,7 +466,7 @@ Float():
zero? x => error "log 0 generated"
p := bits(); inc 5
-- apply log(x) = n log 2 + log(x/2**n) so that 1/2 < x < 2
- if (n := order x) < 0 then n := n+1
+ if negative?(n := order x) then n := n+1
l := if n = 0 then 0 else (x := shift(x,-n); n * log2())
-- speed the series convergence by finding m and k such that
-- | exp(m/2**k) x - 1 | < 1 / 2 ** O(sqrt p)
@@ -635,7 +635,7 @@ Float():
x = y ==
order x = order y and sign x = sign y and zero? (x - y)
x < y ==
- y.mantissa = 0 => x.mantissa < 0
+ y.mantissa = 0 => negative? x.mantissa
x.mantissa = 0 => y.mantissa > 0
negative? x and positive? y => true
negative? y and positive? x => false
@@ -650,7 +650,7 @@ Float():
wholePart x == shift2(x.mantissa,x.exponent)
floor x == if negative? x then -ceiling(-x) else truncate x
round x == (half := [sign x,-1]; truncate(x + half))
- sign x == if x.mantissa < 0 then -1 else 1
+ sign x == if negative? x.mantissa then -1 else 1
truncate x ==
if x.exponent >= 0 then return x
normalize [shift2(x.mantissa,x.exponent),0]
@@ -711,7 +711,7 @@ Float():
x:% ** y:% ==
x = 0 =>
y = 0 => error "0**0 is undefined"
- y < 0 => error "division by 0"
+ negative? y => error "division by 0"
0
y = 0 => 1
y = 1 => x
@@ -723,7 +723,7 @@ Float():
x:% ** r:RN ==
x = 0 =>
r = 0 => error "0**0 is undefined"
- r < 0 => error "division by 0"
+ negative? r => error "division by 0"
0
r = 0 => 1
r = 1 => x
@@ -744,7 +744,7 @@ Float():
x:% ** n:I ==
x = 0 =>
n = 0 => error "0**0 is undefined"
- n < 0 => error "division by 0"
+ negative? n => error "division by 0"
0
n = 0 => 1
n = 1 => x
@@ -752,7 +752,7 @@ Float():
p := bits()
bits(p + LENGTH n + 2)
y := power(x,abs n)
- if n < 0 then y := dvide(1,y)
+ if negative? n then y := dvide(1,y)
bits p
normalize y
@@ -775,7 +775,7 @@ Float():
-- compute 2**e = b**q * r
h := power10([b,0],q,d+5)
h := chop10([r*h.mantissa,h.exponent],d+5)
- if e < 0 then h := quotient10([m,0],h,d)
+ if negative? e then h := quotient10([m,0],h,d)
else times10([m,0],h,d)
ceilLength10 n == 146 * LENGTH n quo 485 + 1
@@ -811,7 +811,7 @@ Float():
times10(x,y,p) == normalize10(times(x,y),p)
quotient10(x,y,p) ==
ew := floorLength10 y.mantissa - ceilLength10 x.mantissa + p + 2
- if ew < 0 then ew := 0
+ if negative? ew then ew := 0
mw := (x.mantissa * 10**ew::N) quo y.mantissa
ew := x.exponent - y.exponent - ew
normalize10([mw,ew],p)
diff --git a/src/algebra/fnla.spad.pamphlet b/src/algebra/fnla.spad.pamphlet
index 36541ce6..d2e6b579 100644
--- a/src/algebra/fnla.spad.pamphlet
+++ b/src/algebra/fnla.spad.pamphlet
@@ -131,7 +131,7 @@ HallBasis() : Export == Implement where
Implement ==> add
lfunc(d,n) ==
- n < 0 => 0
+ negative? n => 0
n = 0 => 1
n = 1 => d
sum:I := 0
diff --git a/src/algebra/formula.spad.pamphlet b/src/algebra/formula.spad.pamphlet
index a39f786d..19011081 100644
--- a/src/algebra/formula.spad.pamphlet
+++ b/src/algebra/formula.spad.pamphlet
@@ -402,7 +402,7 @@ ScriptFormulaFormat(): public == private where
str := stringify expr
%integer?(expr)$Foreign(Builtin) =>
i := expr : Integer
- if (i < 0) or (i > 9) then group str else str
+ if negative? i or (i > 9) then group str else str
(i := position(str,specialStrings)) > 0 =>
specialStringsInFormula.i
str
diff --git a/src/algebra/fr.spad.pamphlet b/src/algebra/fr.spad.pamphlet
index de6755c7..a77e5370 100644
--- a/src/algebra/fr.spad.pamphlet
+++ b/src/algebra/fr.spad.pamphlet
@@ -444,7 +444,7 @@ which causes wrong results as soon as units are involved, for example in
v1 := u * reciprocal v
goodQuotient:Boolean := true
while (goodQuotient and (not empty? x1)) repeat
- if x1.first.xpnt < 0
+ if negative? x1.first.xpnt
then goodQuotient := false
else x1 := rest x1
goodQuotient => v1
@@ -457,7 +457,7 @@ which causes wrong results as soon as units are involved, for example in
for x in factorList u repeat
ucar := unitNormal(x.fctr)
e := abs(x.xpnt)::NonNegativeInteger
- if x.xpnt < 0
+ if negative? x.xpnt
then -- associate is recip of unit
un := un * (ucar.associate ** e)
as := as * (ucar.unit ** e)
diff --git a/src/algebra/fraction.spad.pamphlet b/src/algebra/fraction.spad.pamphlet
index a6295219..21162627 100644
--- a/src/algebra/fraction.spad.pamphlet
+++ b/src/algebra/fraction.spad.pamphlet
@@ -202,8 +202,8 @@ QuotientFieldCategory(S: IntegralDomain): Category ==
(numer x * denom y) < (numer y * denom x)
else
x:% < y:% ==
- if denom(x) < 0 then (x,y):=(y,x)
- if denom(y) < 0 then (x,y):=(y,x)
+ if negative? denom(x) then (x,y):=(y,x)
+ if negative? denom(y) then (x,y):=(y,x)
(numer x * denom y) < (numer y * denom x)
else if S has OrderedSet then
x:% < y:% ==
@@ -345,12 +345,12 @@ Fraction(S: IntegralDomain): QuotientFieldCategory S with
floor x ==
one?(x.den) => x.num
- x < 0 => -ceiling(-x)
+ negative? x => -ceiling(-x)
wholePart x
ceiling x ==
one?(x.den) => x.num
- x < 0 => -floor(-x)
+ negative? x => -floor(-x)
1 + wholePart x
if S has OpenMath then
diff --git a/src/algebra/free.spad.pamphlet b/src/algebra/free.spad.pamphlet
index 827e8386..f87666b0 100644
--- a/src/algebra/free.spad.pamphlet
+++ b/src/algebra/free.spad.pamphlet
@@ -557,11 +557,11 @@ FreeAbelianGroup(S:SetCategory): Exports == Implementation where
zero? b => false
(inmax terms b).exp > 0
ta := inmax terms a
- zero? b => ta.exp < 0
+ zero? b => negative? ta.exp
ta := inmax terms a
tb := inmax terms b
ta.gen < tb.gen => tb.exp > 0
- ta.gen > tb.gen => ta.exp < 0
+ ta.gen > tb.gen => negative? ta.exp
ta.exp < tb.exp => true
ta.exp > tb.exp => false
lc := ta.exp * ta.gen
diff --git a/src/algebra/fs2expxp.spad.pamphlet b/src/algebra/fs2expxp.spad.pamphlet
index 15fa5661..15b46ca9 100644
--- a/src/algebra/fs2expxp.spad.pamphlet
+++ b/src/algebra/fs2expxp.spad.pamphlet
@@ -342,7 +342,7 @@ FunctionSpaceToExponentialExpansion(R,FE,x,cen):_
-- If the series has order zero and the constant term a0 of the
-- series involves x, the function tries to expand exp(a0) as
-- a power series.
- (deg := order(ups,1)) < 0 =>
+ negative?(deg := order(ups,1)) =>
-- this "can't happen"
error "exp of function with sigularity"
deg > 0 => [exp(ups)]
@@ -385,7 +385,7 @@ FunctionSpaceToExponentialExpansion(R,FE,x,cen):_
-- check to see if lowest order coefficient is a negative rational
negRat? : Boolean :=
((rat := ratIfCan coef) case RN) =>
- (rat :: RN) < 0 => true
+ negative?(rat :: RN) => true
false
false
logTerm : FE :=
@@ -423,7 +423,7 @@ FunctionSpaceToExponentialExpansion(R,FE,x,cen):_
(f := retractIfCan(xxp)@Union(UPXS,"failed")) case "failed" =>
stateProblem(fcnName,"multiply nested exponential")
upxs := f :: UPXS
- (deg := order(upxs,1)) < 0 =>
+ negative? (deg := order(upxs,1)) =>
stateProblem(fcnName,"essential singularity")
deg > 0 => [fcn(upxs) :: UPXS :: XXP]
lc := coefficient(upxs,0); xOpList := opsInvolvingX lc
@@ -532,7 +532,7 @@ FunctionSpaceToExponentialExpansion(R,FE,x,cen):_
yCoef := coefficient(y,-1)
[(monomial(log yCoef,0)+integrate(y - monomial(yCoef,-1)$UPXS)) :: XXP]
cc : FE :=
- ord < 0 =>
+ negative? ord =>
(rn := ratIfCan(ord :: FE)) case "failed" =>
-- this condition usually won't occur because exponents will
-- be integers or rational numbers
diff --git a/src/algebra/fs2ups.spad.pamphlet b/src/algebra/fs2ups.spad.pamphlet
index 5189d4d2..6014ae65 100644
--- a/src/algebra/fs2ups.spad.pamphlet
+++ b/src/algebra/fs2ups.spad.pamphlet
@@ -345,7 +345,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_
-- series involves complex numbers
return stateProblem("atan","logarithmic singularity")
cc : FE :=
- ord < 0 =>
+ negative? ord =>
atanFlag = "complex" =>
return stateProblem("atan","essential singularity")
(rn := ratIfCan(ord :: FE)) case "failed" =>
@@ -612,7 +612,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_
-- check to see if lowest order coefficient is a negative rational
negRat? : Boolean :=
((rat := ratIfCan coef) case RN) =>
- (rat :: RN) < 0 => true
+ negative?(rat :: RN) => true
false
false
logTerm : FE :=
@@ -634,7 +634,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_
-- If the series has order zero and the constant term a0 of the
-- series involves x, the function tries to expand exp(a0) as
-- a power series.
- (deg := order(ups,1)) < 0 =>
+ negative?(deg := order(ups,1)) =>
stateProblem("exp","essential singularity")
deg > 0 => [exp ups]
lc := coefficient(ups,0); xOpList := opsInvolvingX lc
@@ -661,7 +661,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_
yCoef := coefficient(y,-1)
[monomial(log yCoef,0) + integrate(y - monomial(yCoef,-1)$UPS)]
cc : FE :=
- ord < 0 =>
+ negative? ord =>
atanFlag = "complex" =>
return stateProblem("atan","essential singularity")
(rn := ratIfCan(ord :: FE)) case "failed" =>
@@ -696,7 +696,7 @@ FunctionSpaceToUnivariatePowerSeries(R,FE,Expon,UPS,TRAN,x):_
(series := iExprToGenUPS(arg,posCheck?,atanFlag)) case %problem =>
series
ups := series.%series
- (deg := order(ups,1)) < 0 =>
+ negative?(deg := order(ups,1)) =>
stateProblem(fcnName,"essential singularity")
deg > 0 => [fcn(ups) :: UPS]
lc := coefficient(ups,0); xOpList := opsInvolvingX lc
diff --git a/src/algebra/galfact.spad.pamphlet b/src/algebra/galfact.spad.pamphlet
index e596fc3a..56778a4f 100644
--- a/src/algebra/galfact.spad.pamphlet
+++ b/src/algebra/galfact.spad.pamphlet
@@ -506,7 +506,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
brillhartIrreducible? f or
(useeisensteincriterion => eisensteinIrreducible?(f) ; false) =>
if reverse? then [ reverse f ] else [ f ]
- if leadingCoefficient(f)<0 then
+ if negative? leadingCoefficient(f) then
f := -f
negativelc? := true
cf: Union(LR,"failed")
@@ -548,7 +548,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
r := max(2,r-#lfg)::N
if reverse? then lf := [ reverse(fact) for fact in lf ]
for i in 1..#lf repeat
- if leadingCoefficient(lf.i)<0 then lf.i := -lf.i
+ if negative? leadingCoefficient(lf.i) then lf.i := -lf.i
-- because we assume f with positive leading coefficient
lf
@@ -597,7 +597,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
f := (f exquo c)::UP
-- make the leading coefficient positive
- if leadingCoefficient f < 0 then
+ if negative? leadingCoefficient f then
c := -c
f := -f
@@ -627,7 +627,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
odd?(d) and (lcPol = reductum(f)) =>
for sfac in cyclotomicDecomposition(d)$CYC repeat
fac := subMinusX sfac
- if leadingCoefficient fac < 0 then fac := -fac
+ if negative? leadingCoefficient fac then fac := -fac
factorlist := cons([fac,1]$ParFact,factorlist)
[c,factorlist]$FinalFact
@@ -667,7 +667,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
f := (f exquo c)::UP
-- make the leading coefficient positive
- if leadingCoefficient f < 0 then
+ if negative? leadingCoefficient f then
c := -c
f := -f
@@ -698,7 +698,7 @@ GaloisGroupFactorizer(UP): Exports == Implementation where
odd?(d) and (lcPol = reductum(f)) =>
for sfac in cyclotomicDecomposition(d)$CYC repeat
fac := subMinusX sfac
- if leadingCoefficient fac < 0 then fac := -fac
+ if negative? leadingCoefficient fac then fac := -fac
factorlist := cons([fac,1]$ParFact,factorlist)
[c,factorlist]$FinalFact
diff --git a/src/algebra/gaussian.spad.pamphlet b/src/algebra/gaussian.spad.pamphlet
index dac3d85a..d32a353a 100644
--- a/src/algebra/gaussian.spad.pamphlet
+++ b/src/algebra/gaussian.spad.pamphlet
@@ -273,7 +273,7 @@ ComplexCategory(R:CommutativeRing): Category ==
complex(0, - c.associate)]
c := unitNormal real x
x := c.associate * x
- imag x < 0 =>
+ negative? imag x =>
x := complex(- imag x, real x)
[- c.unit * imaginary(), x, c.associate * imaginary()]
[c.unit ::%, x, c.associate ::%]
diff --git a/src/algebra/gpol.spad.pamphlet b/src/algebra/gpol.spad.pamphlet
index 16529fea..ff4b05e1 100644
--- a/src/algebra/gpol.spad.pamphlet
+++ b/src/algebra/gpol.spad.pamphlet
@@ -93,7 +93,7 @@ LaurentPolynomial(R, UP): Exports == Implementation where
reduce("+", l)
coefficient(p, n) ==
- (m := n - order p) < 0 => 0
+ negative?(m := n - order p) => 0
coefficient(poly p, m::N)
differentiate(p:%, derivation:UP -> UP) ==
@@ -121,7 +121,7 @@ LaurentPolynomial(R, UP): Exports == Implementation where
zero? p => q
(d := order p - order q) > 0 =>
gpol(poly(p) * monomial(1, d::N) + poly q, order q)
- d < 0 => gpol(poly(p) + poly(q) * monomial(1, (-d)::N), order p)
+ negative? d => gpol(poly(p) + poly(q) * monomial(1, (-d)::N), order p)
mkgpol(order p, poly(p) + poly q)
mkgpol(n, p) ==
@@ -134,7 +134,7 @@ LaurentPolynomial(R, UP): Exports == Implementation where
check0(order p - order q, r::UP)
retractIfCan(p:%):Union(UP, "failed") ==
- order(p) < 0 => error "Not retractable"
+ negative? order(p) => error "Not retractable"
poly(p) * monomial(1, order(p)::N)$UP
retractIfCan(p:%):Union(R, "failed") ==
diff --git a/src/algebra/integer.spad.pamphlet b/src/algebra/integer.spad.pamphlet
index ac09f419..0d7e8f0b 100644
--- a/src/algebra/integer.spad.pamphlet
+++ b/src/algebra/integer.spad.pamphlet
@@ -300,7 +300,7 @@ NonNegativeInteger: Join(OrderedAbelianMonoidSup,Monoid) with
shift(x:%, n:Integer):% == ASH(x,n)$Lisp
subtractIfCan(x, y) ==
c:Integer := rep x - rep y
- c < 0 => "failed"
+ negative? c => "failed"
per c
@
diff --git a/src/algebra/interval.spad.pamphlet b/src/algebra/interval.spad.pamphlet
index 3bd79aad..7fbd9fe8 100644
--- a/src/algebra/interval.spad.pamphlet
+++ b/src/algebra/interval.spad.pamphlet
@@ -129,7 +129,7 @@ Interval(R:Join(FloatingPointSystem,TranscendentalFunctionCategory)): IntervalCa
contains?(u:%,f:R):Boolean == (f > inf(u)) and (f < sup(u))
positive?(u:%):Boolean == inf(u) > 0
- negative?(u:%):Boolean == sup(u) < 0
+ negative?(u:%):Boolean == negative? sup(u)
a:% < b:% ==
if inf(a) < inf(b) then
@@ -163,7 +163,7 @@ Interval(R:Join(FloatingPointSystem,TranscendentalFunctionCategory)): IntervalCa
a:Integer * b:% ==
if (a > 0) then
qinterval(a*inf(b),a*sup(b))
- else if (a < 0) then
+ else if negative? a then
qinterval(a*sup(b),a*inf(b))
else
0
diff --git a/src/algebra/intfact.spad.pamphlet b/src/algebra/intfact.spad.pamphlet
index 8615cf7f..f8655319 100644
--- a/src/algebra/intfact.spad.pamphlet
+++ b/src/algebra/intfact.spad.pamphlet
@@ -311,7 +311,7 @@ IntegerRoots(I:IntegerNumberSystem): Exports == Implementation where
"failed"
perfectSqrt a ==
- a < 0 or not member?(a rem (144::I), resMod144) => "failed"
+ negative? a or not member?(a rem (144::I), resMod144) => "failed"
(s := approxSqrt a) * s = a => s
"failed"
@@ -369,7 +369,7 @@ IntegerFactorizationPackage(I): Exports == Implementation where
squareFree(n:I):FF ==
u:I
- if n<0 then (m := -n; u := -1)
+ if negative? n then (m := -n; u := -1)
else (m := n; u := 1)
(m > 1) and ((v := perfectSqrt m) case I) =>
sv : FF
@@ -464,7 +464,7 @@ IntegerFactorizationPackage(I): Exports == Implementation where
BasicMethod n ==
u:I
- if n<0 then (m := -n; u := -1)
+ if negative? n then (m := -n; u := -1)
else (m := n; u := 1)
x := BasicSieve(m, 1 + approxSqrt m)
makeFR(u, factorList x)
diff --git a/src/algebra/intpm.spad.pamphlet b/src/algebra/intpm.spad.pamphlet
index de9c8b35..9d47548f 100644
--- a/src/algebra/intpm.spad.pamphlet
+++ b/src/algebra/intpm.spad.pamphlet
@@ -154,7 +154,7 @@ PatternMatchIntegration(R, F): Exports == Implementation where
da := differentiate(a := l.pma, x)
d := a * (cc := l.pmc) / da
zero? differentiate(d, x) => [EI, a, d]
- comp? or (((u := sign a) case Z) and (u::Z) < 0) =>
+ comp? or (((u := sign a) case Z) and negative?(u::Z)) =>
d := cc * (sa := insqrt(- a)) / da
zero? differentiate(d, x) => [ERF, sa, - d * spi]
[NONE, 0, 0]
@@ -283,7 +283,7 @@ PatternMatchIntegration(R, F): Exports == Implementation where
empty?(l := match1(f, x, t, cc)) => "failed"
mw := first l
zero?(ms := third l) or ((sgs := sign ms) case "failed")=> "failed"
- ((sgz := sign(z := (mw + 1) / ms)) case "failed") or (sgz::Z < 0)
+ ((sgz := sign(z := (mw + 1) / ms)) case "failed") or negative?(sgz::Z)
=> "failed"
mmi := retract(mm := second l)@Z
sgs * (last l) * ms**(- mmi - 1) *
diff --git a/src/algebra/irexpand.spad.pamphlet b/src/algebra/irexpand.spad.pamphlet
index 6e819c13..1441447a 100644
--- a/src/algebra/irexpand.spad.pamphlet
+++ b/src/algebra/irexpand.spad.pamphlet
@@ -111,7 +111,7 @@ IntegrationResultToFunction(R, F): Exports == Implementation where
nn := lgp + d * sqrn * ilog(e, f * sqrn,
setUnion(setUnion(kernels a, kernels b), kernels p0))
sqr.sgn > 0 => [pp]
- sqr.sgn < 0 => [nn]
+ negative? sqr.sgn => [nn]
[pp, nn]
-- returns 2 atan(a/b) or 2 atan(-b/a) whichever looks better
@@ -194,7 +194,7 @@ IntegrationResultToFunction(R, F): Exports == Implementation where
empty? ly => true
for x in lx repeat
for y in ly repeat
- ((s := sign(x*y)) case Z) and (s::Z < 0) => return false
+ ((s := sign(x*y)) case Z) and negative?(s::Z) => return false
true
pairsum(lx, ly) ==
diff --git a/src/algebra/kl.spad.pamphlet b/src/algebra/kl.spad.pamphlet
index 1c1a19e5..18aa41f0 100644
--- a/src/algebra/kl.spad.pamphlet
+++ b/src/algebra/kl.spad.pamphlet
@@ -93,7 +93,7 @@ SortedCache(S:CachableSet): Exports == Implementation where
zero?(n := triage(x, y := first scan)) =>
setPosition(x, position y)
return y
- n<0 => return insertInCache(first(cache(),(i-1)::N),scan,x,pos)
+ negative? n => return insertInCache(first(cache(),(i-1)::N),scan,x,pos)
scan := rest scan
pos := position y
setPosition(x, pos + DIFF)
diff --git a/src/algebra/laurent.spad.pamphlet b/src/algebra/laurent.spad.pamphlet
index 3eef1e0f..ada65fa0 100644
--- a/src/algebra/laurent.spad.pamphlet
+++ b/src/algebra/laurent.spad.pamphlet
@@ -150,9 +150,9 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
taylorIfCan uls ==
n := getExpon uls
- n < 0 =>
+ negative? n =>
uls := removeZeroes(-n,uls)
- getExpon(uls) < 0 => "failed"
+ negative? getExpon(uls) => "failed"
getUTS uls
n = 0 => getUTS uls
getUTS(uls) * monom(1,n :: NNI)
@@ -218,7 +218,7 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
pole? x ==
(n := degree x) >= 0 => false
x := removeZeroes(-n,x)
- degree x < 0
+ negative? degree x
--% arithmetic
@@ -254,8 +254,8 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
uts2 := uts :: UTS
not zero? coefficient(uts2,0) =>
error "elt: second argument must have positive order"
- if (deg := getExpon uls1) < 0 then uls1 := removeZeroes(-deg,uls1)
- (deg := getExpon uls1) < 0 =>
+ if negative?(deg := getExpon uls1) then uls1 := removeZeroes(-deg,uls1)
+ negative?(deg := getExpon uls1) =>
(recipr := recip(uts2 :: %)) case "failed" =>
error "elt: second argument not invertible"
uts1 := taylor(uls1 * monomial(1,-deg))
@@ -263,9 +263,9 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
elt(taylor uls1,uts2) :: %
eval(uls:%,r:Coef) ==
- if (n := getExpon uls) < 0 then uls := removeZeroes(-n,uls)
+ if negative?(n := getExpon uls) then uls := removeZeroes(-n,uls)
uts := getUTS uls
- (n := getExpon uls) < 0 =>
+ negative?(n := getExpon uls) =>
zero? r => error "eval: 0 raised to negative power"
(recipr := recip r) case "failed" =>
error "eval: non-unit raised to negative power"
@@ -289,21 +289,21 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
order x == getExpon x + order getUTS x
order(x,n) ==
- (m := n - (e := getExpon x)) < 0 => n
+ negative?(m := n - (e := getExpon x)) => n
e + order(getUTS x,m :: NNI)
truncate(x,n) ==
- (m := n - (e := getExpon x)) < 0 => 0
+ negative?(m := n - (e := getExpon x)) => 0
laurent(e,truncate(getUTS x,m :: NNI))
truncate(x,n1,n2) ==
if n2 < n1 then (n1,n2) := (n2,n1)
- (m1 := n1 - (e := getExpon x)) < 0 => truncate(x,n2)
+ negative?(m1 := n1 - (e := getExpon x)) => truncate(x,n2)
laurent(e,truncate(getUTS x,m1 :: NNI,(n2 - e) :: NNI))
if Coef has IntegralDomain then
rationalFunction(x,n) ==
- (m := n - (e := getExpon x)) < 0 => 0
+ negative?(m := n - (e := getExpon x)) => 0
poly := polynomial(getUTS x,m :: NNI) :: RF
zero? e => poly
v := variable(x) :: RF; c := center(x) :: P :: RF
@@ -312,7 +312,7 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
rationalFunction(x,n1,n2) ==
if n2 < n1 then (n1,n2) := (n2,n1)
- (m1 := n1 - (e := getExpon x)) < 0 => rationalFunction(x,n2)
+ negative?(m1 := n1 - (e := getExpon x)) => rationalFunction(x,n2)
poly := polynomial(getUTS x,m1 :: NNI,(n2 - e) :: NNI) :: RF
zero? e => poly
v := variable(x) :: RF; c := center(x) :: P :: RF
@@ -341,7 +341,7 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
if Coef has "**": (Coef,I) -> Coef then
approximate(x,n) ==
- (m := n - (e := getExpon x)) < 0 => 0
+ negative?(m := n - (e := getExpon x)) => 0
app := approximate(getUTS x,m :: NNI)
zero? e => app
app * ((variable(x) :: Coef) - center(x)) ** e
@@ -349,7 +349,7 @@ UnivariateLaurentSeriesConstructor(Coef,UTS):_
complete x == laurent(getExpon x,complete getUTS x)
extend(x,n) ==
e := getExpon x
- (m := n - e) < 0 => x
+ negative?(m := n - e) => x
laurent(e,extend(getUTS x,m :: NNI))
map(f:Coef -> Coef,x:%) == laurent(getExpon x,map(f,getUTS x))
diff --git a/src/algebra/limitps.spad.pamphlet b/src/algebra/limitps.spad.pamphlet
index 5837ffa9..ac82fee8 100644
--- a/src/algebra/limitps.spad.pamphlet
+++ b/src/algebra/limitps.spad.pamphlet
@@ -711,13 +711,13 @@ ElementaryFunctionSign(R,F): Exports == Implementation where
"failed"
"failed"
is?(op,"log" :: SY) =>
- s::Z < 0 => "failed"
+ negative?(s::Z) => "failed"
sign(first arg - 1)
is?(op,"tanh" :: SY) or is?(op,"sinh" :: SY) or
is?(op,"csch" :: SY) or is?(op,"coth" :: SY) => s
is?(op,"nthRoot" :: SY) =>
even?(retract(second arg)@Z) =>
- s::Z < 0 => "failed"
+ negative?(s::Z) => "failed"
s
s
"failed"
diff --git a/src/algebra/listgcd.spad.pamphlet b/src/algebra/listgcd.spad.pamphlet
index 7640aa21..69d50396 100644
--- a/src/algebra/listgcd.spad.pamphlet
+++ b/src/algebra/listgcd.spad.pamphlet
@@ -71,7 +71,7 @@ HeuGcd (BP):C == T
constNotZero(f : BP ) : Boolean == (degree f = 0) and not (zero? f)
negShiftz(n:Z,Modulus:PI):Z ==
- n < 0 => n:= n+Modulus
+ negative? n => n:= n+Modulus
n > (Modulus quo 2) => n-Modulus
n
diff --git a/src/algebra/manip.spad.pamphlet b/src/algebra/manip.spad.pamphlet
index dc0adfef..fe59129a 100644
--- a/src/algebra/manip.spad.pamphlet
+++ b/src/algebra/manip.spad.pamphlet
@@ -108,7 +108,7 @@ PolynomialRoots(E, V, R, P, F):Exports == Implementation where
czroot(x, n) ==
rec := zroot(x, n)
- rec.exponent = 2 and rec.radicand < 0 =>
+ rec.exponent = 2 and negative? rec.radicand =>
[rec.exponent, rec.coef * imaginary()::P::F, (-rec.radicand)::F]
[rec.exponent, rec.coef::F, rec.radicand::F]
diff --git a/src/algebra/mathml.spad.pamphlet b/src/algebra/mathml.spad.pamphlet
index e6927612..5cc0d658 100644
--- a/src/algebra/mathml.spad.pamphlet
+++ b/src/algebra/mathml.spad.pamphlet
@@ -1335,7 +1335,7 @@ have to be switched by swapping names.
-- this bit seems to deal with integers
%integer?(expr)$Foreign(Builtin) =>
i := expr pretend Integer
- if (i < 0) or (i > 9)
+ if negative? i or (i > 9)
then
group
nstr : String := ""
diff --git a/src/algebra/mlift.spad.pamphlet b/src/algebra/mlift.spad.pamphlet
index 1b37e51d..2d6425ba 100644
--- a/src/algebra/mlift.spad.pamphlet
+++ b/src/algebra/mlift.spad.pamphlet
@@ -161,7 +161,7 @@ MultivariateLifting(E,OV,R,P) : C == T
-- PGCD may call with a smaller valure of degj
idegj:Integer:=maxDegree(m,x)
for term in plist repeat idegj:=idegj -maxDegree(term,x)
- idegj < 0 => return "failed"
+ negative? idegj => return "failed"
plist
--There are not extraneous factors
diff --git a/src/algebra/moddfact.spad.pamphlet b/src/algebra/moddfact.spad.pamphlet
index 20793c67..dc68773e 100644
--- a/src/algebra/moddfact.spad.pamphlet
+++ b/src/algebra/moddfact.spad.pamphlet
@@ -101,7 +101,7 @@ ModularDistinctDegreeFactorizer(U):C == T where
i:I
exptmod(u1,i,u2) ==
- i < 0 => error("negative exponentiation not allowed for exptMod")
+ negative? i => error("negative exponentiation not allowed for exptMod")
ans:= 1$EMR
while i > 0 repeat
if odd?(i) then ans:= (ans * u1) rem u2
diff --git a/src/algebra/numquad.spad.pamphlet b/src/algebra/numquad.spad.pamphlet
index 82c82440..c63bf852 100644
--- a/src/algebra/numquad.spad.pamphlet
+++ b/src/algebra/numquad.spad.pamphlet
@@ -322,10 +322,10 @@ NumericalQuadrature(): Exports == Implementation where
if (a = b) then
output("romberg: integration limits are equal = ",a::E)
return([0.0,0.0,1,true])
- if (epsrel < 0.0) then
+ if negative? epsrel then
output("romberg: eps_r < 0.0 eps_r = ",epsrel::E)
return([0.0,0.0,0,false])
- if (epsabs < 0.0) then
+ if negative? epsabs then
output("romberg: eps_a < 0.0 eps_a = ",epsabs::E)
return([0.0,0.0,0,false])
for n in 1..nmax repeat
@@ -373,10 +373,10 @@ NumericalQuadrature(): Exports == Implementation where
if (a = b) then
output("simpson: integration limits are equal = ",a::E)
return([0.0,0.0,1,true])
- if (epsrel < 0.0) then
+ if negative? epsrel then
output("simpson: eps_r < 0.0 : eps_r = ",epsrel::E)
return([0.0,0.0,0,false])
- if (epsabs < 0.0) then
+ if negative? epsabs then
output("simpson: eps_a < 0.0 : eps_a = ",epsabs::E)
return([0.0,0.0,0,false])
for n in 1..nmax repeat
@@ -415,10 +415,10 @@ NumericalQuadrature(): Exports == Implementation where
if (a = b) then
output("trapezoidal: integration limits are equal = ",a::E)
return([0.0,0.0,1,true])
- if (epsrel < 0.0) then
+ if negative? epsrel then
output("trapezoidal: eps_r < 0.0 : eps_r = ",epsrel::E)
return([0.0,0.0,0,false])
- if (epsabs < 0.0) then
+ if negative? epsabs then
output("trapezoidal: eps_a < 0.0 : eps_a = ",epsabs::E)
return([0.0,0.0,0,false])
for n in 1..nmax repeat
diff --git a/src/algebra/numtheor.spad.pamphlet b/src/algebra/numtheor.spad.pamphlet
index a4174263..98a30591 100644
--- a/src/algebra/numtheor.spad.pamphlet
+++ b/src/algebra/numtheor.spad.pamphlet
@@ -213,7 +213,7 @@ or
\[14\]
<<chineseRemainder(x1,m1,x2,m2)>>=
chineseRemainder(x1,m1,x2,m2) ==
- m1 < 0 or m2 < 0 => error "moduli must be positive"
+ negative? m1 or negative? m2 => error "moduli must be positive"
x1 := positiveRemainder(x1,m1)
x2 := positiveRemainder(x2,m2)
x1 + m1 * positiveRemainder(((x2-x1) * inverse(m1,m2)),m2)
@@ -325,7 +325,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
harmonic n ==
s:I; h:RN
- n < 0 => error("harmonic not defined for negative integers")
+ negative? n => error("harmonic not defined for negative integers")
if n >= H.Hn then (s,h) := H else (s := 0; h := 0)
for k in s+1..n repeat h := h + 1/k
H.Hn := n
@@ -334,7 +334,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
fibonacci n ==
n = 0 => 0
- n < 0 => (odd? n => 1; -1) * fibonacci(-n)
+ negative? n => (odd? n => 1; -1) * fibonacci(-n)
f1, f2 : I
(f1,f2) := (0,1)
for k in length(n)-2 .. 0 by -1 repeat
@@ -344,7 +344,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
f2
euler n ==
- n < 0 => error "euler not defined for negative integers"
+ negative? n => error "euler not defined for negative integers"
odd? n => 0
l := (#E) :: I
n < l => E(n)
@@ -361,7 +361,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
E(n)
bernoulli n ==
- n < 0 => error "bernoulli not defined for negative integers"
+ negative? n => error "bernoulli not defined for negative integers"
odd? n =>
n = 1 => -1/2
0
@@ -399,7 +399,7 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where
-- then J(d/n) = chi(n) for n > 0.
-- Reference: Hecke, Vorlesungen ueber die Theorie der Algebraischen
-- Zahlen.
- if b < 0 then b := -b
+ if negative? b then b := -b
b = 0 => error "second argument of jacobi may not be 0"
b = 1 => 1
even? b and positiveRemainder(a,4) > 1 =>
@@ -581,7 +581,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
cyclotomic n ==
--++ cyclotomic polynomial denoted phi[n](x)
p:I; q:I; r:I; s:I; m:NNI; c:SUP(I); t:SUP(I)
- n < 0 => error "cyclotomic not defined for negative integers"
+ negative? n => error "cyclotomic not defined for negative integers"
n = 0 => x
k := n; s := p := 1
c := x - 1
@@ -598,7 +598,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
euler n ==
p : SUP(RN); t : SUP(RN); c : RN; s : I
- n < 0 => error "euler not defined for negative integers"
+ negative? n => error "euler not defined for negative integers"
if n < E.En then (s,p) := (0$I,1$SUP(RN)) else (s,p) := E
-- (s,p) := if n < E.En then (0,1) else E
for i in s+1 .. n repeat
@@ -611,7 +611,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
bernoulli n ==
p : SUP RN; t : SUP RN; c : RN; s : I
- n < 0 => error "bernoulli not defined for negative integers"
+ negative? n => error "bernoulli not defined for negative integers"
if n < B.Bn then (s,p) := (0$I,1$SUP(RN)) else (s,p) := B
-- (s,p) := if n < B.Bn then (0,1) else B
for i in s+1 .. n repeat
@@ -631,7 +631,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
hermite n ==
s : I; p : SUP(I); q : SUP(I)
- n < 0 => error "hermite not defined for negative integers"
+ negative? n => error "hermite not defined for negative integers"
-- (s,p,q) := if n < H.Hn then (0,1,x) else H
if n < H.Hn then (s := 0; p := 1; q := x) else (s,p,q) := H
for k in s+1 .. n repeat (p,q) := (2*x*p-2*(k-1)*q,p)
@@ -642,7 +642,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
legendre n ==
s:I; t:I; p:SUP(RN); q:SUP(RN)
- n < 0 => error "legendre not defined for negative integers"
+ negative? n => error "legendre not defined for negative integers"
-- (s,p,q) := if n < P.Pn then (0,1,y) else P
if n < P.Pn then (s := 0; p := 1; q := y) else (s,p,q) := P
for k in s+1 .. n repeat
@@ -655,7 +655,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
laguerre n ==
k:I; s:I; t:I; p:SUP(I); q:SUP(I)
- n < 0 => error "laguerre not defined for negative integers"
+ negative? n => error "laguerre not defined for negative integers"
-- (s,p,q) := if n < L.Ln then (0,1,x) else L
if n < L.Ln then (s := 0; p := 1; q := x) else (s,p,q) := L
for k in s+1 .. n repeat
@@ -668,7 +668,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
chebyshevT n ==
s : I; p : SUP(I); q : SUP(I)
- n < 0 => error "chebyshevT not defined for negative integers"
+ negative? n => error "chebyshevT not defined for negative integers"
-- (s,p,q) := if n < CT.Tn then (0,1,x) else CT
if n < CT.Tn then (s := 0; p := 1; q := x) else (s,p,q) := CT
for k in s+1 .. n repeat (p,q) := ((2*x*p - q),p)
@@ -679,7 +679,7 @@ PolynomialNumberTheoryFunctions(): Exports == Implementation where
chebyshevU n ==
s : I; p : SUP(I); q : SUP(I)
- n < 0 => error "chebyshevU not defined for negative integers"
+ negative? n => error "chebyshevU not defined for negative integers"
if n < U.Un then (s := 0; p := 1; q := 0) else (s,p,q) := U
for k in s+1 .. n repeat (p,q) := ((2*x*p - q),p)
U.Un := n
diff --git a/src/algebra/oderf.spad.pamphlet b/src/algebra/oderf.spad.pamphlet
index 87288645..f104bc74 100644
--- a/src/algebra/oderf.spad.pamphlet
+++ b/src/algebra/oderf.spad.pamphlet
@@ -98,7 +98,7 @@ BoundIntegerRoots(F, UP): Exports == Implementation where
-- returns 0 if r is not a negative integer, r otherwise
negint r ==
- ((u := retractIfCan(r)@Union(Z, "failed")) case Z) and (u::Z < 0) => u::Z
+ ((u := retractIfCan(r)@Union(Z, "failed")) case Z) and negative?(u::Z) => u::Z
0
if F has ExpressionSpace then
diff --git a/src/algebra/opalg.spad.pamphlet b/src/algebra/opalg.spad.pamphlet
index d710a5aa..759f9136 100644
--- a/src/algebra/opalg.spad.pamphlet
+++ b/src/algebra/opalg.spad.pamphlet
@@ -173,7 +173,7 @@ ModuleOperator(R: Ring, M:LeftModule(R)): Exports == Implementation where
g := rec.gen
e > 0 =>
for i in 1..e repeat r := opeval(g, r)
- e < 0 =>
+ negative? e =>
for i in 1..(-e) repeat r := opInvEval(g, r)
r
diff --git a/src/algebra/ore.spad.pamphlet b/src/algebra/ore.spad.pamphlet
index 126af607..e55b0eee 100644
--- a/src/algebra/ore.spad.pamphlet
+++ b/src/algebra/ore.spad.pamphlet
@@ -318,7 +318,7 @@ Automorphism(R:Ring): Join(Group, Eltable(R, R)) with
apply(f, r, n) == (g := f pretend ((R, Integer) -> R); g(r, n))
iterat(f, g, n, r) ==
- n < 0 => iter(g, (-n)::NonNegativeInteger, r)
+ negative? n => iter(g, (-n)::NonNegativeInteger, r)
iter(f, n::NonNegativeInteger, r)
iter(f, n, r) ==
diff --git a/src/algebra/outform.spad.pamphlet b/src/algebra/outform.spad.pamphlet
index 40e09272..b73ef8c3 100644
--- a/src/algebra/outform.spad.pamphlet
+++ b/src/algebra/outform.spad.pamphlet
@@ -179,7 +179,7 @@ NumberFormats(): NFexports == NFimplementation where
c := s.i; i := i-1
n := romval ord c
-- (I)=1000, ((I))=10000, (((I)))=100000, etc
- if n < 0 then
+ if negative? n then
c ~= pren =>
error ["Improper character in Roman numeral: ",c]
nprens: PI := 1
@@ -198,7 +198,7 @@ NumberFormats(): NFexports == NFimplementation where
else
tot := tot + n
Max := n
- tot < 0 => error ["Improper Roman numeral: ", tot]
+ negative? tot => error ["Improper Roman numeral: ", tot]
tot::PI
@
diff --git a/src/algebra/pade.spad.pamphlet b/src/algebra/pade.spad.pamphlet
index a18909ea..08d7bdbc 100644
--- a/src/algebra/pade.spad.pamphlet
+++ b/src/algebra/pade.spad.pamphlet
@@ -181,7 +181,7 @@ PadeApproximants(R,PS,UP): Exports == Implementation where
d0 := coefficient(d,0)
d := (1/d0) * d; g := (1/d0) * g
p : UP := 0; s := g
- if l-m+1 < 0 then error "Internal pade error"
+ if negative?(l-m+1) then error "Internal pade error"
degbd := (l-m+1) :: NNI
for k in 1..degbd repeat
pk := coefficient(s,0)
diff --git a/src/algebra/patmatch1.spad.pamphlet b/src/algebra/patmatch1.spad.pamphlet
index 00a62631..2189e13e 100644
--- a/src/algebra/patmatch1.spad.pamphlet
+++ b/src/algebra/patmatch1.spad.pamphlet
@@ -501,7 +501,7 @@ PatternMatchTools(S, R, P): Exports == Implementation where
if R has OrderedSet then
for x in l repeat
((r := retractIfCan(x)@Union(R, "failed")) case R) and
- (r::R < 0) => return x
+ (r::R) < 0 => return x
"failed"
-- tries to match the list of patterns lp to the list of subjects rc.s
diff --git a/src/algebra/permgrps.spad.pamphlet b/src/algebra/permgrps.spad.pamphlet
index 7e88ad08..29b849a9 100644
--- a/src/algebra/permgrps.spad.pamphlet
+++ b/src/algebra/permgrps.spad.pamphlet
@@ -246,7 +246,7 @@ PermutationGroup(S:SetCategory): public == private where
entryLessZero : B := false
while not entryLessZero repeat
entry := schreierVector.(actelt.point)
- entryLessZero := (entry < 0)
+ entryLessZero := negative? entry
if not entryLessZero then
actelt := times(group.entry, actelt)
if wordProblem then outlist := append ( words.(entry::NNI) , outlist )
@@ -333,7 +333,7 @@ PermutationGroup(S:SetCategory): public == private where
osvc := o.svc
while degree > 0 repeat
p := osvc.ppt
- p < 0 => return [ xelt , word ]
+ negative? p => return [ xelt , word ]
x := group.p
xelt := times ( x , xelt )
if wordProblem then word := append ( wordlist.p , word )
@@ -384,7 +384,7 @@ PermutationGroup(S:SetCategory): public == private where
j := j - 1
-- this is for word length control
if wordProblem then maxLoops := maxLoops - diff
- if ( null group2 ) or ( maxLoops < 0 ) then
+ if ( null group2 ) or negative? maxLoops then
sizeOfGroup := k1
baseOfGroup := [ i ]
out := [ gpsgs ]
@@ -522,7 +522,7 @@ PermutationGroup(S:SetCategory): public == private where
p := gporb.j.orb.1
while ( degree > 0 ) and noresult repeat
entry := s.(z.p)
- if entry < 0 then
+ if negative? entry then
if entry = -1 then leave
basePoint := j::NNI
noresult := false
diff --git a/src/algebra/puiseux.spad.pamphlet b/src/algebra/puiseux.spad.pamphlet
index d9104a28..b465790c 100644
--- a/src/algebra/puiseux.spad.pamphlet
+++ b/src/algebra/puiseux.spad.pamphlet
@@ -125,7 +125,7 @@ UnivariatePuiseuxSeriesConstructor(Coef,ULS):_
monomial(c,k) ==
k = 0 => c :: %
- k < 0 => puiseux(-k,monomial(c,-1))
+ negative? k => puiseux(-k,monomial(c,-1))
puiseux(k,monomial(c,1))
coerce(ls:ULS) == puiseux(1,ls)
@@ -504,7 +504,7 @@ UnivariatePuiseuxSeries(Coef,var,cen): Exports == Implementation where
approximateLaurent: (ULS,Coef,I) -> Coef
approximateLaurent(x,term,n) ==
- (m := n - (e := degree x)) < 0 => 0
+ negative?(m := n - (e := degree x)) => 0
app := stToCoef(coefficients taylorRep x,term,0,m :: NNI)
zero? e => app
app * term ** (e :: RN)
diff --git a/src/algebra/radix.spad.pamphlet b/src/algebra/radix.spad.pamphlet
index 455e7b77..79c4aa17 100644
--- a/src/algebra/radix.spad.pamphlet
+++ b/src/algebra/radix.spad.pamphlet
@@ -113,7 +113,7 @@ RadixExpansion(bb): Exports == Implementation where
coerce(a):RN == (wholePart a) :: RN + fractionPart a
coerce(n):% == n :: RN :: %
coerce(q):% ==
- s := 1; if q < 0 then (s := -1; q := -q)
+ s := 1; if negative? q then (s := -1; q := -q)
qr := divide(numer q,denom q)
whole := radixInt (qr.quotient,bb)
fractn := radixFrac(qr.remainder,denom q,bb)
@@ -190,11 +190,11 @@ RadixExpansion(bb): Exports == Implementation where
if not null a.int then le := concat(intgroup a.int,le)
else le := concat(0 :: OUT,le)
rex := exprgroup le
- if a.sgn < 0 then -rex else rex
+ if negative? a.sgn then -rex else rex
-- Construction utilities
checkRagits li ==
- for i in li repeat if i < 0 or i >= bb then
+ for i in li repeat if negative? i or i >= bb then
error "Each ragit (digit) must be between 0 and base-1"
true
diff --git a/src/algebra/random.spad.pamphlet b/src/algebra/random.spad.pamphlet
index e4ba0bf5..0a650ee2 100644
--- a/src/algebra/random.spad.pamphlet
+++ b/src/algebra/random.spad.pamphlet
@@ -55,7 +55,7 @@ RandomNumberSource(): with
randnum() ==
t := (271828183 * x1 - 314159269 * x0) rem ranbase
- if t < 0 then t := t + ranbase
+ if negative? t then t := t + ranbase
x0:= x1
x1:= t
diff --git a/src/algebra/rdeef.spad.pamphlet b/src/algebra/rdeef.spad.pamphlet
index e9aa2e67..c7d5e368 100644
--- a/src/algebra/rdeef.spad.pamphlet
+++ b/src/algebra/rdeef.spad.pamphlet
@@ -467,7 +467,7 @@ ElementaryRischDE(R, F): Exports == Implementation where
answr:UP := 0
repeat
zero? c => return answr
- (n < 0) or ((m := degree c)::Z > n) => return "failed"
+ negative? n or ((m := degree c)::Z > n) => return "failed"
u := rischDE(1, f, leadingCoefficient c, x, limitedint, extint)
~u.sol? => return "failed"
zero? m => return(answr + u.ans::UP)
@@ -502,7 +502,7 @@ ElementaryRischDE(R, F): Exports == Implementation where
answr:UP := 0
repeat
zero? c => return answr
- (n < 0) or ((m := degree c)::Z > n) => return "failed"
+ negative? n or ((m := degree c)::Z > n) => return "failed"
u := rischDE(1, f + m * eta, leadingCoefficient c, x,limitedint,extint)
~u.sol? => return "failed"
zero? m => return(answr + u.ans::UP)
diff --git a/src/algebra/rderf.spad.pamphlet b/src/algebra/rderf.spad.pamphlet
index fb7f7721..1cd6563d 100644
--- a/src/algebra/rderf.spad.pamphlet
+++ b/src/algebra/rderf.spad.pamphlet
@@ -91,7 +91,7 @@ TranscendentalRischDE(F, UP): Exports == Implementation where
-- where h' + B h = C and h has degree at most m
SPDE(aa, bb, cc, d, derivation) ==
zero? cc => [0, 0, 0, 0, 0]
- d < 0 => "failed"
+ negative? d => "failed"
(u := cc exquo (g := gcd(aa, bb))) case "failed" => "failed"
aa := (aa exquo g)::UP
bb := (bb exquo g)::UP
@@ -117,7 +117,7 @@ TranscendentalRischDE(F, UP): Exports == Implementation where
db := (degree bb)::Z
lb := leadingCoefficient bb
while cc ~= 0 repeat
- d < 0 or (n := (degree cc)::Z - db) < 0 or n > d => return [q, true]
+ negative? d or negative?(n := (degree cc)::Z - db) or n > d => return [q, true]
r := monomial((leadingCoefficient cc) / lb, n::N)
cc := cc - bb * r - derivation r
d := n - 1
@@ -130,7 +130,7 @@ TranscendentalRischDE(F, UP): Exports == Implementation where
SPDEnocancel2(bb, cc, d, dtm1, lt, derivation) ==
q:UP := 0
while cc ~= 0 repeat
- d < 0 or (n := (degree cc)::Z - dtm1) < 0 or n > d => return [[q, true]]
+ negative? d or negative?(n := (degree cc)::Z - dtm1) or n > d => return [[q, true]]
if n > 0 then
r := monomial((leadingCoefficient cc) / (n * lt), n::N)
cc := cc - bb * r - derivation r
diff --git a/src/algebra/rdesys.spad.pamphlet b/src/algebra/rdesys.spad.pamphlet
index 92bfcd21..6b62280d 100644
--- a/src/algebra/rdesys.spad.pamphlet
+++ b/src/algebra/rdesys.spad.pamphlet
@@ -148,7 +148,7 @@ TranscendentalRischDESystem(F, UP): Exports == Implementation where
ans1 := ans2 := 0::UP
repeat
zero? c1 and zero? c2 => return [ans1, ans2]
- n < 0 or (u := getlc(c1,c2,lb,lh,n::N)) case "failed" => return "failed"
+ negative? n or (u := getlc(c1,c2,lb,lh,n::N)) case "failed" => return "failed"
lq := u::List(UP)
q1 := first lq
q2 := second lq
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
diff --git a/src/algebra/reclos.spad.pamphlet b/src/algebra/reclos.spad.pamphlet
index bc6275be..c1359c1b 100644
--- a/src/algebra/reclos.spad.pamphlet
+++ b/src/algebra/reclos.spad.pamphlet
@@ -244,7 +244,7 @@ RealRootCharacterizationCategory(TheField, ThePols ) : Category == PUB where
sign(toTest, rootChar) = 0
negative?(toTest, rootChar) ==
- sign(toTest, rootChar) < 0
+ negative? sign(toTest, rootChar)
positive?(toTest, rootChar) ==
sign(toTest, rootChar) > 0
@@ -703,7 +703,7 @@ RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
null(l) => false
f := sign(first(l))
for term in rest(l) repeat
- if f*term < 0 then return(true)
+ if negative?(f*term) then return(true)
false
hasVars(p:P) ==
@@ -743,7 +743,7 @@ RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
<<performance problem>>
res :$ := [left,right,leadingMonomial(pol)+reductum(pol)]$Rep -- safe copy
while zero?(pol.(res.high)) repeat refine!(res)
- while (res.high * res.low < 0 ) repeat refine!(res)
+ while negative?(res.high * res.low) repeat refine!(res)
zero?(pol.(res.low)) => [res.low,res.high,monomial(1,1)-(res.low)::P]
res
@@ -862,7 +862,7 @@ RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
rootChar.low := int
rootChar.defPol := monomial(1,1) - int::P
rootChar
- if (s1*s2 < 0)
+ if negative?(s1*s2)
then
rootChar.high := int
else
@@ -874,7 +874,7 @@ RightOpenIntervalRootCharacterization(TheField,ThePolDom) : PUB == PRIV where
int := middle(rootChar)
s:= (rootChar.defPol).int * (rootChar.defPol).(rootChar.high)
zero?(s) => [int,rootChar.high,monomial(1,1)-int::P]
- if s < 0
+ if negative? s
then
[int,rootChar.high,rootChar.defPol]
else
diff --git a/src/algebra/sf.spad.pamphlet b/src/algebra/sf.spad.pamphlet
index bfd30d62..1faaffe7 100644
--- a/src/algebra/sf.spad.pamphlet
+++ b/src/algebra/sf.spad.pamphlet
@@ -98,7 +98,7 @@ RealNumberSystem(): Category ==
floor x ==
x1 := (wholePart x) :: %
x = x1 => x
- x < 0 => (x1 - 1)
+ negative? x => (x1 - 1)
x1
ceiling x ==
diff --git a/src/algebra/sgcf.spad.pamphlet b/src/algebra/sgcf.spad.pamphlet
index b917271f..fda88648 100644
--- a/src/algebra/sgcf.spad.pamphlet
+++ b/src/algebra/sgcf.spad.pamphlet
@@ -196,7 +196,7 @@ SymmetricGroupCombinatoricFunctions(): public == private where
-- definition of exported functions
numberOfImproperPartitions(n,m) ==
- if n < 0 or m < 1 then return 0
+ if negative? n or m < 1 then return 0
if m = 1 or n = 0 then return 1
s := 0
for i in 0..n repeat
@@ -206,7 +206,7 @@ SymmetricGroupCombinatoricFunctions(): public == private where
unrankImproperPartitions0(n,m,k) ==
l : L I := nil$(L I)
- k < 0 => error"counting of partitions is started at 0"
+ negative? k => error"counting of partitions is started at 0"
k >= numberOfImproperPartitions(n,m) =>
error"there are not so many partitions"
for t in 0..(m-2) repeat
@@ -234,7 +234,7 @@ SymmetricGroupCombinatoricFunctions(): public == private where
-- to be formeded. The remaining positions are filled by zeros.
nonZeros : L I := nil$(L I)
partition : V I := new(m::NNI,0$I)$(V I)
- k < 0 => nonZeros
+ negative? k => nonZeros
k >= numberOfImproperPartitions(n,m) => nonZeros
cm : I := m --cm gives the depth of the tree
while n ~= 0 repeat
@@ -260,7 +260,7 @@ SymmetricGroupCombinatoricFunctions(): public == private where
subSet(n,m,k) ==
- k < 0 or n < 0 or m < 0 or m > n =>
+ negative? k or negative? n or negative? m or m > n =>
error "improper argument to subSet"
bin : I := binomial$ICF (n,m)
k >= bin =>
diff --git a/src/algebra/si.spad.pamphlet b/src/algebra/si.spad.pamphlet
index ad162629..bc77952c 100644
--- a/src/algebra/si.spad.pamphlet
+++ b/src/algebra/si.spad.pamphlet
@@ -90,7 +90,7 @@ IntegerNumberSystem(): Category ==
rational? x == true
euclideanSize(x) ==
x=0 => error "euclideanSize called on zero"
- x<0 => (-convert(x)@Integer)::NonNegativeInteger
+ negative? x => (-convert(x)@Integer)::NonNegativeInteger
convert(x)@Integer::NonNegativeInteger
convert(x:%):Float == (convert(x)@Integer)::Float
convert(x:%):DoubleFloat == (convert(x)@Integer)::DoubleFloat
@@ -125,7 +125,7 @@ IntegerNumberSystem(): Category ==
symmetricRemainder(x, n) ==
r := x rem n
r = 0 => r
- if n < 0 then n:=-n
+ if negative? n then n:=-n
r > 0 =>
2 * r > n => r - n
r
diff --git a/src/algebra/solvedio.spad.pamphlet b/src/algebra/solvedio.spad.pamphlet
index f085b22e..54a9330e 100644
--- a/src/algebra/solvedio.spad.pamphlet
+++ b/src/algebra/solvedio.spad.pamphlet
@@ -120,7 +120,7 @@ DiophantineSolutionPackage(): Cat == Capsule where
v := zero(k)$VI
for i in 1..k repeat
ind > 0 =>
- coeffs.i < 0 =>
+ negative? coeffs.i =>
v.i := zeroNode + ind + coeffs.i
coeffs.i > 0 =>
v.i := zeroNode + ind + coeffs.i
diff --git a/src/algebra/stream.spad.pamphlet b/src/algebra/stream.spad.pamphlet
index 3d5159ea..a51a1c51 100644
--- a/src/algebra/stream.spad.pamphlet
+++ b/src/algebra/stream.spad.pamphlet
@@ -1091,7 +1091,7 @@ Stream(S): Exports == Implementation where
setrestt!(rst x,n-1,y)
setrest!(x,n,y) ==
- n < 0 or empty? x => error "setrest!: no such rest"
+ negative? n or empty? x => error "setrest!: no such rest"
x := expand!(x,n+1)
setrestt!(x,n,y)
diff --git a/src/algebra/string.spad.pamphlet b/src/algebra/string.spad.pamphlet
index 54c0a14f..2db40214 100644
--- a/src/algebra/string.spad.pamphlet
+++ b/src/algebra/string.spad.pamphlet
@@ -322,7 +322,7 @@ IndexedString(mn:Integer): Export == Implementation where
m := #s
n := #t
h:I := if hasHi sg then hi(sg) - mn else maxIndex s - mn
- l < 0 or h >= m or h < l-1 => error "index out of range"
+ negative? l or h >= m or h < l-1 => error "index out of range"
r := new((m-(h-l+1)+n)::N, space$C)
k: NonNegativeInteger := 0
for i in 0..l-1 repeat
@@ -344,26 +344,26 @@ IndexedString(mn:Integer): Export == Implementation where
substring?(part, whole, startpos) ==
np:I := %strlength part
nw:I := %strlength whole
- (startpos := startpos - mn) < 0 => error "index out of bounds"
+ negative?(startpos := startpos - mn) => error "index out of bounds"
np > nw - startpos => false
for ip in 0..np-1 for iw in startpos.. repeat
not %ceq(%schar(part, ip), %schar(whole, iw)) => return false
true
position(s:%, t:%, startpos:I) ==
- (startpos := startpos - mn) < 0 => error "index out of bounds"
+ negative?(startpos := startpos - mn) => error "index out of bounds"
startpos >= %strlength t => mn - 1
r:I := STRPOS(s, t, startpos, NIL$Lisp)$Lisp
%peq(r, NIL$Lisp)$Foreign(Builtin) => mn - 1
r + mn
position(c: Character, t: %, startpos: I) ==
- (startpos := startpos - mn) < 0 => error "index out of bounds"
+ negative?(startpos := startpos - mn) => error "index out of bounds"
startpos >= %strlength t => mn - 1
for r in startpos..%strlength t - 1 repeat
if %ceq(%schar(t, r), c) then return r + mn
mn - 1
position(cc: CharacterClass, t: %, startpos: I) ==
- (startpos := startpos - mn) < 0 => error "index out of bounds"
+ negative?(startpos := startpos - mn) => error "index out of bounds"
startpos >= %strlength t => mn - 1
for r in startpos..%strlength t - 1 repeat
if member?(%schar(t,r), cc) then return r + mn
@@ -433,7 +433,7 @@ IndexedString(mn:Integer): Export == Implementation where
m := #x
n := #y
s := s - mn
- s < 0 or s+m > n => error "index out of range"
+ negative? s or s+m > n => error "index out of range"
RPLACSTR(y, s, m, x, 0, m)$Lisp
y
@@ -444,7 +444,7 @@ IndexedString(mn:Integer): Export == Implementation where
elt(s:%, sg:U) ==
l := lo(sg) - mn
h := if hasHi sg then hi(sg) - mn else maxIndex s - mn
- l < 0 or h >= #s => error "index out of bound"
+ negative? l or h >= #s => error "index out of bound"
SUBSTRING(s, l, max(0, h-l+1))$Lisp
hash s ==
diff --git a/src/algebra/sttaylor.spad.pamphlet b/src/algebra/sttaylor.spad.pamphlet
index 756129a8..ed89b75d 100644
--- a/src/algebra/sttaylor.spad.pamphlet
+++ b/src/algebra/sttaylor.spad.pamphlet
@@ -261,7 +261,7 @@ StreamTaylorSeriesOperations(A): Exports == Implementation where
concat(s,rpSt(z-1,s))
monom(s,z) ==
- z < 0 => error "monom: cannot create monomial of negative degree"
+ negative? z => error "monom: cannot create monomial of negative degree"
concat(rpSt(z,0),concat(s,zro()))
--% some streams of integers
@@ -498,7 +498,7 @@ Remarks:
integer, we won't get a Taylor expansion and thus raise an error.
<<package STTAYLOR StreamTaylorSeriesOperations>>=
- if ord > 0 and rn < 0 then
+ if ord > 0 and negative? rn then
error "**: negative power does not exist"
@
diff --git a/src/algebra/sum.spad.pamphlet b/src/algebra/sum.spad.pamphlet
index 1aa28145..e3d66075 100644
--- a/src/algebra/sum.spad.pamphlet
+++ b/src/algebra/sum.spad.pamphlet
@@ -162,7 +162,7 @@ GosperSummationMethod(E, V, R, P, Q): Exports == Impl where
-- sum(a(n), n) = q(n+1)/p(n) * a(n) * f(n).
-- 4. Bound the degree of f(n).
- (k := GosperDegBd(pn, qn, rn, n, newV)) < 0 => "failed"
+ negative?(k := GosperDegBd(pn, qn, rn, n, newV)) => "failed"
-- 5. Find a polynomial f of degree at most k, satisfying
-- p(n) = q(n+1)*f(n) - r(n)*f(n-1)
@@ -275,7 +275,7 @@ GosperSummationMethod(E, V, R, P, Q): Exports == Impl where
(p0 := retractIfCan(coefficient(p, 0))@Union(RN,"failed"))
case "failed" => "failed"
rt := -(p0::RN)/(p1::RN)
- rt < 0 or denom rt ~= 1 => "failed"
+ negative? rt or denom rt ~= 1 => "failed"
numer rt
@
diff --git a/src/algebra/term.spad.pamphlet b/src/algebra/term.spad.pamphlet
index c3c3b321..5a64aa9b 100644
--- a/src/algebra/term.spad.pamphlet
+++ b/src/algebra/term.spad.pamphlet
@@ -52,7 +52,7 @@ Arity(): Public == Private where
error "arity is too large for OpenAxiom"
per(n::SingleInteger)
retractIfCan x ==
- (n := rep x) < 0 => "failed"
+ negative?(n := rep x) => "failed"
n@Integer::NonNegativeInteger
@
diff --git a/src/algebra/tex.spad.pamphlet b/src/algebra/tex.spad.pamphlet
index 25af05ae..3b296d57 100644
--- a/src/algebra/tex.spad.pamphlet
+++ b/src/algebra/tex.spad.pamphlet
@@ -585,7 +585,7 @@ TexFormat(): public == private where
len := #str
%integer?(expr)$Foreign(Builtin) =>
i := expr pretend Integer
- if (i < 0) or (i > 9)
+ if negative? i or (i > 9)
then
group
nstr : String := ""
diff --git a/src/algebra/twofact.spad.pamphlet b/src/algebra/twofact.spad.pamphlet
index 667dbd5d..eb0bad93 100644
--- a/src/algebra/twofact.spad.pamphlet
+++ b/src/algebra/twofact.spad.pamphlet
@@ -188,7 +188,7 @@ TwoFactorize(F) : C == T
sqfrm:=squareFree m
for u in factors sqfrm repeat
expo:=u.exponent
- if expo < 0 then error "negative exponent in a factorisation"
+ if negative? expo then error "negative exponent in a factorisation"
expon:NonNegativeInteger:=expo::NonNegativeInteger
fac:=u.factor
degree fac = 1 => ll:=[["irred",fac,expon],:ll]
diff --git a/src/algebra/unifact.spad.pamphlet b/src/algebra/unifact.spad.pamphlet
index 5e52db28..4d5d874b 100644
--- a/src/algebra/unifact.spad.pamphlet
+++ b/src/algebra/unifact.spad.pamphlet
@@ -120,7 +120,7 @@ UnivariateFactorize(ZP) : public == private where
false
negShiftz(n: Z,Modulus:PI): Z ==
- if n < 0 then n := n+Modulus
+ if negative? n then n := n+Modulus
n > (Modulus quo 2) => n-Modulus
n
@@ -147,7 +147,7 @@ UnivariateFactorize(ZP) : public == private where
if cbound<j then cbound := j
(2*cbound*lcm)::PI -- adjusted by lcm to prepare for exquo in ghensel
- remp(t: Z,q:PI): Z == ((t := t rem q)<0 => t+q ;t)
+ remp(t: Z,q:PI): Z == (negative?(t := t rem q) => t+q ;t)
numFactors(ddlist:DDList): Z ==
ans: Z := 0
@@ -248,7 +248,7 @@ UnivariateFactorize(ZP) : public == private where
m := (m exquo c)::ZP
-- make the lc m positive
- if leadingCoefficient m < 0 then
+ if negative? leadingCoefficient m then
c := -c
m := -m
@@ -281,7 +281,7 @@ UnivariateFactorize(ZP) : public == private where
odd?(d) and (lcPol = reductum(m)) =>
for sfac in cyclotomicDecomposition(degree m)$CYC repeat
fac:=subMinusX sfac
- if leadingCoefficient fac < 0 then fac := -fac
+ if negative? leadingCoefficient fac then fac := -fac
factorlist := cons([fac,1]$ParFact,factorlist)
[c,factorlist]$FinalFact
diff --git a/src/algebra/view2D.spad.pamphlet b/src/algebra/view2D.spad.pamphlet
index 5d894871..c132bcec 100644
--- a/src/algebra/view2D.spad.pamphlet
+++ b/src/algebra/view2D.spad.pamphlet
@@ -401,7 +401,7 @@ GraphImage (): Exports == Implementation where
appendPoint (graf,aPoint) ==
num : I := #(graf.llPoints) - 1
- num < 0 => error "No point lists to append to!"
+ negative? num => error "No point lists to append to!"
(graf.llPoints.num) := append((graf.llPoints.num),[aPoint])
point (graf,aPoint,PointColor) ==
@@ -780,7 +780,7 @@ TwoDimensionalViewport ():Exports == Implementation where
-- exist.
sendI(VIEW,viewport.key)$Lisp
i := getI(VIEW)$Lisp
- (i < 0$I) =>
+ negative? i =>
viewport.key := 0$I
error "This viewport has already been closed!"
true
@@ -1111,7 +1111,7 @@ TwoDimensionalViewport ():Exports == Implementation where
sendSTR(VIEW,Filename)$Lisp
m := minIndex(avail := viewWriteAvailable())
for aTypeOfFile in thingsToWrite repeat
- if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
+ if negative?(writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) then
sayBrightly([" > "::E,(concat(aTypeOfFile, _
" is not a valid file type for writing a 2D viewport"))::E]$List(E))$Lisp
else
diff --git a/src/algebra/view3D.spad.pamphlet b/src/algebra/view3D.spad.pamphlet
index d1602fe1..9d931689 100644
--- a/src/algebra/view3D.spad.pamphlet
+++ b/src/algebra/view3D.spad.pamphlet
@@ -420,7 +420,7 @@ ThreeDimensionalViewport(): Exports == Implementation where
-- exist.
sendI(VIEW,viewport.key)$Lisp
i := getI(VIEW)$Lisp
- (i < 0$I) =>
+ negative? i =>
viewport.key := 0$I
error "This viewport has already been closed!"
true
@@ -839,7 +839,7 @@ ThreeDimensionalViewport(): Exports == Implementation where
getI(VIEW)$Lisp -- acknowledge
intensity(viewport,Amount) ==
- if (Amount < 0$F) or (Amount > 1$F) then
+ if negative? Amount or (Amount > 1$F) then
error "The intensity must be a value between 0 and 1, inclusively."
viewport.lighting.translucence := convert(Amount)@SF
(key(viewport) ~= 0$I) =>
@@ -864,7 +864,7 @@ ThreeDimensionalViewport(): Exports == Implementation where
sendSTR(VIEW,Filename)$Lisp
m := minIndex(avail := viewWriteAvailable())
for aTypeOfFile in thingsToWrite repeat
- if (writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) < 0 then
+ if negative?(writeTypeInt:= position(upperCase aTypeOfFile,avail)-m) then
sayBrightly([" > "::E,(concat(aTypeOfFile, _
" is not a valid file type for writing a 3D viewport"))::E]$List(E))$Lisp
else
diff --git a/src/algebra/viewDef.spad.pamphlet b/src/algebra/viewDef.spad.pamphlet
index fd552797..8a6a5f60 100644
--- a/src/algebra/viewDef.spad.pamphlet
+++ b/src/algebra/viewDef.spad.pamphlet
@@ -211,7 +211,7 @@ ViewDefaultsPackage():Exports == Implementation where
viewWriteDefault listOfThings ==
thingsToWrite : L S := []
for aTypeOfFile in listOfThings repeat
- if (writeTypeInt := position(upperCase aTypeOfFile,viewWriteAvailable())) < 0 then
+ if negative?(writeTypeInt := position(upperCase aTypeOfFile,viewWriteAvailable())) then
sayBrightly([" > ",concat(aTypeOfFile,
" is not a valid file type for writing a viewport")])$Lisp
else
diff --git a/src/algebra/wtpol.spad.pamphlet b/src/algebra/wtpol.spad.pamphlet
index fd370f3a..6f3dca56 100644
--- a/src/algebra/wtpol.spad.pamphlet
+++ b/src/algebra/wtpol.spad.pamphlet
@@ -71,7 +71,7 @@ WeightedPolynomials(R:Ring,VarSet: OrderedSet, E:OrderedAbelianMonoidSup,
l:=l.rest
0
innercoerce(p,z) ==
- z<0 => 0
+ negative? z => 0
zero? p => 0
mv:= mainVariable p
mv case "failed" => monomial(p,0)
diff --git a/src/algebra/zerodim.spad.pamphlet b/src/algebra/zerodim.spad.pamphlet
index 80c9b524..1d9fae67 100644
--- a/src/algebra/zerodim.spad.pamphlet
+++ b/src/algebra/zerodim.spad.pamphlet
@@ -498,7 +498,7 @@ InternalRationalUnivariateRepresentationPackage(R,E,V,P,TS): Exports == Implemen
internalAugment(s,newts)
next(lambda:Z):Z ==
- if lambda < 0 then lambda := - lambda + 1 else lambda := - lambda
+ if negative? lambda then lambda := - lambda + 1 else lambda := - lambda
makeLinearAndMonic(p: P, xi: V, ts: TS, univ?:B, check?: B, info?: B): List TS ==
-- if check? THEN some VERIFICATIONS are performed