Conversation
|
Ping @isuruf. |
symengine/type_codes.inc
Outdated
| @@ -1,3 +1,6 @@ | |||
| #ifdef NAN | |||
| #undef NAN | |||
| #endif | |||
There was a problem hiding this comment.
This could create problems for other software including this header. I'd prefer if the typecode was changed.
| RCP<const Basic> a; | ||
|
|
||
| a = Nan; | ||
| REQUIRE(a->__str__() == "nan"); |
symengine/codegen.h
Outdated
| void bvisit(const NaN &x) | ||
| { | ||
| std::ostringstream s; | ||
| s << "NOT_A_NUMBER"; |
| extern SYMENGINE_EXPORT RCP<const Infty> ComplexInf; | ||
|
|
||
| // Not a Number | ||
| extern SYMENGINE_EXPORT RCP<const NaN> Nan; |
There was a problem hiding this comment.
Can you change this to just nan?
There was a problem hiding this comment.
nan is a builtin as well. Sorry about that. Can you change this back to Nan?
| throw SymEngineException("Indeterminate Expression: `Infty +- " | ||
| "Infty` encountered. Directions don't " | ||
| "match"); | ||
| } else if (is_unsigned_infinity()) { |
There was a problem hiding this comment.
This condition is not added below
symengine/nan.cpp
Outdated
| //! NaN is mathematically not equal to anything else, even NaN itself. | ||
| bool NaN::__eq__(const Basic &o) const | ||
| { | ||
| return false; |
There was a problem hiding this comment.
Why this? SymPy gives true for nan == nan
There was a problem hiding this comment.
@isuruf This is from SymPy's documentation:
>>> Eq(nan, nan) # mathematical equality
False
>>> nan == nan # structural equality
True
There was a problem hiding this comment.
Then we should do the same as __eq__ is structural equality.
symengine/nan.cpp
Outdated
|
|
||
| int NaN::compare(const Basic &o) const | ||
| { | ||
| if (is_same_type(*this, o)) |
There was a problem hiding this comment.
See
symengine/symengine/infinity.cpp
Lines 68 to 73 in c1cd1ad
54a30aa to
4efe858
Compare
|
@isuruf Can you please review this? |
symengine/tests/basic/test_arit.cpp
Outdated
| REQUIRE(eq(*r1, *r2)); | ||
|
|
||
| r1 = div(zero, zero); | ||
| REQUIRE(r1->__str__() == "nan"); |
There was a problem hiding this comment.
Use eq(*r1, *Nan) here and below
isuruf
left a comment
There was a problem hiding this comment.
Looks good.
Can you resolve conflicts?
| n1 = b->div(*c); | ||
| REQUIRE(n1->__str__() == "nan"); | ||
| n1 = c->div(*c); | ||
| REQUIRE(n1->__str__() == "nan"); |
| inline bool is_complex() const | ||
| { | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Add is_exact() here and return false.
08677f7 to
5181bfe
Compare
|
Ping @isuruf. |
|
Ping @isuruf. |
|
Thanks |
@isuruf The builds seem too be failing even though
type_codes.inchas been updated. Please review and suggest improvements.