Repository navigation
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #786 +/- ##
===========================================
+ Coverage 75.56% 94.16% +18.60%
===========================================
Files 32 33 +1
Lines 3131 3241 +110
===========================================
+ Hits 2366 3052 +686
+ Misses 765 189 -576 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Benchmark Results (Julia v1)Time benchmarks
Memory benchmarks
|
|
Erratum: it seemed fun until I hit a bug on 32 bits machine only x_x Edit: it was nothing serious. |
|
Your strategy is to use Rational{BigInt} ?Does this then rely on |
|
No, there is no call to It only relies on converting rationals to floats. |
|
right; so there are some issues with this for edge cases I think. But anyways we were probably relying on this before? I am preparing an issue to keep track of these |
|
If we cannot trust the conversion itself, I can reimplement it as blo = /(BigFloat(lo.num), BigFloat(lo.den), RoundDown)
bhi = /(BigFloat(hi.num), BigFloat(hi.den), RoundUp)
return interval(Float64(blo, RoundDown), Float64(bhi, RoundUp))where |
|
Sorry for the delay @Kolaru. I do not know if you looked at the message I linked, but the bottom line is that Base's directed conversions from Also we messed up a fix in Julia... Base's So I suggest doing the following before merging this PR (if function _bigfloat(x::Rational, r::RoundingMode; precision::Integer = Base.precision(BigFloat))
num, den = numerator(x), denominator(x)
n = BigFloat(num; precision = ndigits(num; base = 2))
d = BigFloat(den; precision = ndigits(den; base = 2))
z = BigFloat(; precision)
ccall((:mpfr_div, Base.MPFR.libmpfr), Int32,
(Ref{BigFloat}, Ref{BigFloat}, Ref{BigFloat}, Base.MPFR.MPFRRoundingMode), z, n, d, r)
return z
end
_round_rational(::Type{BigFloat}, q::Rational, r::RoundingMode) = _bigfloat(q, r)
_round_rational(::Type{T}, q::Rational, r::RoundingMode) where {T<:AbstractFloat} =
T(_bigfloat(q, r; precision = precision(T)), r) |
Fix #785
(I know, I should be reviewing PRs instead, but this one sounded fun 🙈 )