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

Unified Diff: base/rand_util_unittest.cc

Issue 5801: Reduce RandDouble to one call to ldexp, add one bit of precision (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 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 | « base/rand_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util_unittest.cc
===================================================================
--- base/rand_util_unittest.cc (revision 2710)
+++ base/rand_util_unittest.cc (working copy)
@@ -20,3 +20,10 @@
EXPECT_EQ(base::RandInt(kIntMin, kIntMin), kIntMin);
EXPECT_EQ(base::RandInt(kIntMax, kIntMax), kIntMax);
}
+
+TEST(RandUtilTest, RandDouble) {
+ // Force 64-bit precision, making sure we're not in a 80-bit FPU register.
+ volatile double number = base::RandDouble();
+ EXPECT_GT(1.0, number);
+ EXPECT_LE(0.0, number);
+}
« no previous file with comments | « base/rand_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698