Skip to content

round (and trunc, floor, ceil) not defined from Float64 or Float32 to BigInt #13367

@carlobaldassi

Description

@carlobaldassi

I didn't see this reported elsewhere, so:

julia-0.4> round(BigInt, 2.5)
ERROR: MethodError: `trunc` has no method matching trunc(::Type{BigInt}, ::Float64)
Closest candidates are:
  trunc{T<:Integer}(::Type{T<:Integer}, ::Integer)
  trunc(::Type{Signed}, ::Float64)
  trunc(::Type{Unsigned}, ::Float64)
  ...
 in round at float.jl:177

There are definitions going from BigFloat to BigInt. Maybe we could use those, if implementing a direct route is unfeasible.

julia-0.4> round(BigInt, big"2.5")
2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions