@@ -210,6 +210,50 @@ def testAsin(self):
210210 self .assertRaises (ValueError , math .asin , BIG_INT )
211211 self .assertRaises (TypeError , math .asin , 'ahoj' )
212212
213+ def testSqrt (self ):
214+ self .assertRaises (TypeError , math .sqrt )
215+ self .ftest ('sqrt(0)' , math .sqrt (0 ), 0 )
216+ self .ftest ('sqrt(1)' , math .sqrt (1 ), 1 )
217+ self .ftest ('sqrt(4)' , math .sqrt (4 ), 2 )
218+ self .assertEqual (math .sqrt (INF ), INF )
219+ self .assertRaises (ValueError , math .sqrt , - 1 )
220+ self .assertRaises (ValueError , math .sqrt , NINF )
221+ self .assertTrue (math .isnan (math .sqrt (NAN )))
222+
223+ math .sqrt (MyFloat ())
224+ math .sqrt (BIG_INT )
225+ self .assertRaises (TypeError , math .asin , 'ahoj' )
226+
227+ def testLog (self ):
228+ self .assertRaises (TypeError , math .log )
229+ self .ftest ('log(1/e)' , math .log (1 / math .e ), - 1 )
230+ self .ftest ('log(1)' , math .log (1 ), 0 )
231+ self .ftest ('log(e)' , math .log (math .e ), 1 )
232+ self .ftest ('log(32,2)' , math .log (32 ,2 ), 5 )
233+ self .ftest ('log(10**40, 10)' , math .log (10 ** 40 , 10 ), 40 )
234+ self .ftest ('log(10**40, 10**20)' , math .log (10 ** 40 , 10 ** 20 ), 2 )
235+ #self.ftest('log(10**1000)', math.log(10**1000), 2302.5850929940457)
236+ self .assertRaises (ValueError , math .log , - 1.5 )
237+ self .assertRaises (ValueError , math .log , - 10 ** 1000 )
238+ self .assertRaises (ValueError , math .log , NINF )
239+ self .assertEqual (math .log (INF ), INF )
240+ self .assertTrue (math .isnan (math .log (NAN )))
241+
242+ math .log (MyFloat ())
243+ self .assertRaises (ZeroDivisionError , math .log , MyFloat (), True )
244+ self .ftest ('log(True, 1.1)' , math .log (True , 1.1 ), 0 )
245+ math .log (BIG_INT )
246+ math .log (BIG_INT , 4.6 )
247+ self .ftest ('log(BIG_INT, BIG_INT)' , math .log (BIG_INT , BIG_INT ), 1 )
248+ self .assertRaises (ZeroDivisionError , math .log , BIG_INT , True )
249+ self .assertRaises (TypeError , math .asin , 'ahoj' )
250+
251+ math .log (MyFloat (), 10 )
252+ math .log (MyFloat (), BIG_INT )
253+ math .log (MyFloat (), 7.4 )
254+ self .ftest ('log(MyFloat(), MyFloat())' , math .log (MyFloat (), MyFloat ()), 1 )
255+ math .log (10 , MyFloat ())
256+
213257 def testIsfinite (self ):
214258 self .assertTrue (math .isfinite (0.0 ))
215259 self .assertTrue (math .isfinite (- 0.0 ))
0 commit comments