35
35
print (int (1418774543.0 ))
36
36
print ("%d" % 1418774543.0 )
37
37
if ll_type == 3 :
38
- print (int (2.0 ** 100 ))
39
- print ("%d" % 2.0 ** 100 )
38
+ print (int (2.0 ** 100 ))
39
+ print ("%d" % 2.0 ** 100 )
40
40
else :
41
41
print (int (1073741823.0 ))
42
42
print ("%d" % 1073741823.0 )
43
43
44
44
testpass = True
45
45
p2_rng = ((30 , 63 , 1024 ), (62 , 63 , 1024 ))[is_64bit ][ll_type ]
46
46
for i in range (0 , p2_rng ):
47
- bitcnt = len (bin (int (2.0 ** i ))) - 3
47
+ bitcnt = len (bin (int (2.0 ** i ))) - 3
48
48
if i != bitcnt :
49
49
print ("fail: 2**%u was %u bits long" % (i , bitcnt ))
50
50
testpass = False
53
53
testpass = True
54
54
p10_rng = ((9 , 18 , 23 ), (18 , 18 , 23 ))[is_64bit ][ll_type ]
55
55
for i in range (0 , p10_rng ):
56
- digcnt = len (str (int (10.0 ** i ))) - 1
56
+ digcnt = len (str (int (10.0 ** i ))) - 1
57
57
if i != digcnt :
58
58
print ("fail: 10**%u was %u digits long" % (i , digcnt ))
59
59
testpass = False
@@ -72,28 +72,28 @@ def fp2int_test(num, name, should_fail):
72
72
if ll_type != 2 :
73
73
if ll_type == 0 :
74
74
if is_64bit :
75
- neg_bad_fp = - 1.00000005 * 2.0 ** 62.0
76
- pos_bad_fp = 2.0 ** 62.0
77
- neg_good_fp = - (2.0 ** 62.0 )
78
- pos_good_fp = 0.99999993 * 2.0 ** 62.0
75
+ neg_bad_fp = - 1.00000005 * 2.0 ** 62.0
76
+ pos_bad_fp = 2.0 ** 62.0
77
+ neg_good_fp = - (2.0 ** 62.0 )
78
+ pos_good_fp = 0.99999993 * 2.0 ** 62.0
79
79
else :
80
- neg_bad_fp = - 1.00000005 * 2.0 ** 30.0
81
- pos_bad_fp = 2.0 ** 30.0
82
- neg_good_fp = - (2.0 ** 30.0 )
83
- pos_good_fp = 0.9999999499 * 2.0 ** 30.0
80
+ neg_bad_fp = - 1.00000005 * 2.0 ** 30.0
81
+ pos_bad_fp = 2.0 ** 30.0
82
+ neg_good_fp = - (2.0 ** 30.0 )
83
+ pos_good_fp = 0.9999999499 * 2.0 ** 30.0
84
84
else :
85
- neg_bad_fp = - 0.51 * 2.0 ** 64.0
86
- pos_bad_fp = 2.0 ** 63.0
87
- neg_good_fp = - (2.0 ** 63.0 )
88
- pos_good_fp = 1.9999998 * 2.0 ** 62.0
85
+ neg_bad_fp = - 0.51 * 2.0 ** 64.0
86
+ pos_bad_fp = 2.0 ** 63.0
87
+ neg_good_fp = - (2.0 ** 63.0 )
88
+ pos_good_fp = 1.9999998 * 2.0 ** 62.0
89
89
90
90
fp2int_test (neg_bad_fp , "neg bad" , True )
91
91
fp2int_test (pos_bad_fp , "pos bad" , True )
92
92
fp2int_test (neg_good_fp , "neg good" , False )
93
93
fp2int_test (pos_good_fp , "pos good" , False )
94
94
else :
95
- fp2int_test (- 1.9999999999999981 * 2.0 ** 1023.0 , "large neg" , False )
96
- fp2int_test (1.9999999999999981 * 2.0 ** 1023.0 , "large pos" , False )
95
+ fp2int_test (- 1.9999999999999981 * 2.0 ** 1023.0 , "large neg" , False )
96
+ fp2int_test (1.9999999999999981 * 2.0 ** 1023.0 , "large pos" , False )
97
97
98
98
fp2int_test (float ("inf" ), "inf test" , True )
99
99
fp2int_test (float ("-inf" ), "inf test" , True )
0 commit comments