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

Overflow errors in 32-bit operating system #9

Open
jdeldre opened this issue Apr 11, 2021 · 0 comments
Open

Overflow errors in 32-bit operating system #9

jdeldre opened this issue Apr 11, 2021 · 0 comments

Comments

@jdeldre
Copy link

jdeldre commented Apr 11, 2021

This issue came up for a small number of the students in my class. I admit it took me awhile to figure out what their error was, because I couldn't recreate it on my own computer. I don't actually know how many (or which) of the unit definitions in UnitfulUS lead to this error, but here is an example of what happens when one defines a US gallon:

julia> @unit gal "gal" USGallon 231Unitful.inch^3 false

ERROR: LoadError: LoadError: OverflowError: 5000 * 25000000 overflowed for type Int32
Stacktrace:
[1] throw_overflowerr_binaryop(op::Symbol, x::Int32, y::Int32)
@ Base.Checked .\checked.jl:154
[2] checked_mul
@ .\checked.jl:288 [inlined]
[3] *(x::Rational{Int32}, y::Rational{Int32})
@ Base .\rational.jl:311
[4] power_by_squaring(x_::Rational{Int32}, p::Int32)
@ Base .\intfuncs.jl:279
[5] ^
@ .\rational.jl:453 [inlined]
[6] dpow
@ ~.julia\packages\Unitful\PcVKX\src\units.jl:205 [inlined]
[7] basefactor(inex::Float64, ex::Rational{Int32}, eq::Int32, tens::Int32, p::Rational{Int32})
@ Unitful ~.julia\packages\Unitful\PcVKX\src\units.jl:234
[8] basefactor
@ ~.julia\packages\Unitful\PcVKX\src\units.jl:258 [inlined]
[9] map
@ .\tuple.jl:213 [inlined]
[10] basefactor(x::Unitful.FreeUnits{(inch^3,), 𝐋^3, nothing} )
@ Unitful ~.julia\packages\Unitful\PcVKX\src\units.jl:261
[11] top-level scope
@ ~.julia\packages\Unitful\PcVKX\src\user.jl:220
[12] include(mod::Module, _path::String)
@ Base .\Base.jl:386
[13] include(x::String)

I'm sure this error is exceedingly rare: it is still unclear why students in my class are using 32-bit versions of Julia. Might be old architectures, but might also be their mistake.

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