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 5 function 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 } 20 var min = Module(this).TernaryMin; 21 var max = Module(this).TernaryMax; 22 23 assertEquals(0.0, min(-0.0, 0.0)); 24 assertEquals(0.0, min(NaN, 0.0)); 25 assertEquals(-0.0, min(NaN, -0.0)); 26 assertEquals(-0.0, max(0.0, -0.0)); 27 assertEquals(0.0, max(NaN, 0.0)); 28 assertEquals(-0.0, max(NaN, -0.0)); 29