diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-30 14:26:33 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-30 14:26:33 +0000 |
commit | 94a0f313c3770201516f9a8a9c342c250d9fe915 (patch) | |
tree | 3419864fadbbf18c358c0ae104b1d45171b42422 /base/rand_util_unittest.cc | |
parent | 44fd14c5ade3ff22063382c63409ba18bcb5d50a (diff) | |
download | chromium_src-94a0f313c3770201516f9a8a9c342c250d9fe915.zip chromium_src-94a0f313c3770201516f9a8a9c342c250d9fe915.tar.gz chromium_src-94a0f313c3770201516f9a8a9c342c250d9fe915.tar.bz2 |
Reduce RandDouble to one call to ldexp, add one bit of precision
Review URL: http://codereview.chromium.org/5801
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/rand_util_unittest.cc')
-rw-r--r-- | base/rand_util_unittest.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/base/rand_util_unittest.cc b/base/rand_util_unittest.cc index 2710627..f56c0ec 100644 --- a/base/rand_util_unittest.cc +++ b/base/rand_util_unittest.cc @@ -20,3 +20,10 @@ TEST(RandUtilTest, SameMinAndMax) { 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); +} |