Fixed #4087
This commit is contained in:
parent
2d64b69cf4
commit
24659dee92
|
@ -217,6 +217,9 @@ std::string MathLib::subtract(const std::string &first, const std::string &secon
|
||||||
return toString<bigint>(toLongNumber(first) - toLongNumber(second));
|
return toString<bigint>(toLongNumber(first) - toLongNumber(second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (first == second)
|
||||||
|
return "0.0" ;
|
||||||
|
|
||||||
double d1 = toDoubleNumber(first);
|
double d1 = toDoubleNumber(first);
|
||||||
double d2 = toDoubleNumber(second);
|
double d2 = toDoubleNumber(second);
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ private:
|
||||||
ASSERT_EQUALS("5" , MathLib::divide("25.5", "5.1"));
|
ASSERT_EQUALS("5" , MathLib::divide("25.5", "5.1"));
|
||||||
ASSERT_EQUALS("7" , MathLib::divide("21.", "3"));
|
ASSERT_EQUALS("7" , MathLib::divide("21.", "3"));
|
||||||
ASSERT_EQUALS("1" , MathLib::divide("3", "2"));
|
ASSERT_EQUALS("1" , MathLib::divide("3", "2"));
|
||||||
|
ASSERT_EQUALS("0.0" , MathLib::subtract("0.0", "0.0"));
|
||||||
|
|
||||||
// Unknown action should throw exception
|
// Unknown action should throw exception
|
||||||
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);
|
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);
|
||||||
|
|
Loading…
Reference in New Issue