<commit_before># check cases converting float to int, relying only on single precision float

try:
    import ustruct as struct
except:
    import struct

# work out configuration values
is_64bit = struct.calcsize("P") == 8
# 0 = none, 1 = long long, 2 = mpz
try:
    dummy = 0x7fffffffffffffff
    try:
        if (0xffffffffffffffff + 1) > 0:
            ll_type = 2
        else:
            ll_type = 1
    except:
        # in case the sum in the if statement above changes to raising an exception on overflow
        ll_type = 1
except:
    ll_type = 0

# basic conversion
print(int(14187745.))
print("%d" % 14187745.)
if ll_type == 2:
    print(int(2.**100))
    print("%d" % 2.**100)

testpass = True
p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type]
for i in range(0,p2_rng):
    bitcnt = len(bin(int(2.**i))) - 3;
    if i != bitcnt:
        print('fail: 2**%u was %u bits long' % (i, bitcnt));
        testpass = False
print("power of  2 test: %s" % (testpass and 'passed' or 'failed'))

# TODO why does 10**12 fail this test for single precision float?
testpass = True
p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11
for i in range(0,p10_rng):
    digcnt = len(str(int(10.**i))) - 1;
    if i != digcnt:
        print('fail: 10**%u was %u digits long' % (i, digcnt));
        testpass = False
print("power of 10 test: %s" % (testpass and 'passed' or 'failed'))

def fp2int_test(num, name, should_fail):
    try:
        x = int(num)<commit_msg>test/float2int: Make test output clearer.<commit_after># check cases converting float to int, relying only on single precision float

try:
    import ustruct as struct
except:
    import struct

# work out configuration values
is_64bit = struct.calcsize("P") == 8
# 0 = none, 1 = long long, 2 = mpz
try:
    dummy = 0x7fffffffffffffff
    try:
        if (0xffffffffffffffff + 1) > 0:
            ll_type = 2
        else:
            ll_type = 1
    except:
        # in case the sum in the if statement above changes to raising an exception on overflow
        ll_type = 1
except:
    ll_type = 0

# basic conversion
print(int(14187745.))
print("%d" % 14187745.)
if ll_type == 2:
    print(int(2.**100))
    print("%d" % 2.**100)

testpass = True
p2_rng = ((30,63,127),(62,63,127))[is_64bit][ll_type]
for i in range(0,p2_rng):
    bitcnt = len(bin(int(2.**i))) - 3;
    if i != bitcnt:
        print('fail: 2.**%u was %u bits long' % (i, bitcnt));
        testpass = False
print("power of  2 test: %s" % (testpass and 'passed' or 'failed'))

# TODO why does 10**12 fail this test for single precision float?
testpass = True
p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11
for i in range(0,p10_rng):
    digcnt = len(str(int(10.**i))) - 1;
    if i != digcnt:
        print('fail: 10.**%u was %u digits long' % (i, digcnt));
        testpass = False
print("power of 10 test: %s" % (testpass and 'passed' or 'failed'))

def fp2int_test(num, name, should_fail):
    try:
        x = int(num)
{'fraction_non_alphanumeric': 0.13759296822177147, 'fraction_numerical': 0.05848546315077755, 'mean_word_length': 2.898550724637681, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6579496', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1044, 'n_words': 351}