Fix literal floats evaluating wrong values

This commit is contained in:
Deukhoofd committed 2019-05-24 15:33:13 +02:00
1 parent e648013e1d
commit e5cc27d43e
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -76,7 +76,7 @@ double Evaluator::EvaluateFloatExpression(BoundExpression *expression) {
throw EvaluationException("Can't evaluate expression as integer, it will return an integer, not a float.");
}
switch (expression->GetKind()){
case BoundExpressionKind ::LiteralFloat: return ((BoundLiteralIntegerExpression*)expression)->GetValue();
case BoundExpressionKind ::LiteralFloat: return ((BoundLiteralFloatExpression*)expression)->GetValue();
case BoundExpressionKind ::Binary: return this -> EvaluateFloatBinary((BoundBinaryExpression*)expression);
case BoundExpressionKind ::LiteralInteger:
@@ -57,6 +57,6 @@ TEST_CASE( "Float Division", "[integration]" ) {
REQUIRE(!script.Diagnostics -> HasErrors());
script.Evaluate();
auto lastValue = script.GetLastValue();
REQUIRE(*any_cast<double>(lastValue) == Approx(10.730));
REQUIRE(*any_cast<double>(lastValue) == Approx(10.7305524239));
}
#endif