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

Unified Diff: Source/wtf/MathExtrasTest.cpp

Issue 184103006: Reinstate workarounds for atan2, fmod, pow in MathExtras on vs2013 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use numeric_limits Created 6 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
« no previous file with comments | « Source/wtf/MathExtras.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/MathExtrasTest.cpp
diff --git a/Source/wtf/MathExtrasTest.cpp b/Source/wtf/MathExtrasTest.cpp
index 27ec291ee47922ca943501517aced5c3a9daf772..d430fa067a7741005b2297756e1c838103f997eb 100644
--- a/Source/wtf/MathExtrasTest.cpp
+++ b/Source/wtf/MathExtrasTest.cpp
@@ -175,4 +175,29 @@ TEST(WTF, clampToUnsignedLongLong)
EXPECT_EQ(clampTo<unsigned>(-1), 0u);
}
+// Make sure that various +-inf cases are handled properly (they aren't
+// by default on VS).
+TEST(WTF, infinityMath)
+{
+ double posInf = std::numeric_limits<double>::infinity();
+ double negInf = -std::numeric_limits<double>::infinity();
+ double nan = std::numeric_limits<double>::quiet_NaN();
+
+ EXPECT_EQ(atan2(posInf, posInf), M_PI_4);
+ EXPECT_EQ(atan2(posInf, negInf), 3.0 * M_PI_4);
+ EXPECT_EQ(atan2(negInf, posInf), -M_PI_4);
+ EXPECT_EQ(atan2(negInf, negInf), -3.0 * M_PI_4);
+
+ EXPECT_EQ(fmod(0.0, posInf), 0.0);
+ EXPECT_EQ(fmod(7.0, posInf), 7.0);
+ EXPECT_EQ(fmod(-7.0, posInf), -7.0);
+ EXPECT_EQ(fmod(0.0, negInf), 0.0);
+ EXPECT_EQ(fmod(7.0, negInf), 7.0);
+ EXPECT_EQ(fmod(-7.0, negInf), -7.0);
+
+ EXPECT_EQ(pow(5.0, 0.0), 1.0);
+ EXPECT_EQ(pow(-5.0, 0.0), 1.0);
+ EXPECT_EQ(pow(nan, 0.0), 1.0);
+}
+
} // namespace
« no previous file with comments | « Source/wtf/MathExtras.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698