Loading...
Searching...
No Matches
SymEngine::NaN Class Reference

#include <nan.h>

+ Inheritance diagram for SymEngine::NaN:
+ Collaboration diagram for SymEngine::NaN:

Public Member Functions

void accept (Visitor &v) const override
 
void accept (EvalRealDoubleVisitorFinal &v) const override
 
 NaN ()
 Constructs NaN.
 
hash_t __hash__ () const override
 
bool __eq__ (const Basic &o) const override
 
int compare (const Basic &o) const override
 
bool is_zero () const override
 
bool is_one () const override
 
bool is_minus_one () const override
 
bool is_positive () const override
 
bool is_negative () const override
 
bool is_complex () const override
 
RCP< const Basicconjugate () const override
 
bool is_exact () const override
 return true if the number is an exact representation
 
Evaluateget_eval () const override
 Get Evaluate singleton to evaluate numerically.
 
RCP< const Numberadd (const Number &other) const override
 Addition.
 
RCP< const Numbermul (const Number &other) const override
 Multiplication.
 
RCP< const Numberdiv (const Number &other) const override
 Division.
 
RCP< const Numberpow (const Number &other) const override
 Power.
 
RCP< const Numberrpow (const Number &other) const override
 
- Public Member Functions inherited from SymEngine::Number
virtual bool is_zero () const =0
 
virtual bool is_one () const =0
 
virtual bool is_minus_one () const =0
 
virtual bool is_negative () const =0
 
virtual bool is_positive () const =0
 
virtual bool is_complex () const =0
 
virtual RCP< const Basicconjugate () const
 
virtual bool is_exact () const
 return true if the number is an exact representation
 
bool is_exact_zero () const
 
virtual Evaluateget_eval () const
 Get Evaluate singleton to evaluate numerically.
 
virtual RCP< const Numberadd (const Number &other) const =0
 Addition.
 
virtual RCP< const Numbersub (const Number &other) const
 Subtraction.
 
virtual RCP< const Numberrsub (const Number &other) const
 
virtual RCP< const Numbermul (const Number &other) const =0
 Multiplication.
 
virtual RCP< const Numberdiv (const Number &other) const
 Division.
 
virtual RCP< const Numberrdiv (const Number &other) const
 
virtual RCP< const Numberpow (const Number &other) const =0
 Power.
 
virtual RCP< const Numberrpow (const Number &other) const =0
 
vec_basic get_args () const override
 Returns the list of arguments.
 
virtual bool is_perfect_power (bool is_expected=false) const
 
virtual bool nth_root (const Ptr< RCP< const Number > > &, unsigned long n) const
 
- Public Member Functions inherited from SymEngine::Basic
TypeID get_type_code () const
 
 Basic ()
 Constructor.
 
 Basic (const Basic &)=delete
 Delete the copy constructor and assignment.
 
Basicoperator= (const Basic &)=delete
 Assignment operator in continuation with above.
 
 Basic (Basic &&)=delete
 Delete the move constructor and assignment.
 
Basicoperator= (Basic &&)=delete
 Assignment operator in continuation with above.
 
virtual hash_t __hash__ () const =0
 
hash_t hash () const
 
virtual bool __eq__ (const Basic &o) const =0
 Test equality.
 
bool __neq__ (const Basic &o) const
 true if this is not equal to o.
 
int __cmp__ (const Basic &o) const
 Comparison operator.
 
virtual int compare (const Basic &o) const =0
 
std::string __str__ () const
 
std::string dumps () const
 Returns a string of the instance serialized.
 
RCP< const Basicsubs (const map_basic_basic &subs_dict) const
 Substitutes 'subs_dict' into 'self'.
 
RCP< const Basicxreplace (const map_basic_basic &subs_dict) const
 
virtual RCP< const Basicexpand_as_exp () const
 expands the special function in terms of exp function
 
virtual vec_basic get_args () const =0
 Returns the list of arguments.
 
virtual void accept (Visitor &v) const =0
 
virtual void accept (EvalRealDoubleVisitorFinal &v) const =0
 
RCP< const Basicdiff (const RCP< const Symbol > &x, bool cache=true) const
 
- Public Member Functions inherited from SymEngine::EnableRCPFromThis< Basic >
RCP< Basicrcp_from_this ()
 Get RCP<T> pointer to self (it will cast the pointer to T)
 
RCP< const Basicrcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T)
 
RCP< const T2 > rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2)
 
unsigned int use_count () const
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_NOT_A_NUMBER
 

Additional Inherited Members

- Static Public Member Functions inherited from SymEngine::Basic
static RCP< const Basicloads (const std::string &)
 Creates an instance of a serialized string.
 
- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Detailed Description

This serves as a place holder for numeric values that are indeterminate. Most operations on NaN, produce another NaN.

Definition at line 19 of file nan.h.

Constructor & Destructor Documentation

◆ NaN()

SymEngine::NaN::NaN ( )

Constructs NaN.

Definition at line 7 of file nan.cpp.

7{SYMENGINE_ASSIGN_TYPEID()}

Member Function Documentation

◆ __eq__()

bool SymEngine::NaN::__eq__ ( const Basic o) const
overridevirtual

Equality comparator

Parameters
o- Object to be compared with
Returns
whether the 2 objects are equal

Implements SymEngine::Basic.

Definition at line 15 of file nan.cpp.

16{
17 if (is_a<NaN>(o))
18 return true;
19 else
20 return false;
21}

◆ __hash__()

hash_t SymEngine::NaN::__hash__ ( ) const
overridevirtual
Returns
size of the hash

Implements SymEngine::Basic.

Definition at line 9 of file nan.cpp.

10{
11 hash_t seed = SYMENGINE_NOT_A_NUMBER;
12 return seed;
13}

◆ accept() [1/2]

void SymEngine::NaN::accept ( EvalRealDoubleVisitorFinal v) const
overridevirtual

Implements SymEngine::Basic.

◆ accept() [2/2]

void SymEngine::NaN::accept ( Visitor v) const
overridevirtual

Implements SymEngine::Basic.

◆ add()

RCP< const Number > SymEngine::NaN::add ( const Number other) const
overridevirtual

Addition.

Implements SymEngine::Number.

Definition at line 34 of file nan.cpp.

35{
36 return rcp_from_this_cast<Number>();
37}

◆ compare()

int SymEngine::NaN::compare ( const Basic o) const
overridevirtual

Returns -1, 0, 1 for this < o, this == o, this > o. This method is used when you want to sort things like x+y+z into canonical order. This function assumes that o is the same type as this. Use __cmp__ if you want general comparison.

Implements SymEngine::Basic.

Definition at line 23 of file nan.cpp.

24{
25 SYMENGINE_ASSERT(is_a<NaN>(o))
26 return 0;
27}

◆ conjugate()

RCP< const Basic > SymEngine::NaN::conjugate ( ) const
overridevirtual
Returns
the conjugate if the class is complex

Reimplemented from SymEngine::Number.

Definition at line 29 of file nan.cpp.

30{
31 return Nan;
32}

◆ div()

RCP< const Number > SymEngine::NaN::div ( const Number other) const
overridevirtual

Division.

Reimplemented from SymEngine::Number.

Definition at line 44 of file nan.cpp.

45{
46 return rcp_from_this_cast<Number>();
47}

◆ get_eval()

Evaluate & SymEngine::NaN::get_eval ( ) const
overridevirtual

Get Evaluate singleton to evaluate numerically.

Reimplemented from SymEngine::Number.

Definition at line 228 of file nan.cpp.

229{
230 static EvaluateNaN evaluate_NaN;
231 return evaluate_NaN;
232}

◆ is_complex()

bool SymEngine::NaN::is_complex ( ) const
inlineoverridevirtual
Returns
true if a complex number

Implements SymEngine::Number.

Definition at line 62 of file nan.h.

63 {
64 return false;
65 }

◆ is_exact()

bool SymEngine::NaN::is_exact ( ) const
inlineoverridevirtual

return true if the number is an exact representation

Reimplemented from SymEngine::Number.

Definition at line 68 of file nan.h.

69 {
70 return false;
71 }

◆ is_minus_one()

bool SymEngine::NaN::is_minus_one ( ) const
inlineoverridevirtual
Returns
true if -1

Implements SymEngine::Number.

Definition at line 47 of file nan.h.

48 {
49 return false;
50 }

◆ is_negative()

bool SymEngine::NaN::is_negative ( ) const
inlineoverridevirtual
Returns
true if negative

Implements SymEngine::Number.

Definition at line 57 of file nan.h.

58 {
59 return false;
60 }

◆ is_one()

bool SymEngine::NaN::is_one ( ) const
inlineoverridevirtual
Returns
true if 1

Implements SymEngine::Number.

Definition at line 42 of file nan.h.

43 {
44 return false;
45 }

◆ is_positive()

bool SymEngine::NaN::is_positive ( ) const
inlineoverridevirtual
Returns
true if positive

Implements SymEngine::Number.

Definition at line 52 of file nan.h.

53 {
54 return false;
55 }

◆ is_zero()

bool SymEngine::NaN::is_zero ( ) const
inlineoverridevirtual
Returns
true if 0

Implements SymEngine::Number.

Definition at line 37 of file nan.h.

38 {
39 return false;
40 }

◆ mul()

RCP< const Number > SymEngine::NaN::mul ( const Number other) const
overridevirtual

Multiplication.

Implements SymEngine::Number.

Definition at line 39 of file nan.cpp.

40{
41 return rcp_from_this_cast<Number>();
42}

◆ pow()

RCP< const Number > SymEngine::NaN::pow ( const Number other) const
overridevirtual

Power.

Implements SymEngine::Number.

Definition at line 49 of file nan.cpp.

50{
51 return rcp_from_this_cast<Number>();
52}

◆ rpow()

RCP< const Number > SymEngine::NaN::rpow ( const Number other) const
overridevirtual

Implements SymEngine::Number.

Definition at line 54 of file nan.cpp.

55{
56 return rcp_from_this_cast<Number>();
57}

Field Documentation

◆ type_code_id

const TypeID SymEngine::NaN::type_code_id = SYMENGINE_NOT_A_NUMBER
static

Type_code_id shared by all instances

Definition at line 22 of file nan.h.


The documentation for this class was generated from the following files: