@@ -84,15 +84,10 @@ widen1(::Type{Int64}) = Int128
8484widen1 (:: Type{UInt64} ) = UInt128
8585widen1 (x:: Integer ) = x % widen1 (typeof (x))
8686
87- if VERSION <= v " 0.5.0-dev+755"
88- @generated function floattype {T,f} (:: Type{FixedPoint{T,f}} )
89- f> 22 ? :(Float64) : :(Float32)
90- end
91- else
92- @pure function floattype {T,f} (:: Type{FixedPoint{T,f}} )
93- f> 22 ? Float64 : Float32
94- end
95- end
87+ typealias ShortInts Union{Int8,UInt8,Int16,UInt16}
88+
89+ floattype {T<:ShortInts,f} (:: Type{FixedPoint{T,f}} ) = Float32
90+ floattype {T,f} (:: Type{FixedPoint{T,f}} ) = Float64
9691floattype (x:: FixedPoint ) = floattype (supertype (typeof (x)))
9792
9893
@@ -155,7 +150,7 @@ function show{T,f}(io::IO, x::FixedPoint{T,f})
155150 print (io, " )" )
156151end
157152const _log2_10 = 3.321928094887362
158- showcompact {T,f} (io:: IO , x:: FixedPoint{T,f} ) = show (io, round (float (x), ceil (Int,f/ _log2_10)))
153+ showcompact {T,f} (io:: IO , x:: FixedPoint{T,f} ) = show (io, round (Float64 (x), ceil (Int,f/ _log2_10)))
159154
160155@noinline function throw_converterror {T<:FixedPoint} (:: Type{T} , x)
161156 n = 2 ^ (8 * sizeof (T))
0 commit comments