Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions M2/Macaulay2/m2/reals.m2
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,11 @@ EulerConstant = new Constant from { symbol EulerConstant, mpfrConstantEuler, eRR
CatalanConstant = new Constant from { symbol CatalanConstant, mpfrConstantCatalan, cRRi0}
ii = new Constant from { symbol ii, ConstantII}

ring Constant := ring @@ numeric
promote(Constant, InexactNumber') :=
promote(Constant, RingElement) := (x, R) -> (
promote(numeric(precision R, x), R))

isFinite Constant := x -> true

lngamma = method()
Expand Down
3 changes: 3 additions & 0 deletions M2/Macaulay2/tests/normal/matrix.m2
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ scan({matrix {}, matrix(ZZ, {}), map(ZZ^0, ZZ^0, {}), map(ZZ^0,, {})}, A -> (
assert Equation(source A, ZZ^0);
assert Equation(target A, ZZ^0)))

-- issue #3456
assert Equation(matrix {{ii}}, matrix {{numeric ii}})

-- Local Variables:
-- compile-command: "make -C $M2BUILDDIR/Macaulay2/packages/Macaulay2Doc/test matrix.out"
-- End:
6 changes: 6 additions & 0 deletions M2/Macaulay2/tests/normal/numbers.m2
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ assert( promote(1,RR) === 1. )
assert( promote(1,RR_222) === 1p222 )
assert( promote(1/1,RR) === 1. )
assert( promote(1/1,RR_222) === 1p222 )
assert( promote(pi, RR_222) === numeric(222, pi) )
assert( promote(pi, RR_222[x]) == numeric(222, pi) )

assert( promote(1,CC) == 1 )
assert( promote(1,CC) == 1. )
Expand All @@ -143,6 +145,10 @@ assert( promote(1.,CC) == 1. )
assert( promote(1.,CC) === 1.+0*ii )
assert( promote(1.,CC_222) === toCC 1p222 )
assert( promote(1.,CC_222) === toCC 1p222 )
assert( promote(pi, CC_222) === toCC(222, numeric(222, pi), 0.0) )
assert( promote(ii, CC_222) === toCC(222, 0, 1) )
assert( promote(pi, CC_222[x]) == numeric(222, pi) )
assert( promote(ii, CC_222[x]) == toCC(222, 0, 1 ) )
assert( not liftable(+ii,RR) )
assert( liftable(0*ii,RR) )
assert( lift(3.5,QQ) === 7/2 )
Expand Down