• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2015 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
5function Module(stdlib) {
6  "use asm";
7  function TernaryMin(a, b) {
8    a=+(a);
9    b=+(b);
10    return (+((a < b) ? a : b));
11  }
12  function TernaryMax(a, b) {
13    a=+(a);
14    b=+(b);
15    return (+((b < a) ? a : b));
16  }
17  return { TernaryMin: TernaryMin,
18           TernaryMax: TernaryMax };
19}
20var min = Module(this).TernaryMin;
21var max = Module(this).TernaryMax;
22
23assertEquals(0.0, min(-0.0, 0.0));
24assertEquals(0.0, min(NaN, 0.0));
25assertEquals(-0.0, min(NaN, -0.0));
26assertEquals(-0.0, max(0.0, -0.0));
27assertEquals(0.0, max(NaN, 0.0));
28assertEquals(-0.0, max(NaN, -0.0));
29