mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	 b79f03182d
			
		
	
	
		b79f03182d
		
	
	
	
	
		
			
			Although this already works in most cases in non-kvm serenity cases the cosh and other math function tend to return incorrect values for Infinity. This makes sure that whatever the underlying cosh function returns Math.cosh conforms to the spec.
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			561 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			561 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| describe("basic functionality", () => {
 | |
|     test("length", () => {
 | |
|         expect(Math.cosh).toHaveLength(1);
 | |
|     });
 | |
| 
 | |
|     test("simple values", () => {
 | |
|         expect(Math.cosh(1)).toBeCloseTo(1.5430806348152437);
 | |
|         expect(Math.cosh(-1)).toBeCloseTo(1.5430806348152437);
 | |
|     });
 | |
| 
 | |
|     test("special values", () => {
 | |
|         expect(Math.cosh(0)).toBe(1);
 | |
|         expect(Math.cosh(-0.0)).toBe(1);
 | |
| 
 | |
|         expect(Math.cosh(NaN)).toBeNaN();
 | |
|         expect(Math.cosh(Infinity)).toBe(Infinity);
 | |
|         expect(Math.cosh(-Infinity)).toBe(Infinity);
 | |
|     });
 | |
| });
 |