Skip to content

Commit

Permalink
Fix binary compatibility with previous versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hanna-kn committed Jun 29, 2024
1 parent 4c25f6f commit bf5d153
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion libqalculate/Function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@ bool MathFunction::representsNumber(const MathStructure &vargs, bool allow_units
bool MathFunction::representsRational(const MathStructure &vargs, bool allow_units) const {return representsInteger(vargs, allow_units);}
bool MathFunction::representsNonComplex(const MathStructure &vargs, bool allow_units) const {return representsReal(vargs, allow_units);}
bool MathFunction::representsReal(const MathStructure &vargs, bool allow_units) const {return representsRational(vargs, allow_units);}
bool MathFunction::representsFinite(const MathStructure &vargs, bool allow_units) const {return representsReal(vargs, allow_units);}
bool MathFunction::representsComplex(const MathStructure&, bool) const {return false;}
bool MathFunction::representsNonZero(const MathStructure &vargs, bool allow_units) const {return representsPositive(vargs, allow_units) || representsNegative(vargs, allow_units);}
bool MathFunction::representsEven(const MathStructure&, bool) const {return false;}
Expand Down
1 change: 0 additions & 1 deletion libqalculate/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ class MathFunction : public ExpressionItem {
virtual bool representsRational(const MathStructure&, bool = false) const;
virtual bool representsNonComplex(const MathStructure&, bool = false) const;
virtual bool representsReal(const MathStructure&, bool = false) const;
virtual bool representsFinite(const MathStructure&, bool = false) const;
virtual bool representsComplex(const MathStructure&, bool = false) const;
virtual bool representsNonZero(const MathStructure&, bool = false) const;
virtual bool representsEven(const MathStructure&, bool = false) const;
Expand Down
7 changes: 5 additions & 2 deletions libqalculate/MathStructure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1045,11 +1045,14 @@ bool MathStructure::representsReal(bool allow_units) const {
bool MathStructure::representsFinite(bool allow_units) const {
switch(m_type) {
case STRUCT_NUMBER: {return !o_number.includesInfinity();}
case STRUCT_VARIABLE: {return o_variable->representsFinite(allow_units);}
case STRUCT_VARIABLE: {
if(o_variable->isKnown()) return ((KnownVariable*) o_variable)->get().representsFinite(allow_units);
return o_variable->representsReal(allow_units);
}
case STRUCT_SYMBOLIC: {return CALCULATOR->defaultAssumptions()->isReal();}
case STRUCT_FUNCTION: {
if(o_function->id() == FUNCTION_ID_STRIP_UNITS && SIZE == 1) return CHILD(0).representsFinite(true);
return (function_value && function_value->representsFinite(allow_units)) || o_function->representsFinite(*this, allow_units);
return (function_value && function_value->representsFinite(allow_units)) || o_function->representsReal(*this, allow_units);
}
case STRUCT_UNIT: {return allow_units;}
case STRUCT_DATETIME: {return allow_units;}
Expand Down
1 change: 0 additions & 1 deletion libqalculate/Variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,6 @@ bool KnownVariable::representsFraction(bool allow_units) {return get().represent
bool KnownVariable::representsNumber(bool allow_units) {return get().representsNumber(allow_units);}
bool KnownVariable::representsRational(bool allow_units) {return get().representsRational(allow_units);}
bool KnownVariable::representsReal(bool allow_units) {return get().representsReal(allow_units);}
bool KnownVariable::representsFinite(bool allow_units) {return get().representsFinite(allow_units);}
bool KnownVariable::representsNonComplex(bool allow_units) {return get().representsNonComplex(allow_units);}
bool KnownVariable::representsComplex(bool allow_units) {return get().representsComplex(allow_units);}
bool KnownVariable::representsNonZero(bool allow_units) {return get().representsNonZero(allow_units);}
Expand Down
3 changes: 0 additions & 3 deletions libqalculate/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ class Variable : public ExpressionItem {
virtual bool representsNumber(bool = false) {return false;}
virtual bool representsRational(bool = false) {return false;}
virtual bool representsReal(bool = false) {return false;}
virtual bool representsFinite(bool b = false) {return representsReal(b);}
virtual bool representsNonComplex(bool b = false) {return representsReal(b);}
virtual bool representsComplex(bool = false) {return false;}
virtual bool representsNonZero(bool = false) {return false;}
Expand Down Expand Up @@ -337,7 +336,6 @@ class KnownVariable : public Variable {
virtual bool representsNumber(bool = false);
virtual bool representsRational(bool = false);
virtual bool representsReal(bool = false);
virtual bool representsFinite(bool = false);
virtual bool representsNonComplex(bool = false);
virtual bool representsComplex(bool = false);
virtual bool representsNonZero(bool = false);
Expand Down Expand Up @@ -392,7 +390,6 @@ class DynamicVariable : public KnownVariable {
virtual bool representsNumber(bool = false) {return true;}
virtual bool representsRational(bool = false) {return false;}
virtual bool representsReal(bool = false) {return true;}
virtual bool representsFinite(bool b = false) {return representsReal(b);}
virtual bool representsComplex(bool = false) {return false;}
virtual bool representsNonZero(bool = false) {return true;}
virtual bool representsEven(bool = false) {return false;}
Expand Down

0 comments on commit bf5d153

Please sign in to comment.