Fix round to round half-cases to even (#482)

This commit is contained in:
Angelos Katharopoulos
2024-01-17 15:27:23 -08:00
committed by GitHub
parent 135fd796d2
commit 90c234b7ac
4 changed files with 19 additions and 9 deletions

View File

@@ -957,7 +957,7 @@ TEST_CASE("test arithmetic unary ops") {
// Test round
{
array x({0.5, -0.5, 1.5, -1.5, 2.3, 2.6});
CHECK(array_equal(round(x), array({1, -1, 2, -2, 2, 3})).item<bool>());
CHECK(array_equal(round(x), array({0, -0, 2, -2, 2, 3})).item<bool>());
x = array({11, 222, 32});
CHECK(array_equal(round(x, -1), array({10, 220, 30})).item<bool>());