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

convert(::Type{BigFloat}, ...) uses the current rounding mode, shouldn't it instead always use RoundNearest? #55924

Open
nsajko opened this issue Sep 29, 2024 · 0 comments
Labels
bignums BigInt and BigFloat needs decision A decision on this change is needed

Comments

@nsajko
Copy link
Contributor

nsajko commented Sep 29, 2024

julia> setprecision(BigFloat, 4) do
           (
               setrounding(BigFloat, RoundDown) do
                   convert(BigFloat, 1/3)
               end,
               setrounding(BigFloat, RoundUp) do
                   convert(BigFloat, 1/3)
               end,
           )
       end
(0.312, 0.344)

julia> ==(ans...)
false

I think it'd make more sense for convert(::Type{BigFloat}, ::Any) not to depend on the current rounding mode. It could always use RoundNearest, no? Would that be a breaking change?

@nsajko nsajko added the bignums BigInt and BigFloat label Sep 29, 2024
@oscardssmith oscardssmith added the needs decision A decision on this change is needed label Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bignums BigInt and BigFloat needs decision A decision on this change is needed
Projects
None yet
Development

No branches or pull requests

2 participants