@@ -348,26 +348,26 @@ trunc(::Type{Integer}, x::Float64) = trunc(Int,x)
348
348
trunc (:: Type{T} , x:: Float16 ) where {T<: Integer } = trunc (T, Float32 (x))
349
349
350
350
# fallbacks
351
- floor (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,_round (x, RoundDown))
351
+ floor (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,round (x, RoundDown))
352
352
floor (:: Type{T} , x:: Float16 ) where {T<: Integer } = floor (T, Float32 (x))
353
- ceil (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,_round (x, RoundUp))
353
+ ceil (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,round (x, RoundUp))
354
354
ceil (:: Type{T} , x:: Float16 ) where {T<: Integer } = ceil (T, Float32 (x))
355
- round (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,_round (x, RoundNearest))
355
+ round (:: Type{T} , x:: AbstractFloat ) where {T<: Integer } = trunc (T,round (x, RoundNearest))
356
356
round (:: Type{T} , x:: Float16 ) where {T<: Integer } = round (T, Float32 (x))
357
357
358
- _round (x:: Float64 , r:: RoundingMode{:ToZero} ) = trunc_llvm (x)
359
- _round (x:: Float32 , r:: RoundingMode{:ToZero} ) = trunc_llvm (x)
360
- _round (x:: Float64 , r:: RoundingMode{:Down} ) = floor_llvm (x)
361
- _round (x:: Float32 , r:: RoundingMode{:Down} ) = floor_llvm (x)
362
- _round (x:: Float64 , r:: RoundingMode{:Up} ) = ceil_llvm (x)
363
- _round (x:: Float32 , r:: RoundingMode{:Up} ) = ceil_llvm (x)
364
- _round (x:: Float64 , r:: RoundingMode{:Nearest} ) = rint_llvm (x)
365
- _round (x:: Float32 , r:: RoundingMode{:Nearest} ) = rint_llvm (x)
358
+ round (x:: Float64 , r:: RoundingMode{:ToZero} ) = trunc_llvm (x)
359
+ round (x:: Float32 , r:: RoundingMode{:ToZero} ) = trunc_llvm (x)
360
+ round (x:: Float64 , r:: RoundingMode{:Down} ) = floor_llvm (x)
361
+ round (x:: Float32 , r:: RoundingMode{:Down} ) = floor_llvm (x)
362
+ round (x:: Float64 , r:: RoundingMode{:Up} ) = ceil_llvm (x)
363
+ round (x:: Float32 , r:: RoundingMode{:Up} ) = ceil_llvm (x)
364
+ round (x:: Float64 , r:: RoundingMode{:Nearest} ) = rint_llvm (x)
365
+ round (x:: Float32 , r:: RoundingMode{:Nearest} ) = rint_llvm (x)
366
366
367
- _round (x:: Float16 , r:: RoundingMode{:ToZero} ) = Float16 (_round (Float32 (x), r))
368
- _round (x:: Float16 , r:: RoundingMode{:Down} ) = Float16 (_round (Float32 (x), r))
369
- _round (x:: Float16 , r:: RoundingMode{:Up} ) = Float16 (_round (Float32 (x), r))
370
- _round (x:: Float16 , r:: RoundingMode{:Nearest} ) = Float16 (_round (Float32 (x), r))
367
+ round (x:: Float16 , r:: RoundingMode{:ToZero} ) = Float16 (round (Float32 (x), r))
368
+ round (x:: Float16 , r:: RoundingMode{:Down} ) = Float16 (round (Float32 (x), r))
369
+ round (x:: Float16 , r:: RoundingMode{:Up} ) = Float16 (round (Float32 (x), r))
370
+ round (x:: Float16 , r:: RoundingMode{:Nearest} ) = Float16 (round (Float32 (x), r))
371
371
372
372
# # floating point promotions ##
373
373
promote_rule (:: Type{Float32} , :: Type{Float16} ) = Float32
@@ -660,7 +660,7 @@ for Ti in (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UIn
660
660
end
661
661
end
662
662
function (:: Type{$Ti} )(x:: $Tf )
663
- if ($ (Tf (typemin (Ti))) <= x <= $ (Tf (typemax (Ti)))) && (_round (x, RoundToZero) == x)
663
+ if ($ (Tf (typemin (Ti))) <= x <= $ (Tf (typemax (Ti)))) && (round (x, RoundToZero) == x)
664
664
return unsafe_trunc ($ Ti,x)
665
665
else
666
666
throw (InexactError ($ (Expr (:quote ,Ti. name. name)), $ Ti, x))
@@ -681,7 +681,7 @@ for Ti in (Int8, Int16, Int32, Int64, Int128, UInt8, UInt16, UInt32, UInt64, UIn
681
681
end
682
682
end
683
683
function (:: Type{$Ti} )(x:: $Tf )
684
- if ($ (Tf (typemin (Ti))) <= x < $ (Tf (typemax (Ti)))) && (_round (x, RoundToZero) == x)
684
+ if ($ (Tf (typemin (Ti))) <= x < $ (Tf (typemax (Ti)))) && (round (x, RoundToZero) == x)
685
685
return unsafe_trunc ($ Ti,x)
686
686
else
687
687
throw (InexactError ($ (Expr (:quote ,Ti. name. name)), $ Ti, x))
0 commit comments