Fix literal floats evaluating wrong values
This commit is contained in:
parent
e648013e1d
commit
e5cc27d43e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue