Skip to content

Commit

Permalink
fix #12386, deprecation warning serializing BigFloat
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jul 30, 2015
1 parent 8c56ad3 commit ced7165
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/serialize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ function deserialize{K,V}(s::SerializationState, T::Type{Dict{K,V}})
return t
end

deserialize(s::SerializationState, ::Type{BigFloat}) = BigFloat(deserialize(s))
deserialize(s::SerializationState, ::Type{BigFloat}) = parse(BigFloat, deserialize(s))

deserialize(s::SerializationState, ::Type{BigInt}) = get(GMP.tryparse_internal(BigInt, deserialize(s), 62, true))

Expand Down
8 changes: 8 additions & 0 deletions test/mpfr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -841,3 +841,11 @@ err(z, x) = abs(z - x) / abs(x)

# issue #10994: handle embedded NUL chars for string parsing
@test_throws ArgumentError parse(BigFloat, "1\0")

# serialization (issue #12386)
let b = IOBuffer()
x = 2.1*big(pi)
serialize(b, x)
seekstart(b)
@test deserialize(b) == x
end

0 comments on commit ced7165

Please sign in to comment.