@@ -29,8 +29,8 @@ using Compat
2929
3030import Base: reinterpret, zero, one, abs, sign, == , < , <= , + , - , / , * , div,
3131 rem, divrem, fld, mod, fldmod, fld1, mod1, fldmod1, isinteger,
32- typemin, typemax, realmin, realmax, show, convert, promote_rule ,
33- min, max, trunc, round, floor, ceil, eps, float, widemul
32+ typemin, typemax, realmin, realmax, print, show, string, convert ,
33+ promote_rule, min, max, trunc, round, floor, ceil, eps, float, widemul
3434
3535"""
3636 FixedDecimal{I <: Integer, f::Int}
@@ -223,17 +223,10 @@ realmin{T <: FD}(::Type{T}) = eps(T)
223223realmax {T <: FD} (:: Type{T} ) = typemax (T)
224224
225225# printing
226- function show {T} (io:: IO , x:: FD{T, 0} )
227- iscompact = get (io, :compact , false )
228- if ! iscompact
229- print (io, " FixedDecimal{$T ,0}(" )
230- end
226+ function print {T} (io:: IO , x:: FD{T, 0} )
231227 print (io, x. i)
232- if ! iscompact
233- print (io, ' )' )
234- end
235228end
236- function show {T, f} (io:: IO , x:: FD{T, f} )
229+ function print {T, f} (io:: IO , x:: FD{T, f} )
237230 iscompact = get (io, :compact , false )
238231
239232 # note: a is negative if x.i == typemin(x.i)
@@ -242,9 +235,6 @@ function show{T, f}(io::IO, x::FD{T, f})
242235 integer = abs (integer) # ...but since f > 0, this is positive
243236 fractional = abs (fractional)
244237
245- if ! iscompact
246- print (io, " FixedDecimal{$T ,$f }(" )
247- end
248238 if s == - 1
249239 print (io, " -" )
250240 end
@@ -256,6 +246,14 @@ function show{T, f}(io::IO, x::FD{T, f})
256246 end
257247 end
258248 print (io, integer, ' .' , fractionchars)
249+ end
250+
251+ function show {T, f} (io:: IO , x:: FD{T, f} )
252+ iscompact = get (io, :compact , false )
253+ if ! iscompact
254+ print (io, " FixedDecimal{$T ,$f }(" )
255+ end
256+ print (io, x)
259257 if ! iscompact
260258 print (io, ' )' )
261259 end
0 commit comments