Skip to content

which rounding mode should convert use? #55924

Open
@nsajko

Description

@nsajko
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bignumsBigInt and BigFloatdesignDesign of APIs or of the language itselfneeds decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions