]> www.ginac.de Git - ginac.git/blobdiff - ginac/relational.cpp
- added fderivative class to archive exam
[ginac.git] / ginac / relational.cpp
index f657f8100d96ef67a5d1200bc3c4cdb04baf85db..c4e34ddfd34ca44958e37632d6e041969f08680b 100644 (file)
@@ -92,7 +92,7 @@ void relational::archive(archive_node &n) const
 DEFAULT_UNARCHIVE(relational)
 
 //////////
-// functions overriding virtual functions from bases classes
+// functions overriding virtual functions from base classes
 //////////
 
 // public
@@ -193,21 +193,24 @@ ex relational::simplify_ncmul(const exvector & v) const
 int relational::compare_same_type(const basic & other) const
 {
        GINAC_ASSERT(is_exactly_of_type(other, relational));
-       const relational & oth=static_cast<const relational &>(const_cast<basic &>(other));
-       
-       int cmpval;
+       const relational &oth = static_cast<const relational &>(other);
        
        if (o == oth.o) {
-               cmpval = lh.compare(oth.lh);
-               if (cmpval==0)
-                       return rh.compare(oth.rh);
-               else
+               int cmpval = lh.compare(oth.lh);
+               if (cmpval)
                        return cmpval;
+               else
+                       return rh.compare(oth.rh);
        }
-       if (o<oth.o)
-               return -1;
-       else
-               return 1;
+       return (o < oth.o) ? -1 : 1;
+}
+
+bool relational::match_same_type(const basic & other) const
+{
+       GINAC_ASSERT(is_exactly_of_type(other, relational));
+       const relational &oth = static_cast<const relational &>(other);
+
+       return o == oth.o;
 }
 
 unsigned relational::return_type(void) const