mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	 0cd85ab0fc
			
		
	
	
		0cd85ab0fc
		
	
	
	
	
		
			
			ECMA-262 implies that `MIN_VALUE` should be a denormalized value if denormal arithmetic is supported. This is the case on x86-64 and AArch64 using standard GCC/Clang compilation settings. test262 checks whether `Number.MIN_VALUE / 2.0` is equal to 0, which only holds if `MIN_VALUE` is the smallest denormalized value. This commit renames the existing `NumericLimits<FloatingPoint>::min()` to `min_normal()` and adds a `min_denormal()` method to force users to explicitly think about which one is appropriate for their use case. We shouldn't follow the STL's confusingly designed interface in this regard.
		
			
				
	
	
		
			13 lines
		
	
	
	
		
			627 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
	
		
			627 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("basic functionality", () => {
 | |
|     expect(Number.EPSILON).toBe(2 ** -52);
 | |
|     expect(Number.EPSILON).toBeGreaterThan(0);
 | |
|     expect(Number.MAX_SAFE_INTEGER).toBe(2 ** 53 - 1);
 | |
|     expect(Number.MAX_SAFE_INTEGER + 1).toBe(Number.MAX_SAFE_INTEGER + 2);
 | |
|     expect(Number.MIN_SAFE_INTEGER).toBe(-(2 ** 53 - 1));
 | |
|     expect(Number.MIN_SAFE_INTEGER - 1).toBe(Number.MIN_SAFE_INTEGER - 2);
 | |
|     expect(Number.POSITIVE_INFINITY).toBe(Infinity);
 | |
|     expect(Number.NEGATIVE_INFINITY).toBe(-Infinity);
 | |
|     expect(Number.NaN).toBeNaN();
 | |
|     expect(Number.MIN_VALUE).toBeGreaterThan(0);
 | |
|     expect(Number.MIN_VALUE / 2.0).toBe(0);
 | |
| });
 |