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

Converting large powers of units results in Inf #33

Closed
Socob opened this issue May 4, 2023 · 1 comment
Closed

Converting large powers of units results in Inf #33

Socob opened this issue May 4, 2023 · 1 comment

Comments

@Socob
Copy link

Socob commented May 4, 2023

julia> using Unitful

julia> using UnitfulAstro

julia> uconvert(u"Gpc"^15, 1.0 * u"Gpc"^18 * u"Mpc"^-3)
1.0000000000000002e9 Gpc^15

julia> uconvert(u"Gpc"^16, 1.0 * u"Gpc"^19 * u"Mpc"^-3)
Inf Gpc^16

Probably has to do with some internal conversion to SI units. Standard Unitful.js units seem to avoid this, so there should be a way to do the same and fix it:

julia> uconvert(u"Ym"^100, 1.0 * u"Ym"^101 * u"Zm"^-1)
1000.0 Ym^100

Nevermind, looks like this is a general issue in Unitful.js: PainterQubits/Unitful.jl#647. Not sure if anything can be done on the UnitfulAstro end?
@Socob
Copy link
Author

Socob commented Aug 12, 2023

Fixed upstream in PainterQubits/Unitful.jl#648.

@Socob Socob closed this as completed Aug 12, 2023
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