11from math import (factorial , isqrt , perm , comb , degrees , radians , exp , pow ,
22 ldexp , fabs , gcd , lcm , floor , ceil , remainder , expm1 , fmod , log1p , trunc ,
3- modf , fsum , prod , dist , frexp , isclose )
3+ fsum , prod , dist , )
44import math
55from lpython import i8 , i16 , i32 , i64 , f32 , f64
66
@@ -227,19 +227,19 @@ def test_dist():
227227 y = [6.1 , 7.2 , 8.0 , 9.0 , 10.0 ]
228228 assert abs (dist (x , y ) - 11.081105044173166 ) < eps
229229
230- def test_modf ():
231- i : f64
232- i = 3.14
233-
234- res : tuple [f64 , f64 ]
235- res = modf (i )
236- assert abs (res [0 ] - 0.14 ) <= 1e-6
237- assert abs (res [1 ] - 3.0 ) <= 1e-6
238-
239- i = - 442.3
240- res = modf (i )
241- assert abs (res [0 ] + 0.3 ) <= 1e-6
242- assert abs (res [1 ] + 442.0 ) <= 1e-6
230+ # def test_modf():
231+ # i: f64
232+ # i = 3.14
233+ #
234+ # res: tuple[f64, f64]
235+ # res = modf(i)
236+ # assert abs(res[0] - 0.14) <= 1e-6
237+ # assert abs(res[1] - 3.0) <= 1e-6
238+ #
239+ # i = -442.3
240+ # res = modf(i)
241+ # assert abs(res[0] + 0.3) <= 1e-6
242+ # assert abs(res[1] + 442.0) <= 1e-6
243243
244244
245245def test_issue_1242 ():
@@ -253,56 +253,56 @@ def test_issue_1242():
253253 assert abs (math .pi - 3.14159265358979323846 ) < 1e-10
254254
255255
256- def test_frexp ():
257- x :f64 = 6.23
258- mantissa :f64
259- exponent :i16
260- mantissa , exponent = frexp (x )
261- assert abs (mantissa - 0.77875 ) < eps and exponent == i16 (3 )
262-
263- x = 0.8
264- mantissa , exponent = frexp (x )
265- assert abs (mantissa - 0.8 ) < eps and exponent == i16 (0 )
266-
267- x = 19.74
268- mantissa , exponent = frexp (x )
269- assert abs (mantissa - 0.616875 ) < eps and exponent == i16 (5 )
270-
271- x = - 23.6
272- mantissa , exponent = frexp (x )
273- assert abs (mantissa + 0.7375 ) < eps and exponent == i16 (5 )
274-
275- y :f32 = f32 (1.23 )
276- mantissa2 :f32
277- exponent2 :i8
278- mantissa2 , exponent2 = frexp (y )
279- assert abs (mantissa2 - f32 (0.615 )) < f32 (eps ) and exponent2 == i8 (1 )
280-
281- y = f32 (- 1.23 )
282- mantissa2 , exponent2 = frexp (y )
283- assert abs (mantissa2 - f32 (- 0.615 )) < f32 (eps ) and exponent2 == i8 (1 )
284-
285-
286- def test_isclose ():
287- x :f64 = 2.2130
288- y :f64 = 2.2129
289- assert isclose (x , y , rel_tol = 0.01 , abs_tol = 0.001 )
290- assert isclose (x ,y ,rel_tol = 0.0000001 ,abs_tol = 0.01 )
291- assert isclose (x ,y ,rel_tol = 0.1 ,abs_tol = 0.000001 )
292- assert not isclose (x ,y ,rel_tol = 0.0000001 ,abs_tol = 0.00001 )
293-
294- x = - 1.265
295- y = 1.265
296- assert not isclose (x ,y ,rel_tol = 0.001 ,abs_tol = 0.0001 )
297- assert not isclose (y ,x ,rel_tol = 0.01 ,abs_tol = 0.1 )
298- assert not isclose (x ,y ,rel_tol = 0.01 ,abs_tol = 0.1 )
299-
300- x = - 1.2650
301- y = - 1.2651
302- assert isclose (x , y , rel_tol = 0.01 , abs_tol = 0.001 )
303- assert isclose (x ,y ,rel_tol = 0.0000001 ,abs_tol = 0.01 )
304- assert isclose (x ,y ,rel_tol = 0.1 ,abs_tol = 0.000001 )
305- assert not isclose (x ,y ,rel_tol = 0.0000001 ,abs_tol = 0.00001 )
256+ # def test_frexp():
257+ # x:f64 = 6.23
258+ # mantissa:f64
259+ # exponent:i16
260+ # mantissa, exponent = frexp(x)
261+ # assert abs(mantissa - 0.77875) < eps and exponent == i16(3)
262+ #
263+ # x = 0.8
264+ # mantissa, exponent = frexp(x)
265+ # assert abs(mantissa - 0.8) < eps and exponent == i16(0)
266+ #
267+ # x = 19.74
268+ # mantissa, exponent = frexp(x)
269+ # assert abs(mantissa - 0.616875) < eps and exponent == i16(5)
270+ #
271+ # x = -23.6
272+ # mantissa, exponent = frexp(x)
273+ # assert abs(mantissa + 0.7375) < eps and exponent == i16(5)
274+ #
275+ # y:f32 = f32(1.23)
276+ # mantissa2:f32
277+ # exponent2:i8
278+ # mantissa2, exponent2 = frexp(y)
279+ # assert abs(mantissa2 - f32(0.615)) < f32(eps) and exponent2 == i8(1)
280+ #
281+ # y = f32(-1.23)
282+ # mantissa2, exponent2 = frexp(y)
283+ # assert abs(mantissa2 - f32(-0.615)) < f32(eps) and exponent2 == i8(1)
284+ #
285+ #
286+ # def test_isclose():
287+ # x:f64 = 2.2130
288+ # y:f64 = 2.2129
289+ # assert isclose(x, y, rel_tol=0.01, abs_tol=0.001)
290+ # assert isclose(x,y,rel_tol=0.0000001,abs_tol=0.01)
291+ # assert isclose(x,y,rel_tol=0.1,abs_tol=0.000001)
292+ # assert not isclose(x,y,rel_tol=0.0000001,abs_tol=0.00001)
293+ #
294+ # x = -1.265
295+ # y = 1.265
296+ # assert not isclose(x,y,rel_tol=0.001,abs_tol=0.0001)
297+ # assert not isclose(y,x,rel_tol=0.01,abs_tol=0.1)
298+ # assert not isclose(x,y,rel_tol=0.01,abs_tol=0.1)
299+ #
300+ # x = -1.2650
301+ # y = -1.2651
302+ # assert isclose(x, y, rel_tol=0.01, abs_tol=0.001)
303+ # assert isclose(x,y,rel_tol=0.0000001,abs_tol=0.01)
304+ # assert isclose(x,y,rel_tol=0.1,abs_tol=0.000001)
305+ # assert not isclose(x,y,rel_tol=0.0000001,abs_tol=0.00001)
306306
307307
308308def check ():
@@ -328,10 +328,11 @@ def check():
328328 test_fsum ()
329329 test_prod ()
330330 test_dist ()
331- test_modf ()
331+ # test_modf()
332332 test_issue_1242 ()
333- test_frexp ()
334- test_isclose ()
333+ # test_frexp()
334+ # test_isclose()
335335
336336
337337check ()
338+
0 commit comments