def test_Float(): # NOTE prec is the whole number of decimal digits assert str(Float('1.23', prec=1+2)) == '1.23' assert str(Float('1.23456789', prec=1+8)) == '1.23456789' assert str(Float('1.234567890123456789', prec=1+18)) == '1.234567890123456789' assert str(pi.evalf(1+2)) == '3.14' assert str(pi.evalf(1+14)) == '3.14159265358979' assert str(pi.evalf(1+64)) == '3.1415926535897932384626433832795028841971693993751058209749445923' assert str(round(pi, -1)) == '0.' assert str((pi**400 - round(pi**400, 1)).n(1)) == '-0.e+91'
def test_mod(): x = Rational(1, 2) y = Rational(3, 4) z = Rational(5, 18043) assert x % x == 0 assert x % y == 1/S(2) assert x % z == 3/S(36086) assert y % x == 1/S(4) assert y % y == 0 assert y % z == 9/S(72172) assert z % x == 5/S(18043) assert z % y == 5/S(18043) assert z % z == 0 a = Float(2.6) assert round(a % .2, 15) == 0.2 assert round(a % 2, 15) == 0.6 assert round(a % 0.5, 15) == 0.1 # No rounding required since these numbers can be represented # exactly. assert Rational(3,4) % Float(1.1) == 0.75 assert Float(1.5) % Rational(5, 4) == 0.25 assert Rational(5,4).__rmod__(Float('1.5')) == 0.25 assert Float('1.5').__rmod__(Float('2.75')) == Float('1.25') assert 2.75 % Float('1.5') == Float('1.25') a = Integer(7) b = Integer(4) assert type(a % b) == Integer assert a % b == Integer(3) assert Integer(1) % Rational(2, 3) == Rational(1, 3) assert Rational(7,5) % Integer(1) == Rational(2,5) assert Integer(2) % 1.5 == 0.5 assert Integer(3).__rmod__(Integer(10)) == Integer(1) assert Integer(10) % 4 == Integer(2) assert 15 % Integer(4) == Integer(3)
'atan': lambda x: sympy.atan(x), 'acosh': lambda x: sympy.acosh(x), 'asinh': lambda x: sympy.asinh(x), 'atanh': lambda x: sympy.atanh(x), 'abs': lambda x: abs(x), 'mod': lambda x, y: sympy.Mod(x, y), 'erf': lambda x: sympy.erf(x), 'erfc': lambda x: sympy.erfc(x), 'logm': lambda x: sympy.log(abs(x)), 'logm10': lambda x: sympy.log10(abs(x)), 'logm2': lambda x: sympy.log2(abs(x)), 'log1p': lambda x: sympy.log(x + 1), 'floor': lambda x: sympy.floor(x), 'ceil': lambda x: sympy.ceil(x), 'sign': lambda x: sympy.sign(x), 'round': lambda x: sympy.round(x), } def pysr(X=None, y=None, weights=None, binary_operators=["plus", "mult"], unary_operators=["cos", "exp", "sin"], procs=4, loss='L2DistLoss()', populations=None, niterations=100, ncyclesperiteration=300, alpha=0.1, annealing=True,
def test_issue_1073(): assert int(round(E**100)) == 26881171418161354484126255515800135873611119 assert int(round(pi**100)) == 51878483143196131920862615246303013562686760680406 assert int(round(Rational(1)/EulerGamma**100)) == 734833795660954410469466