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 | 2 |
3 #include <stdlib.h> | 3 #include <stdlib.h> |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "platform.h" | 7 #include "platform.h" |
8 #include "cctest.h" | 8 #include "cctest.h" |
9 #include "diy_fp.h" | 9 #include "diy-fp.h" |
10 | 10 |
11 | 11 |
12 using namespace v8::internal; | 12 using namespace v8::internal; |
13 | 13 |
14 | 14 |
15 TEST(Subtract) { | 15 TEST(Subtract) { |
16 DiyFp diy_fp1 = DiyFp(3, 0); | 16 DiyFp diy_fp1 = DiyFp(3, 0); |
17 DiyFp diy_fp2 = DiyFp(1, 0); | 17 DiyFp diy_fp2 = DiyFp(1, 0); |
18 DiyFp diff = DiyFp::Minus(diy_fp1, diy_fp2); | 18 DiyFp diff = DiyFp::Minus(diy_fp1, diy_fp2); |
19 | 19 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // Halfway cases are allowed to round either way. So don't check for it. | 58 // Halfway cases are allowed to round either way. So don't check for it. |
59 | 59 |
60 // Big numbers. | 60 // Big numbers. |
61 diy_fp1 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 11); | 61 diy_fp1 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 11); |
62 diy_fp2 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 13); | 62 diy_fp2 = DiyFp(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFF), 13); |
63 // 128bit result: 0xfffffffffffffffe0000000000000001 | 63 // 128bit result: 0xfffffffffffffffe0000000000000001 |
64 product = DiyFp::Times(diy_fp1, diy_fp2); | 64 product = DiyFp::Times(diy_fp1, diy_fp2); |
65 CHECK(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFe) == product.f()); | 65 CHECK(V8_2PART_UINT64_C(0xFFFFFFFF, FFFFFFFe) == product.f()); |
66 CHECK_EQ(11 + 13 + 64, product.e()); | 66 CHECK_EQ(11 + 13 + 64, product.e()); |
67 } | 67 } |
OLD | NEW |