Skip to content

Commit 3fa8cc0

Browse files
committed
remove incorrect promote(RR,QQ)
1 parent 19914f7 commit 3fa8cc0

File tree

5 files changed

+5
-31
lines changed

5 files changed

+5
-31
lines changed

M2/Macaulay2/m2/reals.m2

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ lift(RR,QQ) := opts -> (r,QQ) -> (
174174
d := m_(1,0);
175175
q := n / d;
176176
if r === numeric(p,q) then return q;
177-
if r' == 0 or abs(n*d) > p2 then return promote(r,QQ);
177+
if r' == 0 or abs(n*d) > p2 then return;
178178
r' = 1/r' ;
179179
))
180180
lift(RR,ZZ) := opts -> (r,ZZ) -> (
@@ -185,10 +185,6 @@ lift(CC,QQ) := lift(CC,ZZ) := opts -> (z,R) -> (
185185
if imaginaryPart z == 0 then lift(realPart z, R)
186186
else if opts.Verify then error "lift: complex number not real"
187187
)
188-
promote(RR,QQ) := (z,QQ) -> if z === 0. then 0/1 else if isFinite z then (
189-
(prec,sgn,expt,m,numbits) := partsRR z;
190-
sgn * m / 2^(numbits - expt)
191-
) else error "promote(RR,QQ): non-finite number encountered"
192188
liftable(RRi,QQ) := (z,RR) -> diameter(z) == 0
193189
liftable(RRi,ZZ) := (z,RR) -> diameter(z) == 0
194190
lift(RRi,QQ) := opts -> (r,QQ) -> (

M2/Macaulay2/packages/Macaulay2Doc/changes.m2

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2857,11 +2857,6 @@ document {
28572857
"The quotient and remainder for two ring elements can now be obtained simultaneously,
28582858
saving time. See ", TO (quotientRemainder,RingElement,RingElement), "."
28592859
},
2860-
LI {
2861-
"The binary representation of a real number is now available using ", TO (promote,RR,QQ), ".
2862-
The code for ", TO (lift,RR,QQ), " has been tightened up so a rational number is provided
2863-
that provides exactly the same real number when promoted."
2864-
},
28652860
LI {
28662861
"The Emacs commands ", KBD "M-x M2", ", bound to ", KBD "F12", ", and ", TT "M2-send-to-program",
28672862
", bound to ", KBD "F11", ", have some new capability.

M2/Macaulay2/packages/Macaulay2Doc/functions/lift-doc.m2

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,16 @@ document {
118118
lift(3.0,QQ)
119119
///,
120120
PARA{
121-
"A continued fraction method is used to lift a real number to a rational number, whereas
122-
", TO "promote", " uses the internal binary representation.",
121+
"A continued fraction method is used to lift a real number to a rational number."
123122
},
124123
EXAMPLE lines ///
125124
lift(123/2341.,QQ)
126-
promote(123/2341.,QQ)
127125
factor oo
128126
///,
129127
PARA { "For numbers and ring elements, an alternate syntax with ", TO "^", " is available,
130128
analogous to the use of ", TO "_", " for ", TO "promote", "." },
131129
EXAMPLE lines ///
132130
.0001^QQ
133-
.0001_QQ
134131
///,
135132
SeeAlso => { baseRings, promote },
136133
Subnodes => {

M2/Macaulay2/packages/Macaulay2Doc/functions/promote-doc.m2

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ undocumented {(promote,CC,CC_*),
9797

9898
document {
9999
Key => {promote,
100-
(symbol _, RingElement, Ring),(symbol _,Number,Ring),
101-
(promote,RR,QQ)},
100+
(symbol _, RingElement, Ring),(symbol _,Number,Ring)},
102101
Headline => "promote to another ring",
103102
Usage => "promote(f,R)",
104103
Inputs => {
@@ -120,17 +119,6 @@ document {
120119
promote(f,S)
121120
G = map(S,R); G(f)
122121
///,
123-
PARA {
124-
"Promotion of real numbers to rational numbers is accomplished by using all of the bits of
125-
the internal representation."
126-
},
127-
EXAMPLE lines ///
128-
promote(101.,QQ)
129-
promote(.101,QQ)
130-
factor denominator oo
131-
ooo + 0.
132-
oo === .101
133-
///,
134122
PARA {
135123
"For promotion of ring elements, there is the following shorter notation."
136124
},

M2/Macaulay2/packages/Nauty.m2

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ generateRandomGraphs (ZZ, ZZ, ZZ) := List => opts -> (n, num, p) -> (
247247
rndSeed := if instance(opts.RandomSeed, ZZ) then " -S" | toString(opts.RandomSeed % 2^30) else "";
248248
callNauty("genrang -qg -P" | toString p | " " | toString n | " " | toString num | rndSeed, {})
249249
)
250-
generateRandomGraphs (ZZ, ZZ, QQ) := List => opts -> (n, num, p) -> (
250+
generateRandomGraphs (ZZ, ZZ, Number) := List => opts -> (n, num, p) -> (
251251
if n < 1 then error("generateRandomGraphs: nauty does not like graphs with non-positive numbers of vertices.");
252252
if num < 1 then return {};
253253
if p <= 0 or p > 1 then error("generateRandomGraphs: Probability must be between 0 and 1.");
@@ -257,7 +257,6 @@ generateRandomGraphs (ZZ, ZZ, QQ) := List => opts -> (n, num, p) -> (
257257
q := round(100000000 * p) / 100000000;
258258
callNauty("genrang -qg -P" | toString q | " " | toString n | " " | toString num | rndSeed, {})
259259
)
260-
generateRandomGraphs (ZZ, ZZ, RR) := List => opts -> (n, num, p) -> generateRandomGraphs(n, num, promote(p, QQ), opts)
261260
generateRandomGraphs (ZZ, ZZ) := List => opts -> (n, num) -> (
262261
if n < 1 then error("generateRandomGraphs: nauty does not like graphs with non-positive numbers of vertices.");
263262
if not instance(opts.RandomSeed, Nothing) and not instance(opts.RandomSeed, ZZ) then error("generateRandomGraphs: Option [RandomSeed] is not a valid type, i.e., ZZ or Nothing.");
@@ -1049,8 +1048,7 @@ doc ///
10491048
generateRandomGraphs
10501049
(generateRandomGraphs, ZZ, ZZ)
10511050
(generateRandomGraphs, ZZ, ZZ, ZZ)
1052-
(generateRandomGraphs, ZZ, ZZ, QQ)
1053-
(generateRandomGraphs, ZZ, ZZ, RR)
1051+
(generateRandomGraphs, ZZ, ZZ, Number)
10541052
(generateRandomGraphs, PolynomialRing, ZZ)
10551053
(generateRandomGraphs, PolynomialRing, ZZ, ZZ)
10561054
(generateRandomGraphs, PolynomialRing, ZZ, QQ)

0 commit comments

Comments
 (0)