OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Tests for Math.tan for |x| < pi/4 | 220 // Tests for Math.tan for |x| < pi/4 |
221 assertEquals(Infinity, 1/Math.tan(0.0)); | 221 assertEquals(Infinity, 1/Math.tan(0.0)); |
222 assertEquals(-Infinity, 1/Math.tan(-0.0)); | 222 assertEquals(-Infinity, 1/Math.tan(-0.0)); |
223 // tan(x) = x for |x| < 2^-28 | 223 // tan(x) = x for |x| < 2^-28 |
224 assertEquals(two_32, Math.tan(two_32)); | 224 assertEquals(two_32, Math.tan(two_32)); |
225 assertEquals(-two_32, Math.tan(-two_32)); | 225 assertEquals(-two_32, Math.tan(-two_32)); |
226 // Test KERNELTAN for |x| > 0.67434. | 226 // Test KERNELTAN for |x| > 0.67434. |
227 assertEquals(0.8211418015898941, Math.tan(11/16)); | 227 assertEquals(0.8211418015898941, Math.tan(11/16)); |
228 assertEquals(-0.8211418015898941, Math.tan(-11/16)); | 228 assertEquals(-0.8211418015898941, Math.tan(-11/16)); |
229 assertEquals(0.41421356237309503, Math.tan(Math.PI / 8)); | 229 assertEquals(0.41421356237309503, Math.tan(Math.PI / 8)); |
| 230 // crbug/427468 |
| 231 assertEquals(0.7993357819992383, Math.tan(0.6743358)); |
230 | 232 |
231 // Tests for Math.sin. | 233 // Tests for Math.sin. |
232 assertEquals(0.479425538604203, Math.sin(0.5)); | 234 assertEquals(0.479425538604203, Math.sin(0.5)); |
233 assertEquals(-0.479425538604203, Math.sin(-0.5)); | 235 assertEquals(-0.479425538604203, Math.sin(-0.5)); |
234 assertEquals(1, Math.sin(Math.PI/2)); | 236 assertEquals(1, Math.sin(Math.PI/2)); |
235 assertEquals(-1, Math.sin(-Math.PI/2)); | 237 assertEquals(-1, Math.sin(-Math.PI/2)); |
236 // Test that Math.sin(Math.PI) != 0 since Math.PI is not exact. | 238 // Test that Math.sin(Math.PI) != 0 since Math.PI is not exact. |
237 assertEquals(1.2246467991473532e-16, Math.sin(Math.PI)); | 239 assertEquals(1.2246467991473532e-16, Math.sin(Math.PI)); |
238 assertEquals(-7.047032979958965e-14, Math.sin(2200*Math.PI)); | 240 assertEquals(-7.047032979958965e-14, Math.sin(2200*Math.PI)); |
239 // Test Math.sin for various phases. | 241 // Test Math.sin for various phases. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 assertEquals(-6.420676210313675e-11, Math.tan(1048576/2*Math.PI)); | 273 assertEquals(-6.420676210313675e-11, Math.tan(1048576/2*Math.PI)); |
272 assertEquals(2.910566692924059e11, Math.tan(1048575/2*Math.PI)); | 274 assertEquals(2.910566692924059e11, Math.tan(1048575/2*Math.PI)); |
273 | 275 |
274 // Test Hayne-Panek reduction. | 276 // Test Hayne-Panek reduction. |
275 assertEquals(0.377820109360752e0, Math.sin(Math.pow(2, 120))); | 277 assertEquals(0.377820109360752e0, Math.sin(Math.pow(2, 120))); |
276 assertEquals(-0.9258790228548379e0, Math.cos(Math.pow(2, 120))); | 278 assertEquals(-0.9258790228548379e0, Math.cos(Math.pow(2, 120))); |
277 assertEquals(-0.40806638884180424e0, Math.tan(Math.pow(2, 120))); | 279 assertEquals(-0.40806638884180424e0, Math.tan(Math.pow(2, 120))); |
278 assertEquals(-0.377820109360752e0, Math.sin(-Math.pow(2, 120))); | 280 assertEquals(-0.377820109360752e0, Math.sin(-Math.pow(2, 120))); |
279 assertEquals(-0.9258790228548379e0, Math.cos(-Math.pow(2, 120))); | 281 assertEquals(-0.9258790228548379e0, Math.cos(-Math.pow(2, 120))); |
280 assertEquals(0.40806638884180424e0, Math.tan(-Math.pow(2, 120))); | 282 assertEquals(0.40806638884180424e0, Math.tan(-Math.pow(2, 120))); |
OLD | NEW |