number.cpp
1 #include <symengine/add.h>
2 #include <symengine/pow.h>
3 #include <symengine/rational.h>
4 
5 namespace SymEngine
6 {
7 
8 RCP<const Basic> Number::conjugate() const
9 {
10  if (not is_complex()) {
11  return this->rcp_from_this();
12  }
13  throw NotImplementedError("Not Implemented.");
14 }
15 
16 RCP<const Number> Number::sub(const Number &other) const
17 {
18  return add(*other.mul(*integer(-1)));
19 }
20 
21 RCP<const Number> Number::rsub(const Number &other) const
22 {
23  return mul(*integer(-1))->add(other);
24 }
25 
26 RCP<const Number> Number::div(const Number &other) const
27 {
28  return mul(*other.pow(*integer(-1)));
29 }
30 
31 RCP<const Number> Number::rdiv(const Number &other) const
32 {
33  return other.mul(*pow(*integer(-1)));
34 }
35 
36 } // namespace SymEngine
Classes and functions relating to the binary operation of addition.
RCP< Basic > rcp_from_this()
Get RCP<T> pointer to self (it will cast the pointer to T)
virtual RCP< const Number > mul(const Number &other) const =0
Multiplication.
virtual bool is_complex() const =0
virtual RCP< const Number > add(const Number &other) const =0
Addition.
virtual RCP< const Number > pow(const Number &other) const =0
Power.
virtual RCP< const Basic > conjugate() const
Definition: number.cpp:8
virtual RCP< const Number > div(const Number &other) const
Division.
Definition: number.cpp:26
virtual RCP< const Number > sub(const Number &other) const
Subtraction.
Definition: number.cpp:16
Main namespace for SymEngine package.
Definition: add.cpp:19
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
Definition: integer.h:197