mirror of
				https://github.com/tc39/test262.git
				synced 2025-11-03 21:24:30 +01:00 
			
		
		
		
	sourceRevisionAtLastExport: 33f2fb0e53d135f0ee17cfccd9d993eb2a6f47de targetRevisionAtLastExport: 31340cbd9add103f586d501b0c3354b7b182abc0
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
// Copyright 2017 the V8 project authors. All rights reserved.
 | 
						|
// Use of this source code is governed by a BSD-style license that can be
 | 
						|
// found in the LICENSE file.
 | 
						|
 | 
						|
// Flags: --allow-natives-syntax
 | 
						|
 | 
						|
// Ensure that the typing rule for Math.ceil deals correctly with
 | 
						|
// inputs in the range (-1.0,0.0), which are mapped to -0.
 | 
						|
(function() {
 | 
						|
  function foo(x) {
 | 
						|
    // Arrange x such that TurboFan infers type PlainNumber \/ NaN.
 | 
						|
    x = +x;
 | 
						|
    x = Math.abs(x) - 1.0;
 | 
						|
    return Object.is(-0, Math.ceil(x));
 | 
						|
  }
 | 
						|
 | 
						|
  assertFalse(foo(1.5));
 | 
						|
  assertTrue(foo(0.5));
 | 
						|
  %OptimizeFunctionOnNextCall(foo);
 | 
						|
  assertFalse(foo(1.5));
 | 
						|
  assertTrue(foo(0.5));
 | 
						|
})();
 | 
						|
 | 
						|
// Ensure that the typing rule for Math.ceil deals correctly with
 | 
						|
// NaN inputs, which are mapped to NaN.
 | 
						|
(function() {
 | 
						|
  function foo(x) {
 | 
						|
    // Arrange x such that TurboFan infers type PlainNumber \/ NaN.
 | 
						|
    x = +x;
 | 
						|
    x = Math.abs(x) - 1.0;
 | 
						|
    return Object.is(NaN, Math.ceil(x));
 | 
						|
  }
 | 
						|
 | 
						|
  assertFalse(foo(1.5));
 | 
						|
  assertTrue(foo(NaN));
 | 
						|
  %OptimizeFunctionOnNextCall(foo);
 | 
						|
  assertFalse(foo(1.5));
 | 
						|
  assertTrue(foo(NaN));
 | 
						|
})();
 |