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

Error in testset mpfr #41417

Closed
fredrikekre opened this issue Jun 30, 2021 · 5 comments · Fixed by #41473
Closed

Error in testset mpfr #41417

fredrikekre opened this issue Jun 30, 2021 · 5 comments · Fixed by #41473
Labels
ci Continuous integration system:windows Affects only Windows

Comments

@fredrikekre
Copy link
Member

From https://build.julialang.org/#/builders/65/builds/674/steps/5/logs/stdio

Error in testset mpfr:
Test Failed at C:\buildbot\worker-tabularasa\tester_win64\build\share\julia\test\mpfr.jl:609
  Expression: log2(x) == log2(42)
   Evaluated: 5.3923174227787607 == 5.39231742277876
@fredrikekre fredrikekre added system:windows Affects only Windows ci Continuous integration labels Jun 30, 2021
@fredrikekre
Copy link
Member Author

Happens on every win64 run.

@fredrikekre
Copy link
Member Author

#41383 (comment)

@aviatesk
Copy link
Sponsor Member

aviatesk commented Jul 1, 2021

Hmm I'm still not quite sure about the purpose of test (rather expected behaviors of BigFloat in general).

@kshyatt how these precisions are decided and why do we test these equalities under the specific precision ?

julia/test/mpfr.jl

Lines 603 to 616 in d09c8e0

@testset "log / log2 / log10" begin
setprecision(53) do
x = BigFloat(42)
@test log(x) == log(42)
@test isinf(log(BigFloat(0)))
@test_throws DomainError log(BigFloat(-1))
@test log2(x) == log2(42)
@test isinf(log2(BigFloat(0)))
@test_throws DomainError log2(BigFloat(-1))
@test log10(x) == log10(42)
@test isinf(log10(BigFloat(0)))
@test_throws DomainError log10(BigFloat(-1))
end
end

@thofma
Copy link
Contributor

thofma commented Jul 1, 2021

Because BigFloat with 53 bits precision should be the same as double:

In particular, with a precision of 53 bits and in any of the four standard rounding modes,
MPFR is able to exactly reproduce all computations with double-precision machine floatingpoint numbers

(See page 2 of https://www.mpfr.org/mpfr-current/mpfr.pdf)

@aviatesk
Copy link
Sponsor Member

aviatesk commented Jul 1, 2021

Thanks, I see.

With the help from Slack, I confirmed the error is caused by the change of log2(::Float64)'s behavior:

on Windows, before that PR:

julia> versioninfo()
Julia Version 1.8.0-DEV.94
Commit db71a65985 (2021-06-29 21:40 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: AMD Ryzen 9 3900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.0 (ORCJIT, znver2)

julia> log2(42)
  5.392317422778761

julia> setprecision(53) do; log2(BigFloat(42)); end
  5.3923174227787607

log2 internally uses @horner, which is certainly affected by the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration system:windows Affects only Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants