diff --git a/README.md b/README.md index d4c7bae4d..3305f79b8 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Currently, the `@compat` macro supports the following syntaxes: * `names(::DataType)` is now renamed to `fieldnames` [#10332](https://github.com/JuliaLang/julia/pull/10332) -* `parseint` and `parsefloat` are now `parse(T, ...)` [#10543](https://github.com/JuliaLang/julia/pull/10543) +* `parseint` and `parsefloat` are now `parse(T, ...)` [#10543](https://github.com/JuliaLang/julia/pull/10543); along the same line `BigFloat(s::String)` is now `parse(BigFloat,s)` [#10955](https://github.com/JuliaLang/julia/pull/10955). * `convert(::Ptr{T}, x)` is now `Base.unsafe_convert` [#9986](https://github.com/JuliaLang/julia/pull/9986). Compat provides an unexported `Compat.unsafe_convert` method that is aliased to `Base.convert` on Julia 0.3 and diff --git a/src/Compat.jl b/src/Compat.jl index 77fb0fb11..43e681149 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -212,6 +212,10 @@ if VERSION < v"0.4.0-dev+3874" Base.parse{T<:Union(Float32,Float64)}(::Type{T}, s::AbstractString) = parsefloat(T, s) end +if VERSION < v"0.4.0-dev+4539" + Base.parse(::Type{BigFloat}, s::AbstractString) = BigFloat(s) +end + if VERSION < v"0.4.0-dev+3710" const unsafe_convert = Base.convert else diff --git a/test/runtests.jl b/test/runtests.jl index ba9949a17..ac7bf73e6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -191,6 +191,7 @@ end @test parse(Int16, "1101", 2) == convert(Int16, 13) @test parse(Float64, "222") == 222.0 @test parse(Float32, "1.1") == convert(Float32, 1.1) +@test parse(BigFloat, "1.125") == convert(BigFloat, 1.125) # Make sure exports from Libc and Libdl are defined for x in [:strftime,:systemsleep,:getpid,:FILE,:malloc,:MS_SYNC,:munmap,:flush_cstdio,:realloc,:strptime,:Libc,:errno,:msync,:TmStruct,:calloc,:MS_INVALIDATE,:MS_ASYNC,:time,:strerror,:gethostname,:free,:mmap]