aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/integer.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-06-23 12:57:00 +0000
committerdos-reis <gdr@axiomatics.org>2010-06-23 12:57:00 +0000
commit5c81f5a89627a71d4e0054730eea47cc99a9cef2 (patch)
tree5294366b1c51fc299456864c317bbcdfee21315d /src/algebra/integer.spad.pamphlet
parentb06599402ca23cce8ba7eea03886dc11a5d29af4 (diff)
downloadopen-axiom-5c81f5a89627a71d4e0054730eea47cc99a9cef2.tar.gz
* interp/nruncomp.boot (optDeltaEntry): Don't optimize current
domain modemap references here. * interp/g-opt.boot ($VMsideEffectFreeOperators): Include more floating point operators. ($simpleVMoperators): Move FUNCALL here. (isVMConstantForm): Tidy. * interp/g-util.boot: Expand more floating point insns. * interp/c-util.boot (replaceSimpleFunctions): Replace more constants. * algebra/integer.spad.pamphlet (Integer): More cleanup. Use builtin functions. * algebra/sf.spad.pamphlet: Likewise.
Diffstat (limited to 'src/algebra/integer.spad.pamphlet')
-rw-r--r--src/algebra/integer.spad.pamphlet25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/algebra/integer.spad.pamphlet b/src/algebra/integer.spad.pamphlet
index 2ca80be3..ffcb0206 100644
--- a/src/algebra/integer.spad.pamphlet
+++ b/src/algebra/integer.spad.pamphlet
@@ -82,6 +82,12 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with
== add
ZP ==> SparseUnivariatePolynomial %
ZZP ==> SparseUnivariatePolynomial Integer
+ import %ineg: % -> % from Foreign Builtin
+ import %hash: % -> SingleInteger from Foreign Builtin
+ import %iadd: (%,%) -> % from Foreign Builtin
+ import %isub: (%,%) -> % from Foreign Builtin
+ import %imul: (%,%) -> % from Foreign Builtin
+
x,y: %
n: NonNegativeInteger
@@ -138,19 +144,19 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with
copy x == x
inc x == x + 1
dec x == x - 1
- hash x == SXHASH(x)$Lisp
+ hash x == %hash x
negative? x == MINUSP(x)$Lisp
coerce(x):OutputForm == outputForm(x pretend Integer)
coerce(m:Integer):% == m pretend %
convert(x:%):Integer == x pretend Integer
length a == INTEGER_-LENGTH(a)$Lisp
addmod(a, b, p) ==
- (c:=a + b) >= p => c - p
+ (c := %iadd(a,b)) >= p => c - p
c
submod(a, b, p) ==
- (c:=a - b) < 0 => c + p
+ (c := %isub(a,b)) < 0 => c + p
c
- mulmod(a, b, p) == (a * b) rem p
+ mulmod(a, b, p) == %imul(a,b) rem p
convert(x:%):Float == coerce(x pretend Integer)$Float
convert(x:%):DoubleFloat == coerce(x pretend Integer)$DoubleFloat
convert(x:%):InputForm == convert(x pretend Integer)$InputForm
@@ -182,12 +188,11 @@ Integer: Join(IntegerNumberSystem, ConvertibleTo String, OpenMath) with
x > y == %igt(x,y)$Foreign(Builtin)
x <= y == %ile(x,y)$Foreign(Builtin)
x >= y == %ige(x,y)$Foreign(Builtin)
- - x == (-x)$Lisp
- x + y == %iadd(x,y)$Foreign(Builtin)
- x - y == %isub(x,y)$Foreign(Builtin)
- x * y == %imul(x,y)$Foreign(Builtin)
- (m:Integer) * (y:%) ==
- %imul(m,y)$Foreign(Builtin) -- for subsumption problem
+ - x == %ineg x
+ x + y == %iadd(x,y)
+ x - y == %isub(x,y)
+ x * y == %imul(x,y)
+ (m:Integer) * (y:%) == %imul(m,y) -- for subsumption problem
x ** n == %ipow(x,n)$Foreign(Builtin)
odd? x == %iodd?(x)$Foreign(Builtin)
max(x,y) == %imax(x,y)$Foreign(Builtin)