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

Make precision a keyword argument, improve handling of rounding mode. #29157

Merged
merged 12 commits into from Nov 19, 2018

move to deprecated.jl

  • Loading branch information...
simonbyrne committed Oct 31, 2018
commit ded6e2f00426a5f9b60ca72cc0e7a784003bd362
@@ -168,4 +168,9 @@ function promote_eltype_op end
one(::CartesianIndex{N}) where {N} = one(CartesianIndex{N})
one(::Type{CartesianIndex{N}}) where {N} = CartesianIndex(ntuple(x -> 1, Val(N)))

MPFR.BigFloat(x, prec::Int) = BigFloat(x; precision=prec)
MPFR.BigFloat(x, prec::Int, rounding::RoundingMode) = BigFloat(x, rounding; precision=prec)
MPFR.BigFloat(x::Real, prec::Int) = BigFloat(x; precision=prec)
MPFR.BigFloat(x::Real, prec::Int, rounding::RoundingMode) = BigFloat(x, rounding; precision=prec)

# END 1.0 deprecations
@@ -247,14 +247,6 @@ BigFloat(x::Real, r::RoundingMode; precision::Integer=DEFAULT_PRECISION[]) =
BigFloat(x::AbstractString, r::RoundingMode; precision::Integer=DEFAULT_PRECISION[]) =
BigFloat(x, convert(MPFRRoundingMode, r); precision=precision)

# TODO: deprecate in 2.0
BigFloat(x, prec::Int) = BigFloat(x; precision=prec)
BigFloat(x, prec::Int, rounding::RoundingMode) = BigFloat(x, rounding; precision=prec)
# avoid ambiguity

BigFloat(x::Real, prec::Int) = BigFloat(x; precision=prec)
BigFloat(x::Real, prec::Int, rounding::RoundingMode) = BigFloat(x, rounding; precision=prec)

## BigFloat -> Integer
"""
MPFR.unsafe_cast(T, x::BigFloat, r::RoundingMode)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.