symengine / SymEngine.jl

Julia wrappers of SymEngine
MIT License
192 stars 43 forks source link

Implement `//` #232

Closed ranocha closed 3 years ago

ranocha commented 3 years ago

It would be convenient if // would also be defined for SymEngine.Basic types. For example, I get the following error

julia> using SymEngine

julia> α = SymEngine.symbols("α")
α

julia> 1 // α
ERROR: MethodError: no method matching //(::Int64, ::Basic)
Closest candidates are:
  //(::Integer, ::Integer) at rational.jl:62
  //(::Integer, ::Rational) at rational.jl:68
  //(::Number, ::Complex) at rational.jl:79
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[3]:1

Reported by @ketch in a conversation.

isuruf commented 3 years ago

Should be easy to implement as //(a, b) = floor(a/b)

jverzani commented 3 years ago

Seems like SymEngine.IMPLEMENT_TWO_ARG_FUNC(://,:/) would also work for this.