Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to convert to float #32

Closed
tk3369 opened this issue Apr 27, 2019 · 2 comments
Closed

Unable to convert to float #32

tk3369 opened this issue Apr 27, 2019 · 2 comments

Comments

@tk3369
Copy link

tk3369 commented Apr 27, 2019

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
Copy link

xgdgsc commented Aug 14, 2019

I also get this error.

@hurak
Copy link
Contributor

hurak commented Oct 8, 2019

number() instead of float()

@hurak hurak closed this as completed Oct 8, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants