diff options
author | dos-reis <gdr@axiomatics.org> | 2011-08-10 23:30:02 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-08-10 23:30:02 +0000 |
commit | 7c7d44f1dc284e4c4e231d97023aa87ecd5f8e44 (patch) | |
tree | db90d375dde6576789ad23ae39dc5de66b148e57 /src/algebra/float.spad.pamphlet | |
parent | e6b1636fe3b19b148f347f6b9f00642db83c5ddc (diff) | |
download | open-axiom-7c7d44f1dc284e4c4e231d97023aa87ecd5f8e44.tar.gz |
* algebra/float.spad.pamphlet (Float): Tidy.
* algebra/fortmac.spad.pamphlet (MachineInteger): Likewise.
* algebra/fspace.spad.pamphlet (FunctionSpace): Likewise.
* algebra/integer.spad.pamphlet (Integer): Likewise.
* algebra/mkfunc.spad.pamphlet (InputForm): Likewise.
* algebra/newpoly.spad.pamphlet (RecursivePolynomialCategory):
Likewise.
* input/knot.input.pamphlet: Likewise.
* input/knot2.input.pamphlet: Likewise.
* input/mult3d.input.pamphlet: Likewise.
* input/multKnot.input.pamphlet: Likewise.
* input/r21bugsbig.input.pamphlet: Likewise.
* input/tutchap2.input.pamphlet: Likewise.
Diffstat (limited to 'src/algebra/float.spad.pamphlet')
-rw-r--r-- | src/algebra/float.spad.pamphlet | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/algebra/float.spad.pamphlet b/src/algebra/float.spad.pamphlet index ffafb040..75bc17a5 100644 --- a/src/algebra/float.spad.pamphlet +++ b/src/algebra/float.spad.pamphlet @@ -819,7 +819,7 @@ Float(): fixed f == zero? f => "0.0" zero? exponent f => - padFromRight concat(convert(mantissa f)@S, ".0") + padFromRight concat(string mantissa f, ".0") negative? f => concat("-", fixed abs f) d := if OUTPREC() = -1 then digits()::I else OUTPREC() -- g := convert10(abs f,digits); m := g.mantissa; e := g.exponent @@ -830,7 +830,7 @@ Float(): if -e > OUTPREC() and -e < 2*digits()::I then g := normalize10(g,l+e+OUTPREC()) m := g.mantissa; e := g.exponent - s := convert(m)@S; n := #s; o := e+n + s := string m; n := #s; o := e+n p := if OUTPREC() = -1 then n::I else OUTPREC() t:S if e >= 0 then @@ -855,15 +855,15 @@ Float(): negative? f => concat("-", floating abs f) t:S := if zero? SPACING() then "E" else " E " zero? exponent f => - s := convert(mantissa f)@S - concat ["0.", padFromLeft s, t, convert(#s)@S] + s := string mantissa f + concat ["0.", padFromLeft s, t, string(#s)] -- base conversion to decimal rounded to the requested precision d := if OUTPREC() = -1 then digits()::I else OUTPREC() g := convert10(f,d); m := g.mantissa; e := g.exponent -- I'm assuming that length10 m = # s given n > 0 - s := convert(m)@S; n := #s; o := e+n + s := string m; n := #s; o := e+n s := padFromLeft s - concat ["0.", s, t, convert(o)@S] + concat ["0.", s, t, string o] general(f) == zero? f => "0.0" @@ -871,15 +871,15 @@ Float(): d := if OUTPREC() = -1 then digits()::I else OUTPREC() zero? exponent f => d := d + 1 - s := convert(mantissa f)@S + s := string mantissa f OUTPREC() ~= -1 and (e := #s) > d => t:S := if zero? SPACING() then "E" else " E " - concat ["0.", padFromLeft s, t, convert(e)@S] + concat ["0.", padFromLeft s, t, string e] padFromRight concat(s, ".0") -- base conversion to decimal rounded to the requested precision g := convert10(f,d); m := g.mantissa; e := g.exponent -- I'm assuming that length10 m = # s given n > 0 - s := convert(m)@S; n := #s; o := n + e + s := string m; n := #s; o := n + e -- Note: at least one digit is displayed after the decimal point -- and trailing zeroes after the decimal point are dropped if positive? o and o <= max(n,d) then @@ -896,7 +896,7 @@ Float(): -- print using E format written 0.mantissa E exponent t := padFromLeft rightTrim(s,zero) s := if zero? SPACING() then "E" else " E " - concat ["0.", t, s, convert(e+n)@S] + concat ["0.", t, s, string(e+n)] outputSpacing n == SPACING() := n outputFixed() == (OUTMODE() := "fixed"; OUTPREC() := -1) |