-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
https://docs.julialang.org/en/v1/base/math/#Base.Rounding.RoundingMode gives a list of rounding modes including:
RoundNearestTiesAway
RoundNearestTiesUp
but it seems that rounding.jl doesn't implement these two.
julia> Float16( 1.23456789 , RoundNearestTiesUp )
ERROR: MethodError: no method matching _convert_rounding(::Type{Float16}, ::Float64, ::RoundingMode{
:NearestTiesUp})
julia> Float16( 1.23456789 , RoundNearestTiesAway )
ERROR: MethodError: no method matching _convert_rounding(::Type{Float16}, ::Float64, ::RoundingMode{
:NearestTiesAway})
I wanted to try these ones as I have noticed in my calculations that the sum of many positive Float16 numbers is always lower than the exact value, so suspecting that the rounding at ties could play a role.
Also, the documentation doesn't mention the method Float16 (unlike Float32 here https://docs.julialang.org/en/v1/base/numbers/#Core.Float32-Tuple{Any}).
julia> versioninfo()
Julia Version 1.0.1
Commit 0d713926f8 (2018-09-29 19:05 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, skylake)
Environment:
JULIA_NUM_THREADS = 2
JULIA_PKG_SERVER = https://pkg.juliacomputing.com/
JULIA_PKG_TOKEN_PATH = C:\Users\Peter\.julia\token.toml