Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rounding failures #50

Open
garborg opened this issue Apr 20, 2020 · 0 comments
Open

rounding failures #50

garborg opened this issue Apr 20, 2020 · 0 comments

Comments

@garborg
Copy link

garborg commented Apr 20, 2020

round(Int, Decimal(3.5)) and round(Decimal(3.5), RoundNearest) are both failing at floatfuncs.jl:136.

It looks like most similar types have customer implementations of least the latter and usually the former.

Traces:

julia> round(Int, Decimal(3.5))
ERROR: MethodError: no method matching round(::Decimal, ::RoundingMode{:Nearest})
Closest candidates are:
  round(::Real, ::RoundingMode; digits, sigdigits, base) at floatfuncs.jl:129
  round(::Float64, ::RoundingMode{:Nearest}) at float.jl:376
  round(::Float32, ::RoundingMode{:Nearest}) at float.jl:377
  ...
Stacktrace:
 [1] #round#566 at ./floatfuncs.jl:134 [inlined]
 [2] round at ./floatfuncs.jl:129 [inlined]
 [3] round(::Type{Int64}, ::Decimal) at ./float.jl:367
 [4] top-level scope at REPL[19]:1
 [5] eval(::Module, ::Any) at ./boot.jl:331
 [6] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [7] run_backend(::REPL.REPLBackend) at /home/sean/.julia/packages/Revise/C272c/src/Revise.jl:1075
 [8] top-level scope at none:0
julia> round(Decimal(3.5), RoundNearest)
ERROR: MethodError: no method matching round(::Decimal, ::RoundingMode{:Nearest})
Closest candidates are:
  round(::Real, ::RoundingMode; digits, sigdigits, base) at floatfuncs.jl:129
  round(::Float64, ::RoundingMode{:Nearest}) at float.jl:376
  round(::Float32, ::RoundingMode{:Nearest}) at float.jl:377
  ...
Stacktrace:
 [1] #round#566 at ./floatfuncs.jl:134 [inlined]
 [2] round(::Decimal, ::RoundingMode{:Nearest}) at ./floatfuncs.jl:129
 [3] top-level scope at REPL[23]:1
 [4] eval(::Module, ::Any) at ./boot.jl:331
 [5] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [6] run_backend(::REPL.REPLBackend) at /home/sean/.julia/packages/Revise/C272c/src/Revise.jl:1075
 [7] top-level scope at none:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant