| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 uint64_t ordered = V8_2PART_UINT64_C(0x01234567, 89ABCDEF); | 43 uint64_t ordered = V8_2PART_UINT64_C(0x01234567, 89ABCDEF); |
| 44 CHECK_EQ(3512700564088504e-318, Double(ordered).value()); | 44 CHECK_EQ(3512700564088504e-318, Double(ordered).value()); |
| 45 | 45 |
| 46 uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001); | 46 uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001); |
| 47 CHECK_EQ(5e-324, Double(min_double64).value()); | 47 CHECK_EQ(5e-324, Double(min_double64).value()); |
| 48 | 48 |
| 49 uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); | 49 uint64_t max_double64 = V8_2PART_UINT64_C(0x7fefffff, ffffffff); |
| 50 CHECK_EQ(1.7976931348623157e308, Double(max_double64).value()); | 50 CHECK_EQ(1.7976931348623157e308, Double(max_double64).value()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 |
| 53 TEST(AsDiyFp) { | 54 TEST(AsDiyFp) { |
| 54 uint64_t ordered = V8_2PART_UINT64_C(0x01234567, 89ABCDEF); | 55 uint64_t ordered = V8_2PART_UINT64_C(0x01234567, 89ABCDEF); |
| 55 DiyFp diy_fp = Double(ordered).AsDiyFp(); | 56 DiyFp diy_fp = Double(ordered).AsDiyFp(); |
| 56 CHECK_EQ(0x12 - 0x3FF - 52, diy_fp.e()); | 57 CHECK_EQ(0x12 - 0x3FF - 52, diy_fp.e()); |
| 57 // The 52 mantissa bits, plus the implicit 1 in bit 52 as a UINT64. | 58 // The 52 mantissa bits, plus the implicit 1 in bit 52 as a UINT64. |
| 58 CHECK(V8_2PART_UINT64_C(0x00134567, 89ABCDEF) == diy_fp.f()); // NOLINT | 59 CHECK(V8_2PART_UINT64_C(0x00134567, 89ABCDEF) == diy_fp.f()); // NOLINT |
| 59 | 60 |
| 60 uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001); | 61 uint64_t min_double64 = V8_2PART_UINT64_C(0x00000000, 00000001); |
| 61 diy_fp = Double(min_double64).AsDiyFp(); | 62 diy_fp = Double(min_double64).AsDiyFp(); |
| 62 CHECK_EQ(-0x3FF - 52 + 1, diy_fp.e()); | 63 CHECK_EQ(-0x3FF - 52 + 1, diy_fp.e()); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 Double d0(-4e-324); | 222 Double d0(-4e-324); |
| 222 Double d1(d0.NextDouble()); | 223 Double d1(d0.NextDouble()); |
| 223 Double d2(d1.NextDouble()); | 224 Double d2(d1.NextDouble()); |
| 224 CHECK_EQ(-0.0, d1.value()); | 225 CHECK_EQ(-0.0, d1.value()); |
| 225 CHECK_EQ(0.0, d2.value()); | 226 CHECK_EQ(0.0, d2.value()); |
| 226 CHECK_EQ(4e-324, d2.NextDouble()); | 227 CHECK_EQ(4e-324, d2.NextDouble()); |
| 227 CHECK_EQ(-1.7976931348623157e308, Double(-V8_INFINITY).NextDouble()); | 228 CHECK_EQ(-1.7976931348623157e308, Double(-V8_INFINITY).NextDouble()); |
| 228 CHECK_EQ(V8_INFINITY, | 229 CHECK_EQ(V8_INFINITY, |
| 229 Double(V8_2PART_UINT64_C(0x7fefffff, ffffffff)).NextDouble()); | 230 Double(V8_2PART_UINT64_C(0x7fefffff, ffffffff)).NextDouble()); |
| 230 } | 231 } |
| OLD | NEW |