| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 | 28 |
| 29 // Two fp numbers that have the same hash value (see TranscendentalCache | 29 // Two fp numbers that have the same hash value (see TranscendentalCache |
| 30 // in heap.h). | 30 // in heap.h). |
| 31 var x = 0x123456789ABCD; | 31 var x = 0x123456789ABCD / 0x2000000000000; |
| 32 var y = 0x1134567899BCD; | 32 var y = 0x1134567899BCD / 0x2000000000000; |
| 33 | 33 |
| 34 assertEquals(-0.5582508193778007, Math.sin(x)); | 34 assertEquals(0.5386962702923196, Math.sin(x)); |
| 35 assertEquals(-0.7367701055966746, Math.sin(y)); | 35 assertEquals(0.5121094149171027, Math.sin(y)); |
| 36 | 36 |
| 37 assertEquals(-0.8296722380940645, Math.cos(x)); | 37 assertEquals(0.8425000465122504, Math.cos(x)); |
| 38 assertEquals(-0.6761433365042245, Math.cos(y)); | 38 assertEquals(0.8589202216464942, Math.cos(y)); |
| 39 | 39 |
| 40 assertEquals(0.6728570557696649, Math.tan(x)); | 40 assertEquals(0.6394020659374369, Math.tan(x)); |
| 41 assertEquals(1.0896655573149632, Math.tan(y)); | 41 assertEquals(0.5962246574372441, Math.tan(y)); |
| 42 | 42 |
| 43 assertEquals(33.400141709152514, Math.log(x)); | 43 assertEquals(-0.5640701382848059, Math.log(x)); |
| 44 assertEquals(33.343643692997280, Math.log(y)); | 44 assertEquals(-0.6205681544400349, Math.log(y)); |
| 45 | |
| 46 // These also have the same hash value but they are < 1 so they can be | |
| 47 // used for the asin and other functions. | |
| 48 x = 0x123456789ABCD / 0x2000000000000; | |
| 49 y = 0x1134567899BCD / 0x2000000000000; | |
| 50 | 45 |
| 51 assertEquals(0.6051541873165459, Math.asin(x)); | 46 assertEquals(0.6051541873165459, Math.asin(x)); |
| 52 assertEquals(0.5676343396849298, Math.asin(y)); | 47 assertEquals(0.5676343396849298, Math.asin(y)); |
| 53 | 48 |
| 54 assertEquals(0.9656421394783508, Math.acos(x)); | 49 assertEquals(0.9656421394783508, Math.acos(x)); |
| 55 assertEquals(1.0031619871099668, Math.acos(y)); | 50 assertEquals(1.0031619871099668, Math.acos(y)); |
| 56 | 51 |
| 57 assertEquals(0.5172294898564562, Math.atan(x)); | 52 assertEquals(0.5172294898564562, Math.atan(x)); |
| 58 assertEquals(0.4933034078249788, Math.atan(y)); | 53 assertEquals(0.4933034078249788, Math.atan(y)); |
| 59 | 54 |
| 60 assertEquals(1.7663034013841883, Math.exp(x)); | 55 assertEquals(1.7663034013841883, Math.exp(x)); |
| 61 assertEquals(1.7119599587777090, Math.exp(y)); | 56 assertEquals(1.7119599587777090, Math.exp(y)); |
| 62 | |
| 63 print("OK"); | |
| OLD | NEW |