<commit_before># Python test set -- math module
# XXXX Should not do tests around zero only

import sys
from test_support import *

seps='1e-05'
eps = eval(seps)
print 'math module, testing with eps', seps
import math

def testit(name, value, expected):
    if abs(value-expected) > eps:
        raise TestFailed, '%s returned %f, expected %f'%\
              (name, value, expected)

print 'constants'
testit('pi', math.pi, 3.1415926)
testit('e', math.e, 2.7182818)

print 'acos'
testit('acos(-1)', math.acos(-1), math.pi)
testit('acos(0)', math.acos(0), math.pi/2)
testit('acos(1)', math.acos(1), 0)

print 'asin'
testit('asin(-1)', math.asin(-1), -math.pi/2)
testit('asin(0)', math.asin(0), 0)
testit('asin(1)', math.asin(1), math.pi/2)

print 'atan'
testit('atan(-1)', math.atan(-1), -math.pi/4)
testit('atan(0)', math.atan(0), 0)
testit('atan(1)', math.atan(1), math.pi/4)

print 'atan2'
testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2)
testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4)
if sys.platform in ['unixware7']:
    testit('atan2(0, 1)', math.atan2(0, 1), math.pi)
else:
    testit('atan2(0, 1)', math.atan2(0, 1), 0)
testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4)
testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2)

print 'ceil'
testit('ceil(0.5)', math.ceil(0.5), 1)
testit('ceil(1.0)', math.ceil(1.0), 1)
testit('ceil(1.5)', math.ceil(1.5), 2)
testit('ceil(-0.5)', math.ceil(-0.5), 0)
testit('ceil(-1.0)', math.ceil(-1.0), -1)
testit('ceil(-1.5)', math.ceil(-1.5), -1)

print 'cos'
testit('cos(-pi/2)', math.cos(-math.pi/2), 0)<commit_msg>Reverting the "unixware7" patch:  atan2(0, 1) should be 0, regardless of platform.  If it returns pi on the unixware7 platform, they have a bug in their libm atan2.<commit_after># Python test set -- math module
# XXXX Should not do tests around zero only

from test_support import *

seps='1e-05'
eps = eval(seps)
print 'math module, testing with eps', seps
import math

def testit(name, value, expected):
    if abs(value-expected) > eps:
        raise TestFailed, '%s returned %f, expected %f'%\
              (name, value, expected)

print 'constants'
testit('pi', math.pi, 3.1415926)
testit('e', math.e, 2.7182818)

print 'acos'
testit('acos(-1)', math.acos(-1), math.pi)
testit('acos(0)', math.acos(0), math.pi/2)
testit('acos(1)', math.acos(1), 0)

print 'asin'
testit('asin(-1)', math.asin(-1), -math.pi/2)
testit('asin(0)', math.asin(0), 0)
testit('asin(1)', math.asin(1), math.pi/2)

print 'atan'
testit('atan(-1)', math.atan(-1), -math.pi/4)
testit('atan(0)', math.atan(0), 0)
testit('atan(1)', math.atan(1), math.pi/4)

print 'atan2'
testit('atan2(-1, 0)', math.atan2(-1, 0), -math.pi/2)
testit('atan2(-1, 1)', math.atan2(-1, 1), -math.pi/4)
testit('atan2(0, 1)', math.atan2(0, 1), 0)
testit('atan2(1, 1)', math.atan2(1, 1), math.pi/4)
testit('atan2(1, 0)', math.atan2(1, 0), math.pi/2)

print 'ceil'
testit('ceil(0.5)', math.ceil(0.5), 1)
testit('ceil(1.0)', math.ceil(1.0), 1)
testit('ceil(1.5)', math.ceil(1.5), 2)
testit('ceil(-0.5)', math.ceil(-0.5), 0)
testit('ceil(-1.0)', math.ceil(-1.0), -1)
testit('ceil(-1.5)', math.ceil(-1.5), -1)

print 'cos'
testit('cos(-pi/2)', math.cos(-math.pi/2), 0)
{'fraction_non_alphanumeric': 0.2430053442313738, 'fraction_numerical': 0.07607670543854134, 'mean_word_length': 4.402376910016978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '1639434', 'n_tokens_mistral': 1460, 'n_tokens_neox': 1393, 'n_words': 316}