This commit is contained in:
deepak gupta 2012-09-02 14:26:39 +02:00 committed by PKEuS
parent 2d64b69cf4
commit 24659dee92
2 changed files with 4 additions and 0 deletions

View File

@ -217,6 +217,9 @@ std::string MathLib::subtract(const std::string &first, const std::string &secon
return toString<bigint>(toLongNumber(first) - toLongNumber(second));
}
if (first == second)
return "0.0" ;
double d1 = toDoubleNumber(first);
double d2 = toDoubleNumber(second);

View File

@ -123,6 +123,7 @@ private:
ASSERT_EQUALS("5" , MathLib::divide("25.5", "5.1"));
ASSERT_EQUALS("7" , MathLib::divide("21.", "3"));
ASSERT_EQUALS("1" , MathLib::divide("3", "2"));
ASSERT_EQUALS("0.0" , MathLib::subtract("0.0", "0.0"));
// Unknown action should throw exception
ASSERT_THROW(MathLib::calculate("1","2",'j'),InternalError);