Unable to convert to float
tk3369 opened this issue · 2 comments
tk3369 commented
julia> x = Decimal(1.0)
Decimal(0, 1, 0)
julia> float(x)
ERROR: MethodError: no method matching tryparse(::Type{AbstractFloat}, ::String)
Closest candidates are:
tryparse(::Type{T<:Integer}, ::AbstractString; base) where T<:Integer at parse.jl:234
tryparse(::Type{Float64}, ::String) at parse.jl:245
tryparse(::Type{Float32}, ::String) at parse.jl:265
...
Stacktrace:
[1] #tryparse_internal#349(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{AbstractFloat}, ::String, ::Bool) at ./parse.jl:364
[2] tryparse_internal(::Type{AbstractFloat}, ::String, ::Bool) at ./parse.jl:364
[3] #parse#350(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Type{AbstractFloat}, ::String) at ./parse.jl:376
[4] parse(::Type{AbstractFloat}, ::String) at ./parse.jl:376
[5] AbstractFloat(::Decimal) at /Users/tomkwong/.julia/packages/Decimals/Qfcas/src/decimal.jl:67
[6] float(::Decimal) at ./float.jl:271
[7] top-level scope at none:0
julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin14.5.0)
CPU: Intel(R) Core(TM) i5-4258U CPU @ 2.40GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
Environment:
JULIA_NUM_THREADS = 4
xgdgsc commented
I also get this error.
hurak commented
number()
instead of float()