@@ -291,94 +291,3 @@ def assertAllNotClose(examples, *args, **kwargs):
291291assert math .fmod (- 3.0 , NINF ) == - 3.0
292292assert math .fmod (0.0 , 3.0 ) == 0.0
293293assert math .fmod (0.0 , NINF ) == 0.0
294-
295- """
296- TODO: math.remainder was added to CPython in 3.7 and RustPython CI runs on 3.6.
297- So put the tests of math.remainder in a comment for now.
298- https://github.com/RustPython/RustPython/pull/1589#issuecomment-551424940
299- """
300-
301- # testcases = [
302- # # Remainders modulo 1, showing the ties-to-even behaviour.
303- # '-4.0 1 -0.0',
304- # '-3.8 1 0.8',
305- # '-3.0 1 -0.0',
306- # '-2.8 1 -0.8',
307- # '-2.0 1 -0.0',
308- # '-1.8 1 0.8',
309- # '-1.0 1 -0.0',
310- # '-0.8 1 -0.8',
311- # '-0.0 1 -0.0',
312- # ' 0.0 1 0.0',
313- # ' 0.8 1 0.8',
314- # ' 1.0 1 0.0',
315- # ' 1.8 1 -0.8',
316- # ' 2.0 1 0.0',
317- # ' 2.8 1 0.8',
318- # ' 3.0 1 0.0',
319- # ' 3.8 1 -0.8',
320- # ' 4.0 1 0.0',
321-
322- # # Reductions modulo 2*pi
323- # '0x0.0p+0 0x1.921fb54442d18p+2 0x0.0p+0',
324- # '0x1.921fb54442d18p+0 0x1.921fb54442d18p+2 0x1.921fb54442d18p+0',
325- # '0x1.921fb54442d17p+1 0x1.921fb54442d18p+2 0x1.921fb54442d17p+1',
326- # '0x1.921fb54442d18p+1 0x1.921fb54442d18p+2 0x1.921fb54442d18p+1',
327- # '0x1.921fb54442d19p+1 0x1.921fb54442d18p+2 -0x1.921fb54442d17p+1',
328- # '0x1.921fb54442d17p+2 0x1.921fb54442d18p+2 -0x0.0000000000001p+2',
329- # '0x1.921fb54442d18p+2 0x1.921fb54442d18p+2 0x0p0',
330- # '0x1.921fb54442d19p+2 0x1.921fb54442d18p+2 0x0.0000000000001p+2',
331- # '0x1.2d97c7f3321d1p+3 0x1.921fb54442d18p+2 0x1.921fb54442d14p+1',
332- # '0x1.2d97c7f3321d2p+3 0x1.921fb54442d18p+2 -0x1.921fb54442d18p+1',
333- # '0x1.2d97c7f3321d3p+3 0x1.921fb54442d18p+2 -0x1.921fb54442d14p+1',
334- # '0x1.921fb54442d17p+3 0x1.921fb54442d18p+2 -0x0.0000000000001p+3',
335- # '0x1.921fb54442d18p+3 0x1.921fb54442d18p+2 0x0p0',
336- # '0x1.921fb54442d19p+3 0x1.921fb54442d18p+2 0x0.0000000000001p+3',
337- # '0x1.f6a7a2955385dp+3 0x1.921fb54442d18p+2 0x1.921fb54442d14p+1',
338- # '0x1.f6a7a2955385ep+3 0x1.921fb54442d18p+2 0x1.921fb54442d18p+1',
339- # '0x1.f6a7a2955385fp+3 0x1.921fb54442d18p+2 -0x1.921fb54442d14p+1',
340- # '0x1.1475cc9eedf00p+5 0x1.921fb54442d18p+2 0x1.921fb54442d10p+1',
341- # '0x1.1475cc9eedf01p+5 0x1.921fb54442d18p+2 -0x1.921fb54442d10p+1',
342-
343- # # Symmetry with respect to signs.
344- # ' 1 0.c 0.4',
345- # '-1 0.c -0.4',
346- # ' 1 -0.c 0.4',
347- # '-1 -0.c -0.4',
348- # ' 1.4 0.c -0.4',
349- # '-1.4 0.c 0.4',
350- # ' 1.4 -0.c -0.4',
351- # '-1.4 -0.c 0.4',
352-
353- # # Huge modulus, to check that the underlying algorithm doesn't
354- # # rely on 2.0 * modulus being representable.
355- # '0x1.dp+1023 0x1.4p+1023 0x0.9p+1023',
356- # '0x1.ep+1023 0x1.4p+1023 -0x0.ap+1023',
357- # '0x1.fp+1023 0x1.4p+1023 -0x0.9p+1023',
358- # ]
359-
360- # for case in testcases:
361- # x_hex, y_hex, expected_hex = case.split()
362- # # print(x_hex, y_hex, expected_hex)
363- # x = float.fromhex(x_hex)
364- # y = float.fromhex(y_hex)
365- # expected = float.fromhex(expected_hex)
366- # actual = math.remainder(x, y)
367- # # Cheap way of checking that the floats are
368- # # as identical as we need them to be.
369- # assert actual.hex() == expected.hex()
370- # # self.assertEqual(actual.hex(), expected.hex())
371-
372-
373- # # Test tiny subnormal modulus: there's potential for
374- # # getting the implementation wrong here (for example,
375- # # by assuming that modulus/2 is exactly representable).
376- # tiny = float.fromhex('1p-1074') # min +ve subnormal
377- # for n in range(-25, 25):
378- # if n == 0:
379- # continue
380- # y = n * tiny
381- # for m in range(100):
382- # x = m * tiny
383- # actual = math.remainder(x, y)
384- # actual = math.remainder(-x, y)
0 commit comments