#####################################################################################
#
#  Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you cannot locate the  Apache License, Version 2.0, please send an email to
# ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
# by the terms of the Apache License, Version 2.0.
#
# You must not remove this notice, or any other, from this software.
#
#
#####################################################################################

#
# test Microsoft.Scripting.Math
#


from iptest.assert_util import *
skiptest("win32")


from System import *
import clr
#silverlight already has this
if is_cli:
    math_assembly = (1).GetType().Assembly
    clr.AddReference(math_assembly)
load_iron_python_test()
import IronPythonTest

if is_net40:
    from System.Numerics import BigInteger, Complex
else:
    from Microsoft.Scripting.Math import BigInteger
    from Microsoft.Scripting.Math import Complex64 as Complex


class myFormatProvider(IFormatProvider):
    def ToString():pass
    
p = myFormatProvider()


def test_bigint():
    AreEqual(BigInteger.Add(1,99999999999999999999999999999999999999999999999999999999999) ,BigInteger.Subtract(100000000000000000000000000000000000000000000000000000000001,1))
    AreEqual(BigInteger.Multiply(400,500) , BigInteger.Divide(1000000,5))
    AreEqual(BigInteger.Multiply(400,8) , BigInteger.LeftShift(400,3))
    AreEqual(BigInteger.Divide(400,8) , BigInteger.RightShift(400,3))
    AreEqual(BigInteger.RightShift(BigInteger.LeftShift(400,100),100) , 400)
    AreEqual(BigInteger.RightShift(BigInteger.LeftShift(-12345678987654321,100),100) , -12345678987654321)
    if is_net40:
        AssertError(ValueError, BigInteger.RightShift, 400, -100)
        AssertError(ValueError, BigInteger.LeftShift, 400, -100)
        AssertError(ValueError, BigInteger.RightShift, -12345678987654321, -100)
        AssertError(ValueError, BigInteger.LeftShift, -12345678987654321, -100)
    else:
        AreEqual(BigInteger.LeftShift(BigInteger.RightShift(400,-100),-100) , 400)
        AreEqual(BigInteger.LeftShift(BigInteger.RightShift(-12345678987654321,-100),-100) , -12345678987654321)
    AreEqual(BigInteger(-123456781234567812345678123456781234567812345678123456781234567812345678).OnesComplement().OnesComplement() , -123456781234567812345678123456781234567812345678123456781234567812345678)
    AreEqual(BigInteger(-1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678).OnesComplement() , -(-1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678 + 1 ))
    Assert(BigInteger.Xor(-1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678,BigInteger(-1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678).OnesComplement()) , -1)
    AreEqual(BigInteger.BitwiseAnd(0xff00ff00,BigInteger.BitwiseOr(0x00ff00ff,0xaabbaabb)) , BigInteger(0xaa00aa00))
    AreEqual(BigInteger.Mod(BigInteger(-9999999999999999999999999999999999999999),1000000000000000000) , -BigInteger.Mod(9999999999999999999999999999999999999999,BigInteger(-1000000000000000000)))
    
    AreEqual(BigInteger.ToInt64(0x7fffffffffffffff) , 9223372036854775807)
    AssertError(OverflowError, BigInteger.ToInt64, 0x8000000000000000)
    
    AreEqual(BigInteger(-0).ToBoolean(p) , False )
    AreEqual(BigInteger(-1212321.3213).ToBoolean(p) , True )
    AreEqual(BigInteger(1212321384892342394723947).ToBoolean(p) , True )
    
    AreEqual(BigInteger(0).ToChar(p) , Char.MinValue)
    AreEqual(BigInteger(65).ToChar(p) , IConvertible.ToChar('A', p))
    AreEqual(BigInteger(0xffff).ToChar(p) , Char.MaxValue)
    AssertError(OverflowError, BigInteger(-1).ToChar, p)
    
    AreEqual(BigInteger(100).ToDouble(p) , 100.0)
    AreEqual(BigInteger(BigInteger(100).ToDouble(p)).ToSingle(p) , BigInteger(100.1213123).ToFloat())
    
    Assert(BigInteger(100) != 100.32)
    AreEqual(BigInteger(100) , 100.0)
    
    Assert( 100.32 != BigInteger(100))
    AreEqual(100.0 , BigInteger(100) )

def test_big_1():
    for (a, m, t,x) in [
                        (7, "ToSByte",  SByte,2),
                        (8, "ToByte",   Byte, 0),
                        (15, "ToInt16", Int16,2),
                        (16, "ToUInt16", UInt16,0),
                        (31, "ToInt32", Int32,2),
                        (32, "ToUInt32", UInt32,0),
                        (63, "ToInt64", Int64,2),
                        (64, "ToUInt64", UInt64,0)
                       ]:
    
        b = BigInteger(-x ** a )
        left = getattr(b, m)(p)
        right = t.MinValue
        AreEqual(left, right)
        
        b = BigInteger(2 ** a -1)
        left = getattr(b, m)(p)
        right = t.MaxValue
        AreEqual(left, right)
    
        b = BigInteger(0)
        left = getattr(b, m)(p)
        right = t.MaxValue - t.MaxValue
        AreEqual(left, 0)

        AssertError(OverflowError,getattr(BigInteger(2 ** a ), m),p)
        AssertError(OverflowError,getattr(BigInteger(-1 - x ** a ), m),p)


def test_big_2():
    for (a, m, t,x) in [
                        (31, "ToInt32",Int32,2),
                        (32, "ToUInt32",UInt32,0),
                        (63, "ToInt64",Int64,2),
                        (64, "ToUInt64",UInt64,0)
                       ]:
    
        b = BigInteger(-x ** a )
        left = getattr(b, m)()
        right = t.MinValue
        AreEqual(left, right)

        b = BigInteger(2 ** a -1)
        left = getattr(b, m)()
        right = t.MaxValue
        AreEqual(left, right)
    
        b = BigInteger(0)
        left = getattr(b, m)()
        right = t.MaxValue - t.MaxValue
        AreEqual(left, right)

        AssertError(OverflowError,getattr(BigInteger(2 ** a ), m))
        AssertError(OverflowError,getattr(BigInteger(-1 - x ** a ), m))


#complex
def test_complex():
    AreEqual(
        Complex.Add(
            Complex(BigInteger(9999), -1234),
            Complex.Conjugate(Complex(9999, -1234)) ),
        Complex.Multiply(BigInteger(9999), 2) )
    AreEqual(
        Complex.Add(
            Complex(99999.99e-200, 12345.88e+100),
            Complex.Negate(Complex(99999.99e-200, 12345.88e+100)) ),
        Complex.Subtract(
            Complex(99999.99e-200, 12345.88e+100),
            Complex(99999.99e-200, 12345.88e+100) ))
    AreEqual(
        Complex.Divide(4+2j,2),
        (2 + 1j) )
    Assert(not hasattr(Complex, "Mod"))  #IP 1.x had limited support for modulo which has been removed

def test_bool_misc():
    if is_net40:
        def is_zero(bigint):
            return bigint.IsZero
    else:
        def is_zero(bigint):
            return bigint.IsZero()
    
    AreEqual(BigInteger(-1234).Sign, -1)
    AreEqual(is_zero(BigInteger(-1234)), False)
    AreEqual(BigInteger(-1234).IsNegative(), True)
    AreEqual(BigInteger(-1234).IsPositive(), False)
    
    AreEqual(BigInteger(0).Sign, 0)
    AreEqual(is_zero(BigInteger(0)), True)
    AreEqual(BigInteger(0).IsNegative(), False)
    AreEqual(BigInteger(0).IsPositive(), False)

    AreEqual(BigInteger(1234).Sign, 1)
    AreEqual(is_zero(BigInteger(1234)), False)
    AreEqual(BigInteger(1234).IsNegative(), False)
    AreEqual(BigInteger(1234).IsPositive(), True)


def test_byte_conversions():

    def CheckByteConversions(bigint, bytes):
        SequencesAreEqual(bigint.ToByteArray(), bytes)
        AreEqual(BigInteger.Create(Array[Byte](bytes)), bigint)

    CheckByteConversions(BigInteger(0x00), [0x00])

    CheckByteConversions(BigInteger(-0x01), [0xff])
    CheckByteConversions(BigInteger(-0x81), [0x7f, 0xff])
    CheckByteConversions(BigInteger(-0x100), [0x00, 0xff])
    CheckByteConversions(BigInteger(-0x1000), [0x00, 0xf0])
    CheckByteConversions(BigInteger(-0x10000), [0x00, 0x00, 0xff])
    CheckByteConversions(BigInteger(-0x100000), [0x00, 0x00, 0xf0])
    CheckByteConversions(BigInteger(-0x10000000), [0x00, 0x00, 0x00, 0xf0])
    CheckByteConversions(BigInteger(-0x100000000), [0x00, 0x00, 0x00, 0x00, 0xff])

    CheckByteConversions(BigInteger(0x7f), [0x7f])
    CheckByteConversions(BigInteger(0xff), [0xff, 0x00])
    CheckByteConversions(BigInteger(0x0201), [0x01, 0x02])
    CheckByteConversions(BigInteger(0xf2f1), [0xf1, 0xf2, 0x00])
    CheckByteConversions(BigInteger(0x03020100), [0x00, 0x01, 0x02, 0x03])
    CheckByteConversions(BigInteger(0x0403020100), [0x00, 0x01, 0x02, 0x03, 0x04])
    CheckByteConversions(BigInteger(0x0706050403020100), [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07])
    CheckByteConversions(BigInteger(0x080706050403020100), [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08])

def test_dword_conversions():
    def CheckDwordConversions(bigint, dwords):
        SequencesAreEqual(bigint.GetWords(), dwords)
        if bigint == BigInteger.Zero:
            AreEqual(
                IronPythonTest.System_Scripting_Math.CreateBigInteger(
                    0,
                    Array[UInt32](dwords),),
                bigint)
        else:
            AreEqual(
                IronPythonTest.System_Scripting_Math.CreateBigInteger(
                    1,
                    Array[UInt32](dwords)),
                bigint)
            AreEqual(
                IronPythonTest.System_Scripting_Math.CreateBigInteger(
                    -1,
                    Array[UInt32](dwords)),
                BigInteger.Negate(bigint))
    
    CheckDwordConversions(BigInteger(0), [0x00000000])
    CheckDwordConversions(BigInteger(1), [0x00000001])
    CheckDwordConversions(BigInteger((1<<31)), [0x80000000])
    CheckDwordConversions(BigInteger(((1<<31) + 9)), [0x80000009])
    CheckDwordConversions(BigInteger((1<<32)), [0x00000000, 0x00000001])

def test_misc():
    AssertError(ArgumentException, IronPythonTest.System_Scripting_Math.CreateBigInteger, 0, (1, 2, 3))
    AssertError(ArgumentNullException, IronPythonTest.System_Scripting_Math.CreateBigInteger, 0, None)

    AreEqual(BigInteger(1).CompareTo(None), 1)
    if is_net40:
        AreEqual(BigInteger(1).CompareTo(True), 0)
    else:
        AssertError(ArgumentException, BigInteger(1).CompareTo, True)

run_test(__name__)

[((937, 968), 'clr.AddReference', 'clr.AddReference', (['math_assembly'], {}), '(math_assembly)\n', (953, 968), False, 'import clr\n'), ((1330, 1408), 'Microsoft.Scripting.Math.BigInteger.Add', 'BigInteger.Add', (['(1)', '(99999999999999999999999999999999999999999999999999999999999)'], {}), '(1, 99999999999999999999999999999999999999999999999999999999999)\n', (1344, 1408), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1409, 1498), 'Microsoft.Scripting.Math.BigInteger.Subtract', 'BigInteger.Subtract', (['(100000000000000000000000000000000000000000000000000000000001)', '(1)'], {}), '(\n    100000000000000000000000000000000000000000000000000000000001, 1)\n', (1428, 1498), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1507, 1536), 'Microsoft.Scripting.Math.BigInteger.Multiply', 'BigInteger.Multiply', (['(400)', '(500)'], {}), '(400, 500)\n', (1526, 1536), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1538, 1567), 'Microsoft.Scripting.Math.BigInteger.Divide', 'BigInteger.Divide', (['(1000000)', '(5)'], {}), '(1000000, 5)\n', (1555, 1567), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1581, 1608), 'Microsoft.Scripting.Math.BigInteger.Multiply', 'BigInteger.Multiply', (['(400)', '(8)'], {}), '(400, 8)\n', (1600, 1608), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1610, 1638), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', (['(400)', '(3)'], {}), '(400, 3)\n', (1630, 1638), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1652, 1677), 'Microsoft.Scripting.Math.BigInteger.Divide', 'BigInteger.Divide', (['(400)', '(8)'], {}), '(400, 8)\n', (1669, 1677), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1679, 1708), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', (['(400)', '(3)'], {}), '(400, 3)\n', (1700, 1708), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3186, 3208), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(2852170240)'], {}), '(2852170240)\n', (3196, 3208), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3425, 3464), 'Microsoft.Scripting.Math.BigInteger.ToInt64', 'BigInteger.ToInt64', (['(9223372036854775807)'], {}), '(9223372036854775807)\n', (3443, 3464), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4205, 4220), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4215, 4220), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4295, 4310), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4305, 4310), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4805, 4824), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-x ** a)'], {}), '(-x ** a)\n', (4815, 4824), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4936, 4958), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(2 ** a - 1)'], {}), '(2 ** a - 1)\n', (4946, 4958), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5064, 5077), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (5074, 5077), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5607, 5626), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-x ** a)'], {}), '(-x ** a)\n', (5617, 5626), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5729, 5751), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(2 ** a - 1)'], {}), '(2 ** a - 1)\n', (5739, 5751), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5856, 5869), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (5866, 5869), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6633, 6660), 'Microsoft.Scripting.Math.Complex64.Divide', 'Complex.Divide', (['(4 + 2.0j)', '(2)'], {}), '(4 + 2.0j, 2)\n', (6647, 6660), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((7742, 7755), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (7752, 7755), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7794, 7808), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1)'], {}), '(-1)\n', (7804, 7808), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7846, 7862), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-129)'], {}), '(-129)\n', (7856, 7862), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7904, 7920), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-256)'], {}), '(-256)\n', (7914, 7920), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7963, 7980), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-4096)'], {}), '(-4096)\n', (7973, 7980), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8023, 8041), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-65536)'], {}), '(-65536)\n', (8033, 8041), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8090, 8110), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1048576)'], {}), '(-1048576)\n', (8100, 8110), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8158, 8180), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-268435456)'], {}), '(-268435456)\n', (8168, 8180), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8234, 8257), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-4294967296)'], {}), '(-4294967296)\n', (8244, 8257), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8318, 8333), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(127)'], {}), '(127)\n', (8328, 8333), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8369, 8384), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(255)'], {}), '(255)\n', (8379, 8384), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8426, 8441), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(513)'], {}), '(513)\n', (8436, 8441), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8485, 8502), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(62193)'], {}), '(62193)\n', (8495, 8502), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8550, 8570), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(50462976)'], {}), '(50462976)\n', (8560, 8570), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8625, 8648), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(17230332160)'], {}), '(17230332160)\n', (8635, 8648), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8708, 8738), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(506097522914230528)'], {}), '(506097522914230528)\n', (8718, 8738), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((8815, 8848), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(148080050112590643456)'], {}), '(148080050112590643456)\n', (8825, 8848), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9692, 9705), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (9702, 9705), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9747, 9760), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1)'], {}), '(1)\n', (9757, 9760), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9802, 9821), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1 << 31)'], {}), '(1 << 31)\n', (9812, 9821), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9863, 9888), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['((1 << 31) + 9)'], {}), '((1 << 31) + 9)\n', (9873, 9888), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9930, 9949), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1 << 32)'], {}), '(1 << 32)\n', (9940, 9949), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1744, 1774), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', (['(400)', '(100)'], {}), '(400, 100)\n', (1764, 1774), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((1821, 1866), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', (['(-12345678987654321)', '(100)'], {}), '(-12345678987654321, 100)\n', (1841, 1866), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3139, 3181), 'Microsoft.Scripting.Math.BigInteger.BitwiseOr', 'BigInteger.BitwiseOr', (['(16711935)', '(2864425659)'], {}), '(16711935, 2864425659)\n', (3159, 3181), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3238, 3291), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-9999999999999999999999999999999999999999)'], {}), '(-9999999999999999999999999999999999999999)\n', (3248, 3291), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3966, 3980), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1)'], {}), '(-1)\n', (3976, 3980), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4165, 4180), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4175, 4180), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4257, 4272), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4267, 4272), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6303, 6319), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(9999)'], {}), '(9999)\n', (6313, 6319), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6373, 6410), 'Microsoft.Scripting.Math.Complex64', 'Complex', (['(9.999999e-196)', '(1.234588e+104)'], {}), '(9.999999e-196, 1.234588e+104)\n', (6380, 6410), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((6519, 6556), 'Microsoft.Scripting.Math.Complex64', 'Complex', (['(9.999999e-196)', '(1.234588e+104)'], {}), '(9.999999e-196, 1.234588e+104)\n', (6526, 6556), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((6570, 6607), 'Microsoft.Scripting.Math.Complex64', 'Complex', (['(9.999999e-196)', '(1.234588e+104)'], {}), '(9.999999e-196, 1.234588e+104)\n', (6577, 6607), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((6973, 6990), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1234)'], {}), '(-1234)\n', (6983, 6990), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7022, 7039), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1234)'], {}), '(-1234)\n', (7032, 7039), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7170, 7183), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (7180, 7183), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7214, 7227), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (7224, 7227), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7346, 7362), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1234)'], {}), '(1234)\n', (7356, 7362), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7393, 7409), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1234)'], {}), '(1234)\n', (7403, 7409), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((2250, 2282), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', (['(400)', '(-100)'], {}), '(400, -100)\n', (2271, 2282), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((2333, 2380), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', (['(-12345678987654321)', '(-100)'], {}), '(-12345678987654321, -100)\n', (2354, 2380), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((2631, 2742), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )'], {}), '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )\n', (2641, 2742), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3372, 3404), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1000000000000000000)'], {}), '(-1000000000000000000)\n', (3382, 3404), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3576, 3590), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-0)'], {}), '(-0)\n', (3586, 3590), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3627, 3652), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1212321.3213)'], {}), '(-1212321.3213)\n', (3637, 3652), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3688, 3725), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1212321384892342394723947)'], {}), '(1212321384892342394723947)\n', (3698, 3725), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3766, 3779), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (3776, 3779), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3820, 3834), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(65)'], {}), '(65)\n', (3830, 3834), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((3889, 3906), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(65535)'], {}), '(65535)\n', (3899, 3906), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4010, 4025), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4020, 4025), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4114, 4137), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100.1213123)'], {}), '(100.1213123)\n', (4124, 4137), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5219, 5237), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(2 ** a)'], {}), '(2 ** a)\n', (5229, 5237), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((5288, 5311), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1 - x ** a)'], {}), '(-1 - x ** a)\n', (5298, 5311), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6014, 6032), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(2 ** a)'], {}), '(2 ** a)\n', (6024, 6032), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6081, 6104), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1 - x ** a)'], {}), '(-1 - x ** a)\n', (6091, 6104), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6197, 6213), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(9999)'], {}), '(9999)\n', (6207, 6213), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((6253, 6273), 'Microsoft.Scripting.Math.Complex64', 'Complex', (['(9999)', '(-1234)'], {}), '(9999, -1234)\n', (6260, 6273), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((6439, 6476), 'Microsoft.Scripting.Math.Complex64', 'Complex', (['(9.999999e-196)', '(1.234588e+104)'], {}), '(9.999999e-196, 1.234588e+104)\n', (6446, 6476), True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((7062, 7079), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1234)'], {}), '(-1234)\n', (7072, 7079), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7113, 7130), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-1234)'], {}), '(-1234)\n', (7123, 7130), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7249, 7262), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (7259, 7262), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7297, 7310), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(0)'], {}), '(0)\n', (7307, 7310), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7432, 7448), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1234)'], {}), '(1234)\n', (7442, 7448), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((7483, 7499), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1234)'], {}), '(1234)\n', (7493, 7499), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((9634, 9659), 'Microsoft.Scripting.Math.BigInteger.Negate', 'BigInteger.Negate', (['bigint'], {}), '(bigint)\n', (9651, 9659), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((10216, 10229), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1)'], {}), '(1)\n', (10226, 10229), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((10367, 10380), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1)'], {}), '(1)\n', (10377, 10380), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((2967, 3078), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )'], {}), '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )\n', (2977, 3078), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((10284, 10297), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(1)'], {}), '(1)\n', (10294, 10297), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((2421, 2511), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(-123456781234567812345678123456781234567812345678123456781234567812345678)'], {}), '(-\n    123456781234567812345678123456781234567812345678123456781234567812345678)\n', (2431, 2511), False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((4071, 4086), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', (['(100)'], {}), '(100)\n', (4081, 4086), False, 'from Microsoft.Scripting.Math import BigInteger\n')]