Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions M2/Macaulay2/d/actors3.d
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ EqualEqualfun(x:Expr,y:Expr):Expr := (
is yy:ZZcell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, ZZ, Boolean
is yy:QQcell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, QQ, Boolean
is yy:RRcell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, RR, Boolean
is yy:RRbcell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, RRb, Boolean
is yy:RRicell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, RRi, Boolean
is yy:CCcell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, ZZ, CC, Boolean
else equalmethod(x,y)
Expand All @@ -123,6 +124,7 @@ EqualEqualfun(x:Expr,y:Expr):Expr := (
is yy:ZZcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, QQ, ZZ, Boolean
is yy:QQcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, QQ, QQ, Boolean
is yy:RRcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, QQ, RR, Boolean
is yy:RRbcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, QQ, RRb, Boolean
is yy:RRicell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, QQ, RRi, Boolean
is yy:CCcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, QQ, CC, Boolean
else equalmethod(x,y)
Expand All @@ -132,10 +134,21 @@ EqualEqualfun(x:Expr,y:Expr):Expr := (
is yy:ZZcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RR, ZZ, Boolean
is yy:QQcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RR, QQ, Boolean
is yy:RRcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RR, RR, Boolean
is yy:RRbcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RR, RRb, Boolean
is yy:RRicell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, RR, RRi, Boolean
is yy:CCcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RR, CC, Boolean
else equalmethod(x,y)
)
is xx:RRbcell do (
when y
is yy:ZZcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRb, ZZ, Boolean
is yy:QQcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRb, QQ, Boolean
is yy:RRcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRb, RR, Boolean
is yy:RRbcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRb, RRb, Boolean
is yy:RRicell do toExpr(yy.v === xx.v) -- # typical value: symbol ==, RRb, RRi, Boolean
is yy:CCcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRb, CC, Boolean
else equalmethod(x,y)
)
is xx:RRicell do (
when y is yy:RRicell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRi, RRi, Boolean
is yy:ZZcell do toExpr(xx.v === yy.v) -- # typical value: symbol ==, RRi, ZZ, Boolean
Expand Down
16 changes: 16 additions & 0 deletions M2/Macaulay2/d/actors4.d
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,7 @@ tostringfun(e:Expr):Expr := (
is DictionaryClosure do toExpr("<<a dictionary>>")
is NetFile do toExpr("<<a netfile>>")
is x:RRcell do toExpr(tostringRR(x.v))
is x:RRbcell do toExpr(tostringRR(x.v))
is x:RRicell do toExpr(tostringRRi(x.v))
is z:CCcell do toExpr(tostringCC(z.v))
is Error do toExpr("<<an error message>>")
Expand Down Expand Up @@ -1098,6 +1099,7 @@ format(e:Expr):Expr := (
is ZZcell do e
is QQcell do e
is RRcell do format(Expr(Sequence(e)))
is RRbcell do format(Expr(Sequence(e)))
is RRicell do format(Expr(Sequence(e)))
is CCcell do format(Expr(Sequence(e)))
is args:Sequence do (
Expand All @@ -1121,6 +1123,7 @@ format(e:Expr):Expr := (
is x:ZZcell do toExpr(concatenate(format(s,ac,l,t,sep,toRR(x.v,defaultPrecision))))
is x:QQcell do toExpr(concatenate(format(s,ac,l,t,sep,toRR(x.v,defaultPrecision))))
is x:RRcell do toExpr(concatenate(format(s,ac,l,t,sep,x.v)))
is x:RRbcell do toExpr(concatenate(format(s,ac,l,t,sep,Ccode(RR, x.v))))
is z:CCcell do toExpr(format(s,ac,l,t,sep,false,false,z.v))
else WrongArgRR(n)
)
Expand Down Expand Up @@ -1342,6 +1345,7 @@ toRR(e:Expr):Expr := (
is x:ZZcell do toExpr(toRR(x.v,defaultPrecision))
is x:QQcell do toExpr(toRR(x.v,defaultPrecision))
is RRcell do e
is x:RRbcell do toExpr(Ccode(RR, x.v))
is x:RRicell do toExpr(midpointRR(x.v))
is s:Sequence do (
if length(s) != 2 then WrongNumArgs(1,2) else
Expand All @@ -1352,6 +1356,7 @@ toRR(e:Expr):Expr := (
is x:ZZcell do toExpr(toRR(x.v,toULong(prec.v)))
is x:QQcell do toExpr(toRR(x.v,toULong(prec.v)))
is x:RRcell do toExpr(toRR(x.v,toULong(prec.v)))
is x:RRbcell do toExpr(toRR(Ccode(RR, x.v),toULong(prec.v)))
is x:RRicell do toExpr(midpointRR(x.v,toULong(prec.v)))
else WrongArg(1,"an integral, rational, or real number")
)
Expand Down Expand Up @@ -1493,6 +1498,7 @@ toCC(e:Expr):Expr := (
is x:ZZcell do toExpr(toCC(x.v,defaultPrecision)) -- # typical value: toCC, ZZ, CC
is x:QQcell do toExpr(toCC(x.v,defaultPrecision)) -- # typical value: toCC, QQ, CC
is x:RRcell do toExpr(toCC(x.v)) -- # typical value: toCC, RR, CC
is x:RRbcell do toExpr(toCC(Ccode(RR, x.v))) -- # typical value: toCC, RRb, CC
is CCcell do e -- # typical value: toCC, CC, CC
is s:Sequence do (
if length(s) == 2 then (
Expand All @@ -1503,12 +1509,19 @@ toCC(e:Expr):Expr := (
is x:ZZcell do toExpr(toCC(x.v,toULong(prec.v))) -- # typical value: toCC, ZZ, ZZ, CC
is x:QQcell do toExpr(toCC(x.v,toULong(prec.v))) -- # typical value: toCC, ZZ, QQ, CC
is x:RRcell do toExpr(toCC(x.v,toULong(prec.v))) -- # typical value: toCC, ZZ, RR, CC
is x:RRbcell do toExpr(toCC(Ccode(RR, x.v),toULong(prec.v))) -- # typical value: toCC, ZZ, RRb, CC
is x:CCcell do toExpr(toCC(x.v,toULong(prec.v))) -- # typical value: toCC, ZZ, CC, CC
else WrongArg("a rational number, real number, or an integer")
)
)
is x:RRcell do (
when s.1 is y:RRcell do toExpr(toCC(x.v,y.v)) -- # typical value: toCC, RR, RR, CC
is y:RRbcell do toExpr(toCC(x.v,Ccode(RR, y.v))) -- # typical value: toCC, RR, RRb, CC
else WrongArgRR()
)
is x:RRbcell do (
when s.1 is y:RRcell do toExpr(toCC(Ccode(RR, x.v),y.v)) -- # typical value: toCC, RRb, RR, CC
is y:RRbcell do toExpr(toCC(Ccode(RR, x.v),Ccode(RR, y.v))) -- # typical value: toCC, RRb, RRb, CC
else WrongArgRR()
)
else WrongArgZZ(1)
Expand All @@ -1530,6 +1543,7 @@ toCC(e:Expr):Expr := (
is x:QQcell do toRR(x.v,toULong(prec.v))
is x:ZZcell do toRR(x.v,toULong(prec.v))
is x:RRcell do toRR(x.v,toULong(prec.v))
is x:RRbcell do toRR(Ccode(RR, x.v),toULong(prec.v))
else (
return WrongArg("a rational number, real number, or an integer");
toRR(0,toULong(prec.v)) -- dummy
Expand All @@ -1539,6 +1553,7 @@ toCC(e:Expr):Expr := (
is x:QQcell do toRR(x.v,toULong(prec.v))
is x:ZZcell do toRR(x.v,toULong(prec.v))
is x:RRcell do toRR(x.v,toULong(prec.v))
is x:RRbcell do toRR(Ccode(RR, x.v),toULong(prec.v))
else (
return WrongArg("a rational number, real number, or an integer");
toRR(0,toULong(prec.v)) -- dummy
Expand All @@ -1551,6 +1566,7 @@ setupfun("toCC",toCC);
precision(e:Expr):Expr := (
when e
is x:RRcell do toExpr(precision(x.v))
is x:RRbcell do toExpr(precision0(Ccode(RR, x.v)))
is x:RRicell do toExpr(precision(x.v))
is x:CCcell do toExpr(precision(x.v))
else WrongArgRR());
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/d/basic.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export hash(e:Expr):hash_t := (
is x:DictionaryClosure do x.dictionary.hash -- there may be many dictionary closures with the same dictionary and different frames, too bad
is x:QQcell do hash(x.v)
is x:RRcell do hash(x.v)
is x:RRbcell do hash(x.v)
is x:RRicell do hash(x.v)
is x:CCcell do hash(x.v)
is x:Sequence do (
Expand Down
2 changes: 2 additions & 0 deletions M2/Macaulay2/d/classes.dd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ setupconst("RingFamily",Expr(ringFamilyClass));
setupconst("InexactFieldFamily",Expr(inexactNumberTypeClass));
setupconst("RRi",Expr(RRiClass));
setupconst("RR",Expr(RRClass));
setupconst("RRb",Expr(RRbClass));
setupconst("CC",Expr(CCClass));
setupconst("RingElement",Expr(ringElementClass));
setupconst("Number",Expr(numberClass));
Expand Down Expand Up @@ -147,6 +148,7 @@ export Class(e:Expr):HashTable := (
is SymbolBody do symbolBodyClass
is RRicell do RRiClass
is RRcell do RRClass
is RRbcell do RRbClass
is CCcell do CCClass
is RawComputationCell do rawComputationClass
is Nothing do nothingClass
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/d/common.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export codePosition(c:Code):Position := ( -- TODO retire
when c
is f:nullCode do dummyPosition
is f:realCode do f.position
is f:realRRbCode do f.position
is f:stringCode do f.position
is f:integerCode do f.position
is f:globalMemoryReferenceCode do f.position
Expand Down
6 changes: 6 additions & 0 deletions M2/Macaulay2/d/convertr.d
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ convertTokenReference(token:Token):Code := (
is y:RR do Code(realCode(y, pos))
is null do Code(Error(
pos, "expected precision to be a small non-negative integer", nullE, false, dummyFrame)))
else if wrd.typecode == TCRRb
then (
when parseRRb(wrd.name)
is y:RRb do Code(realRRbCode(y, pos))
is null do Code(Error(
pos, "expected precision to be a small non-negative integer", nullE, false, dummyFrame)))
else (
if var.frameID == 0 then
if var.thread
Expand Down
2 changes: 2 additions & 0 deletions M2/Macaulay2/d/debugging.dd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export tostring(c:Code):string := (
when c
is x:nullCode do "(null)"
is x:realCode do tostringRR(x.x)
is x:realRRbCode do tostringRR(x.x) -- Use same toString function for now
is x:integerCode do tostring(x.x)
is x:stringCode do concatenate(array(string)("\"", present(x.x), "\""))
is x:Error do concatenate(array(string)("(error \"", x.message, "\")"))
Expand Down Expand Up @@ -93,6 +94,7 @@ export toList(c:Code):Expr := (
when c
is x:nullCode do nullE
is x:realCode do toExpr(x.x)
is x:realRRbCode do toExpr(x.x)
is x:integerCode do toExpr(x.x)
is x:stringCode do toExpr(tostring(c))
is x:Error do list(toExpr("error"), toExpr(x.message))
Expand Down
6 changes: 6 additions & 0 deletions M2/Macaulay2/d/equality.dd
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ export equal(lhs:Expr,rhs:Expr):Expr := (
if strictequality(x.v,y.v) then True else False
)
else False)
is x:RRbcell do (
when rhs
is y:RRbcell do (
if strictequality(x.v,y.v) then True else False
)
else False)
is x:RRicell do ( -- Added for MPFI
when rhs
is y:RRicell do (
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/d/evaluate.d
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,7 @@ export evalraw(c:Code):Expr := (
is c:newOfFromCode do NewOfFromFun(c.newClause,c.ofClause,c.fromClause)
is nullCode do return nullE
is v:realCode do return Expr(RRcell(v.x))
is v:realRRbCode do return Expr(RRbcell(v.x))
is v:integerCode do return Expr(ZZcell(v.x))
is v:stringCode do return Expr(stringCell(v.x))
is v:Error do Expr(v)
Expand Down
1 change: 1 addition & 0 deletions M2/Macaulay2/d/expr.d
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ export ringFamilyClass := newtypeof(typeClass);
export inexactNumberTypeClass := newtypeof(ringFamilyClass);
newbignumbertype():HashTable := newHashTableWithHash(inexactNumberTypeClass,inexactNumberClass);
export RRClass := newbignumbertype();
export RRbClass := newbignumbertype();
export CCClass := newbignumbertype();

export rawObjectClass := newbasictype(); -- RawObject
Expand Down
Loading