Skip to content

Commit

Permalink
adding proper throw_inexact exceptions for Integer conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
leios committed Oct 23, 2021
1 parent 507f1bc commit 2d3ce7e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ function generate_overdubs(mod, Ctx)
@inline Cassette.overdub(::$Ctx, ::typeof(Base.throw_boundserror), args...) = Base.throw_boundserror(args...)
@inline Cassette.overdub(::$Ctx, ::typeof(Base.Math.throw_exp_domainerror), args...) = Base.Math.throw_exp_domainerror(args...)

@inline Cassette.overdub(::$Ctx, ::typeof(Core.throw_inexacterror), args...) = throw(InexactError(args...))
@inline Cassette.overdub(::$Ctx, ::Core.Typeof(Base.InexactError), args...) = InexactError(args...)

function Cassette.overdub(::$Ctx, ::typeof(:), start::T, step::T, stop::T) where T<:Union{Float16,Float32,Float64}
lf = (stop-start)/step
if lf < 0
Expand Down

0 comments on commit 2d3ce7e

Please sign in to comment.