Skip to content

Commit

Permalink
change binomial registration
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacsas committed Dec 29, 2023
1 parent dc7c7a9 commit 5e3143c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/extra_functions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@register_symbolic Base.binomial(n, k::Integer)::Int true
@register_symbolic Base.binomial(n, k)::Int true [Integer, Real]

@register_symbolic Base.sign(x)::Int
derivative(::typeof(sign), args::NTuple{1,Any}, ::Val{1}) = 0
Expand Down
15 changes: 15 additions & 0 deletions test/overloads.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,18 @@ for f in [<, <=, >, >=, isless]
end

@test_nowarn binomial(t, 1)

# test for https://github.com/JuliaSymbolics/Symbolics.jl/issues/1028
let
@variables t A(t) B
@test try binomial(A, 2*B^2)
true
catch
false
end
@test try binomial(Symbolics.value(A), Symbolics.value(2*B^2))
true
catch
false
end
end

0 comments on commit 5e3143c

Please sign in to comment.