Skip to content

floating point errors due to implicit float conversion #68

@mileslucas

Description

@mileslucas

CC #65

The following code currently fails because AstroPeriod is constructed implicitly using Float64

julia> typemax(Int64)*seconds
ERROR: InexactError: trunc(Int64, 9.223372036854776e18)
Stacktrace:
 [1] trunc
   @ ./float.jl:716 [inlined]
 [2] floor
   @ ./float.jl:294 [inlined]
 [3] AstroPeriod
   @ ~/dev/julia/AstroTime/src/Periods.jl:97 [inlined]
 [4] *(dt::Int64, unit::AstroTime.Periods.Second)
   @ AstroTime.Periods ~/dev/julia/AstroTime/src/Periods.jl:152
 [5] top-level scope
   @ REPL[27]:1

I'm sure there's probably a simple fix using oftype, I don't have time at the moment to dig into it though.

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