Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: tests/Sk4xTest.cpp

Issue 975303003: 4x library for NEON (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/core/Sk4x_neon.h ('K') | « src/core/Sk4x_neon.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Sk4xTest.cpp
diff --git a/tests/Sk4xTest.cpp b/tests/Sk4xTest.cpp
index 23eaf6853e6bc7ddab62b44f1be51bd1b01f5a51..7c49dd8137bfdcb909dd62e62e5680e534a6922d 100644
--- a/tests/Sk4xTest.cpp
+++ b/tests/Sk4xTest.cpp
@@ -75,8 +75,13 @@ DEF_TEST(Sk4x_Arith, r) {
ASSERT_EQ(Sk4f(-2,-2,-2,-2), Sk4f(1,2,3,4).subtract(Sk4f(3,4,5,6)));
ASSERT_EQ(Sk4f(3,8,15,24), Sk4f(1,2,3,4).multiply(Sk4f(3,4,5,6)));
+ // NEON implements division as multiplication by a reciprocal estimate.
+ // It may have some error.
float third = 1.0f/3.0f;
- ASSERT_EQ(Sk4f(1*third, 0.5f, 0.6f, 2*third), Sk4f(1,2,3,4).divide(Sk4f(3,4,5,6)));
+ Sk4f quotients = Sk4f(1*third, 0.5f, 0.6f, 2*third);
+ Sk4f error = quotients.subtract(Sk4f(1,2,3,4).divide(Sk4f(3,4,5,6)));
+ REPORTER_ASSERT(r, error.greaterThan(-0.001f).allTrue());
+ REPORTER_ASSERT(r, error.lessThan(0.001f).allTrue());
ASSERT_EQ(Sk4i(4,6,8,10), Sk4i(1,2,3,4).add(Sk4i(3,4,5,6)));
ASSERT_EQ(Sk4i(-2,-2,-2,-2), Sk4i(1,2,3,4).subtract(Sk4i(3,4,5,6)));
@@ -96,7 +101,7 @@ DEF_TEST(Sk4x_Sqrt, r) {
// .rsqrt() isn't so precise, but should be pretty close.
Sk4f error = roots.subtract(squares.multiply(squares.rsqrt()));
REPORTER_ASSERT(r, error.greaterThan(0.0f).allTrue());
- REPORTER_ASSERT(r, error.lessThan(0.01f).allTrue());
+ REPORTER_ASSERT(r, error.lessThan(0.011f).allTrue());
}
DEF_TEST(Sk4x_Comparison, r) {
« src/core/Sk4x_neon.h ('K') | « src/core/Sk4x_neon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698