mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Added copysign(x, y) function to the math module
This commit is contained in:
		
							parent
							
								
									000a074c95
								
							
						
					
					
						commit
						eebb79cc69
					
				
					 4 changed files with 28 additions and 1 deletions
				
			
		|  | @ -229,6 +229,13 @@ def testTanh(self): | |||
|         self.ftest('tanh(0)', math.tanh(0), 0) | ||||
|         self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0) | ||||
| 
 | ||||
|     def testCopysign(self): | ||||
|         self.assertEqual(math.copysign(1, 42), 1.0) | ||||
|         self.assertEqual(math.copysign(0., 42), 0.0) | ||||
|         self.assertEqual(math.copysign(1., -42), -1.0) | ||||
|         self.assertEqual(math.copysign(3, 0.), 3.0) | ||||
|         self.assertEqual(math.copysign(4., -0.), -4.0) | ||||
| 
 | ||||
|     def testIsnan(self): | ||||
|         self.assert_(math.isnan(float("nan"))) | ||||
|         self.assert_(math.isnan(float("inf")* 0.)) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Christian Heimes
						Christian Heimes