Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: test/mjsunit/es6/math-hyperbolic.js

Issue 1407213002: Implement Math.tanh using fdlibm port. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: delete the actual old implementation Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 assertEquals(512.00048828125, Math.cosh(-10*Math.LN2)); 179 assertEquals(512.00048828125, Math.cosh(-10*Math.LN2));
180 // Case 22 <= |x| < log(maxdouble) 180 // Case 22 <= |x| < log(maxdouble)
181 assertEquals(2.1474836479999983e9, Math.cosh(32*Math.LN2)); 181 assertEquals(2.1474836479999983e9, Math.cosh(32*Math.LN2));
182 assertEquals(2.1474836479999983e9, Math.cosh(-32*Math.LN2)); 182 assertEquals(2.1474836479999983e9, Math.cosh(-32*Math.LN2));
183 // Case log(maxdouble) <= |x| <= overflowthreshold 183 // Case log(maxdouble) <= |x| <= overflowthreshold
184 assertEquals(1.7976931348621744e308, Math.cosh(710.4758600739439)); 184 assertEquals(1.7976931348621744e308, Math.cosh(710.4758600739439));
185 assertEquals(1.7976931348621744e308, Math.cosh(-710.4758600739439)); 185 assertEquals(1.7976931348621744e308, Math.cosh(-710.4758600739439));
186 // Overflow. 186 // Overflow.
187 assertEquals(Infinity, Math.cosh(710.475860073944)); 187 assertEquals(Infinity, Math.cosh(710.475860073944));
188 assertEquals(Infinity, Math.cosh(-710.475860073944)); 188 assertEquals(Infinity, Math.cosh(-710.475860073944));
189
190 // Implementation-specific tests for tanh.
191 // Case |x| < 2^-55
192 var two_56 = Math.pow(2, -56);
193 assertEquals(two_56, Math.tanh(two_56));
194 assertEquals(-two_56, Math.tanh(-two_56));
195 // Case |x| < 1
196 assertEquals(0.6, Math.tanh(Math.LN2));
197 assertEquals(-0.6, Math.tanh(-Math.LN2));
198 // Case 1 < |x| < 22
199 assertEquals(15/17, Math.tanh(2 * Math.LN2));
200 assertEquals(-15/17, Math.tanh(-2 * Math.LN2));
201 // Case |x| > 22
202 assertEquals(1, Math.tanh(100));
203 assertEquals(-1, Math.tanh(-100));
204 // Test against overflow
205 assertEquals(1, Math.tanh(1e300));
206 assertEquals(-1, Math.tanh(-1e300));
OLDNEW
« src/third_party/fdlibm/fdlibm.js ('K') | « src/third_party/fdlibm/fdlibm.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698