Skip to content

Commit 0a80e0b

Browse files
committed
Remove now-unused code from CC-formatting code in interpreter
Abbreviating "*ii" -> "i" and possibly parenthesizing was only used in the engine, but now that's handled by the engine.
1 parent c8f07a6 commit 0a80e0b

File tree

2 files changed

+5
-25
lines changed

2 files changed

+5
-25
lines changed

M2/Macaulay2/d/actors4.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ format(e:Expr):Expr := (
11151115
is x:ZZcell do toExpr(concatenate(format(s,ac,l,t,sep,toRR(x.v,defaultPrecision))))
11161116
is x:QQcell do toExpr(concatenate(format(s,ac,l,t,sep,toRR(x.v,defaultPrecision))))
11171117
is x:RRcell do toExpr(concatenate(format(s,ac,l,t,sep,x.v)))
1118-
is z:CCcell do toExpr(format(s,ac,l,t,sep,false,false,z.v))
1118+
is z:CCcell do toExpr(format(s,ac,l,t,sep,z.v))
11191119
else WrongArgRR(n)
11201120
)
11211121
else WrongArg("string, or real number, integer, integer, integer, string"));

M2/Macaulay2/d/gmp1.d

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -208,44 +208,24 @@ export format(
208208
l:int, -- max number leading zeroes
209209
t:int, -- max number extra trailing digits
210210
sep:string, -- separator between mantissa and exponent
211-
abb:bool, -- whether to abbreviate "*ii" to "i"
212-
paren:bool, -- whether to parenthesize a sum and prepend a possible '-'
213211
z:CC -- the number to format
214212
) : string := (
215213
if isnan(z.re) || isnan(z.im) then return "NotANumber";
216214
if isinf(z.re) || isinf(z.im) then return "infinity";
217215
if s != 0 && ac == -1 && !isZero(z.re) && !isZero(z.im) then ac = s - int(floor(double(exponent(z))/log2ten));
218-
star := if abb then "" else "*" ;
219-
i := if abb then "i" else "ii";
216+
star := "*";
217+
i := "ii";
220218
x := format(s,ac,l,t,sep,z.re);
221219
y := format(s,ac,l,t,sep,z.im);
222220
if y.1 === "0" then return if x.1 === "0" then "0" else concatenate(x);
223221
if y.1 === "1" then (y.1 = ""; star = "");
224222
if x.1 === "0" then return concatenate(array(string)(y.0,y.1,star,i));
225223
if y.0 === "" then y.0 = "+";
226-
lp := "";
227-
rp := "";
228-
if paren then (
229-
if x.0 === "-"
230-
then (
231-
x.0 = "";
232-
lp = "-(";
233-
if y.0 .0 == '-' then y.0 = "+" else y.0 = "-")
234-
else lp = "(";
235-
rp = ")";
236-
);
237-
concatenate(array(string)(lp,x.0,x.1,y.0,y.1,star,i,rp)));
224+
concatenate(array(string)(x.0,x.1,y.0,y.1,star,i)));
238225

239226
export tostringCC(z:CC):string := (
240-
format(printingPrecision,printingAccuracy,printingLeadLimit,printingTrailLimit,printingSeparator,false,false,z)
241-
);
242-
export tonetCC(z:CC):string := (
243-
format(printingPrecision,printingAccuracy,printingLeadLimit,printingTrailLimit,printingSeparator,true,false,z)
227+
format(printingPrecision,printingAccuracy,printingLeadLimit,printingTrailLimit,printingSeparator,z)
244228
);
245-
export tonetCCparen(z:CC):string := (
246-
format(printingPrecision,printingAccuracy,printingLeadLimit,printingTrailLimit,printingSeparator,true,true,z)
247-
);
248-
249229
export toExternalString(z:CC):string := concatenate(array(string)(
250230
"toCC(",
251231
toExternalString(realPart(z)),

0 commit comments

Comments
 (0)