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

floating point errors due to implicit float conversion #68

Open
mileslucas opened this issue Oct 26, 2021 · 0 comments
Open

floating point errors due to implicit float conversion #68

mileslucas opened this issue Oct 26, 2021 · 0 comments

Comments

@mileslucas
Copy link
Member

mileslucas commented Oct 26, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant