diff --git a/Project.toml b/Project.toml index b832ef33..91350754 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "SymPy" uuid = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6" -version = "1.0.29" +version = "1.0.30" [deps] diff --git a/src/numbers.jl b/src/numbers.jl index 5b3ce534..6db79c56 100644 --- a/src/numbers.jl +++ b/src/numbers.jl @@ -283,10 +283,14 @@ function N(x::Sym, digits::Int; kwargs...) if is_integer(x) return(convert(BigInt, x)) elseif is_rational(x) - return N(numer(x), digits;kwargs...) / N(denom(x), digits; kwargs...) + p = round(Int, log2(10)*digits) + ex = x.evalf(1+digits) + out = setprecision(p) do + convert(BigFloat, ex) + end + return(out) elseif is_real(x) == true p = round(Int, log2(10)*digits) - out = setprecision(p) do convert(BigFloat, ex) end