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

Side by Side Diff: test/mjsunit/asm/math-fround.js

Issue 594183004: Extend JSBuiltinReducer to cover Math.fround as well. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Benedikt. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/js-builtin-reducer-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --turbo-asm
6
7 function Module(stdlib) {
8 "use asm";
9
10 var fround = stdlib.Math.fround;
11
12 // f: double -> float
13 function f(a) {
14 a = +a;
15 return fround(a);
16 }
17
18 return { f: f };
19 }
20
21 var f = Module({ Math: Math }).f;
22
23 assertTrue(isNaN(f(NaN)));
24 assertTrue(isNaN(f(undefined)));
25 assertTrue(isNaN(f(function() {})));
26
27 assertEquals("Infinity", String(1/f(0)));
28 assertEquals("-Infinity", String(1/f(-0)));
29 assertEquals("Infinity", String(f(Infinity)));
30 assertEquals("-Infinity", String(f(-Infinity)));
31 assertEquals("Infinity", String(f(1E200)));
32 assertEquals("-Infinity", String(f(-1E200)));
33 assertEquals("Infinity", String(1/f(1E-300)));
34 assertEquals("-Infinity", String(1/f(-1E-300)));
35
36 assertEquals(0, f(0));
37 assertEquals(1, f(1));
38 assertEquals(1.5, f(1.5));
39 assertEquals(1.3370000123977661, f(1.337));
40 assertEquals(-4.300000190734863, f(-4.3));
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698