#####################################################################################
#
#  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__)

[((30, 4, 30, 35), 'clr.AddReference', 'clr.AddReference', ({(30, 21, 30, 34): 'math_assembly'}, {}), '(math_assembly)', False, 'import clr\n'), ((48, 13, 48, 90), 'Microsoft.Scripting.Math.BigInteger.Add', 'BigInteger.Add', ({(48, 28, 48, 29): '(1)', (48, 30, 48, 89): '(99999999999999999999999999999999999999999999999999999999999)'}, {}), '(1, 99999999999999999999999999999999999999999999999999999999999)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((48, 92, 48, 175), 'Microsoft.Scripting.Math.BigInteger.Subtract', 'BigInteger.Subtract', ({(48, 112, 48, 172): '(100000000000000000000000000000000000000000000000000000000001)', (48, 173, 48, 174): '(1)'}, {}), '(\n    100000000000000000000000000000000000000000000000000000000001, 1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((49, 13, 49, 41), 'Microsoft.Scripting.Math.BigInteger.Multiply', 'BigInteger.Multiply', ({(49, 33, 49, 36): '(400)', (49, 37, 49, 40): '(500)'}, {}), '(400, 500)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((49, 44, 49, 72), 'Microsoft.Scripting.Math.BigInteger.Divide', 'BigInteger.Divide', ({(49, 62, 49, 69): '(1000000)', (49, 70, 49, 71): '(5)'}, {}), '(1000000, 5)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((50, 13, 50, 39), 'Microsoft.Scripting.Math.BigInteger.Multiply', 'BigInteger.Multiply', ({(50, 33, 50, 36): '(400)', (50, 37, 50, 38): '(8)'}, {}), '(400, 8)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((50, 42, 50, 69), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', ({(50, 63, 50, 66): '(400)', (50, 67, 50, 68): '(3)'}, {}), '(400, 3)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((51, 13, 51, 37), 'Microsoft.Scripting.Math.BigInteger.Divide', 'BigInteger.Divide', ({(51, 31, 51, 34): '(400)', (51, 35, 51, 36): '(8)'}, {}), '(400, 8)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((51, 40, 51, 68), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', ({(51, 62, 51, 65): '(400)', (51, 66, 51, 67): '(3)'}, {}), '(400, 3)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((65, 93, 65, 115), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(65, 104, 65, 114): '(2852170240)'}, {}), '(2852170240)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((68, 13, 68, 51), 'Microsoft.Scripting.Math.BigInteger.ToInt64', 'BigInteger.ToInt64', ({(68, 32, 68, 50): '(9223372036854775807)'}, {}), '(9223372036854775807)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((84, 13, 84, 28), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(84, 24, 84, 27): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((87, 21, 87, 36), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(87, 32, 87, 35): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((101, 12, 101, 32), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(101, 23, 101, 30): '-x ** a'}, {}), '(-x ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((106, 12, 106, 33), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(106, 23, 106, 32): '2 ** a - 1'}, {}), '(2 ** a - 1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((111, 12, 111, 25), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(111, 23, 111, 24): '0'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((128, 12, 128, 32), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(128, 23, 128, 30): '-x ** a'}, {}), '(-x ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((133, 12, 133, 33), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(133, 23, 133, 32): '2 ** a - 1'}, {}), '(2 ** a - 1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((138, 12, 138, 25), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(138, 23, 138, 24): '0'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((162, 8, 162, 30), 'Microsoft.Scripting.Math.Complex64.Divide', 'Complex.Divide', ({(162, 23, 162, 27): '(4 + 2.0j)', (162, 28, 162, 29): '(2)'}, {}), '(4 + 2.0j, 2)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((196, 25, 196, 41), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(196, 36, 196, 40): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((198, 25, 198, 42), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(198, 36, 198, 41): '(-1)'}, {}), '(-1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((199, 25, 199, 42), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(199, 36, 199, 41): '(-129)'}, {}), '(-129)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((200, 25, 200, 43), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(200, 36, 200, 42): '(-256)'}, {}), '(-256)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((201, 25, 201, 44), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(201, 36, 201, 43): '(-4096)'}, {}), '(-4096)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((202, 25, 202, 45), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(202, 36, 202, 44): '(-65536)'}, {}), '(-65536)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((203, 25, 203, 46), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(203, 36, 203, 45): '(-1048576)'}, {}), '(-1048576)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((204, 25, 204, 48), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(204, 36, 204, 47): '(-268435456)'}, {}), '(-268435456)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((205, 25, 205, 49), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(205, 36, 205, 48): '(-4294967296)'}, {}), '(-4294967296)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((207, 25, 207, 41), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(207, 36, 207, 40): '(127)'}, {}), '(127)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((208, 25, 208, 41), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(208, 36, 208, 40): '(255)'}, {}), '(255)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((209, 25, 209, 43), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(209, 36, 209, 42): '(513)'}, {}), '(513)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((210, 25, 210, 43), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(210, 36, 210, 42): '(62193)'}, {}), '(62193)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((211, 25, 211, 47), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(211, 36, 211, 46): '(50462976)'}, {}), '(50462976)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((212, 25, 212, 49), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(212, 36, 212, 48): '(17230332160)'}, {}), '(17230332160)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((213, 25, 213, 55), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(213, 36, 213, 54): '(506097522914230528)'}, {}), '(506097522914230528)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((214, 25, 214, 57), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(214, 36, 214, 56): '(148080050112590643456)'}, {}), '(148080050112590643456)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((237, 26, 237, 39), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(237, 37, 237, 38): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((238, 26, 238, 39), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(238, 37, 238, 38): '(1)'}, {}), '(1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((239, 26, 239, 45), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(239, 38, 239, 43): '(1 << 31)'}, {}), '(1 << 31)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((240, 26, 240, 51), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(240, 38, 240, 49): '((1 << 31) + 9)'}, {}), '((1 << 31) + 9)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((241, 26, 241, 45), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(241, 38, 241, 43): '(1 << 32)'}, {}), '(1 << 32)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((52, 35, 52, 64), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', ({(52, 56, 52, 59): '(400)', (52, 60, 52, 63): '(100)'}, {}), '(400, 100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((53, 35, 53, 79), 'Microsoft.Scripting.Math.BigInteger.LeftShift', 'BigInteger.LeftShift', ({(53, 56, 53, 74): '(-12345678987654321)', (53, 75, 53, 78): '(100)'}, {}), '(-12345678987654321, 100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((65, 46, 65, 89), 'Microsoft.Scripting.Math.BigInteger.BitwiseOr', 'BigInteger.BitwiseOr', ({(65, 67, 65, 77): '(16711935)', (65, 78, 65, 88): '(2864425659)'}, {}), '(16711935, 2864425659)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((66, 28, 66, 81), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(66, 39, 66, 80): '(-9999999999999999999999999999999999999999)'}, {}), '(-9999999999999999999999999999999999999999)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((78, 31, 78, 45), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(78, 42, 78, 44): '(-1)'}, {}), '(-1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((83, 11, 83, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(83, 22, 83, 25): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((86, 22, 86, 37), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(86, 33, 86, 36): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((153, 25, 153, 41), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(153, 36, 153, 40): '(9999)'}, {}), '(9999)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((156, 12, 156, 49), 'Microsoft.Scripting.Math.Complex64', 'Complex', ({(156, 20, 156, 33): '(9.999999e-196)', (156, 35, 156, 48): '(1.234588e+104)'}, {}), '(9.999999e-196, 1.234588e+104)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((159, 12, 159, 49), 'Microsoft.Scripting.Math.Complex64', 'Complex', ({(159, 20, 159, 33): '(9.999999e-196)', (159, 35, 159, 48): '(1.234588e+104)'}, {}), '(9.999999e-196, 1.234588e+104)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((160, 12, 160, 49), 'Microsoft.Scripting.Math.Complex64', 'Complex', ({(160, 20, 160, 33): '(9.999999e-196)', (160, 35, 160, 48): '(1.234588e+104)'}, {}), '(9.999999e-196, 1.234588e+104)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((174, 13, 174, 30), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(174, 24, 174, 29): '(-1234)'}, {}), '(-1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((175, 21, 175, 38), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(175, 32, 175, 37): '(-1234)'}, {}), '(-1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((179, 13, 179, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(179, 24, 179, 25): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((180, 21, 180, 34), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(180, 32, 180, 33): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((184, 13, 184, 29), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(184, 24, 184, 28): '(1234)'}, {}), '(1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((185, 21, 185, 37), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(185, 32, 185, 36): '(1234)'}, {}), '(1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((60, 38, 60, 69), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', ({(60, 60, 60, 63): '(400)', (60, 64, 60, 68): '(-100)'}, {}), '(400, -100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((61, 38, 61, 84), 'Microsoft.Scripting.Math.BigInteger.RightShift', 'BigInteger.RightShift', ({(61, 60, 61, 78): '(-12345678987654321)', (61, 79, 61, 83): '(-100)'}, {}), '(-12345678987654321, -100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((63, 13, 63, 114), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(63, 24, 63, 113): '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )'}, {}), '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((66, 162, 66, 194), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(66, 173, 66, 193): '(-1000000000000000000)'}, {}), '(-1000000000000000000)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((71, 13, 71, 27), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(71, 24, 71, 26): '(-0)'}, {}), '(-0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((72, 13, 72, 38), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(72, 24, 72, 37): '(-1212321.3213)'}, {}), '(-1212321.3213)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((73, 13, 73, 50), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(73, 24, 73, 49): '(1212321384892342394723947)'}, {}), '(1212321384892342394723947)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((75, 13, 75, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(75, 24, 75, 25): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((76, 13, 76, 27), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(76, 24, 76, 26): '(65)'}, {}), '(65)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((77, 13, 77, 31), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(77, 24, 77, 30): '(65535)'}, {}), '(65535)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((80, 13, 80, 28), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(80, 24, 80, 27): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((81, 67, 81, 90), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(81, 78, 81, 89): '(100.1213123)'}, {}), '(100.1213123)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((116, 42, 116, 61), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(116, 53, 116, 59): '(2 ** a)'}, {}), '(2 ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((117, 42, 117, 66), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(117, 53, 117, 64): '(-1 - x ** a)'}, {}), '(-1 - x ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((143, 42, 143, 61), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(143, 53, 143, 59): '(2 ** a)'}, {}), '(2 ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((144, 42, 144, 66), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(144, 53, 144, 64): '(-1 - x ** a)'}, {}), '(-1 - x ** a)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((151, 20, 151, 36), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(151, 31, 151, 35): '(9999)'}, {}), '(9999)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((152, 30, 152, 50), 'Microsoft.Scripting.Math.Complex64', 'Complex', ({(152, 38, 152, 42): '(9999)', (152, 44, 152, 49): '(-1234)'}, {}), '(9999, -1234)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((157, 27, 157, 64), 'Microsoft.Scripting.Math.Complex64', 'Complex', ({(157, 35, 157, 48): '(9.999999e-196)', (157, 50, 157, 63): '(1.234588e+104)'}, {}), '(9.999999e-196, 1.234588e+104)', True, 'from Microsoft.Scripting.Math import Complex64 as Complex\n'), ((176, 13, 176, 30), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(176, 24, 176, 29): '(-1234)'}, {}), '(-1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((177, 13, 177, 30), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(177, 24, 177, 29): '(-1234)'}, {}), '(-1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((181, 13, 181, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(181, 24, 181, 25): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((182, 13, 182, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(182, 24, 182, 25): '(0)'}, {}), '(0)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((186, 13, 186, 29), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(186, 24, 186, 28): '(1234)'}, {}), '(1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((187, 13, 187, 29), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(187, 24, 187, 28): '(1234)'}, {}), '(1234)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((235, 16, 235, 41), 'Microsoft.Scripting.Math.BigInteger.Negate', 'BigInteger.Negate', ({(235, 34, 235, 40): 'bigint'}, {}), '(bigint)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((247, 13, 247, 26), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(247, 24, 247, 25): '(1)'}, {}), '(1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((251, 39, 251, 52), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(251, 50, 251, 51): '(1)'}, {}), '(1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((64, 116, 64, 217), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(64, 127, 64, 216): '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )'}, {}), '(-\n    1234567812345678123456781234567812345678123456781234567812345678123456781234567812345678\n    )', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((249, 17, 249, 30), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(249, 28, 249, 29): '(1)'}, {}), '(1)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((62, 13, 62, 98), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(62, 24, 62, 97): '(-123456781234567812345678123456781234567812345678123456781234567812345678)'}, {}), '(-\n    123456781234567812345678123456781234567812345678123456781234567812345678)', False, 'from Microsoft.Scripting.Math import BigInteger\n'), ((81, 24, 81, 39), 'Microsoft.Scripting.Math.BigInteger', 'BigInteger', ({(81, 35, 81, 38): '(100)'}, {}), '(100)', False, 'from Microsoft.Scripting.Math import BigInteger\n')]