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

Inconsistent error thrown for overflowing division depending on type #112

Open
mbarbar opened this issue Feb 11, 2025 · 0 comments
Open

Comments

@mbarbar
Copy link
Contributor

mbarbar commented Feb 11, 2025

julia> typemin(FixedDecimal{Int32,4}) / -1
ERROR: OverflowError: -214748.3648 / -1 overflowed for type FixedDecimal{Int32, 4}
Stacktrace:
 [1] throw_overflowerr_binaryop(op::Symbol, x::FixedDecimal{Int32, 4}, y::Int64)
   @ Base.Checked ./checked.jl:163
 [2] checked_rdiv(x::FixedDecimal{Int32, 4}, y::Int64)
   @ FixedPointDecimals ~/.julia/packages/FixedPointDecimals/R0sp2/src/FixedPointDecimals.jl:570
 [3] /(x::FixedDecimal{Int32, 4}, y::Int64)
   @ FixedPointDecimals ~/.julia/packages/FixedPointDecimals/R0sp2/src/FixedPointDecimals.jl:229
 [4] top-level scope
   @ REPL[118]:1

julia> typemin(FixedDecimal{Int64,5}) / -1
ERROR: DivideError: integer division error
Stacktrace:
 [1] div
   @ ./int.jl:295 [inlined]
 [2] div
   @ ./div.jl:308 [inlined]
 [3] div
   @ ./div.jl:353 [inlined]
 [4] fld
   @ ./div.jl:319 [inlined]
 [5] divrem
   @ ./div.jl:205 [inlined]
 [6] fldmod
   @ ./div.jl:274 [inlined]
 [7] checked_rdiv(x::FixedDecimal{Int64, 5}, y::Int64)
   @ FixedPointDecimals ~/.julia/packages/FixedPointDecimals/R0sp2/src/FixedPointDecimals.jl:568
 [8] /(x::FixedDecimal{Int64, 5}, y::Int64)
   @ FixedPointDecimals ~/.julia/packages/FixedPointDecimals/R0sp2/src/FixedPointDecimals.jl:229
 [9] top-level scope
   @ REPL[120]:1

Whichever is chosen, they should be the same.

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