当前位置: 首页>>代码示例>>Python>>正文


Python data.IntObject类代码示例

本文整理汇总了Python中typhon.objects.data.IntObject的典型用法代码示例。如果您正苦于以下问题:Python IntObject类的具体用法?Python IntObject怎么用?Python IntObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IntObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testMulDouble

    def testMulDouble(self):
        """
        Ints are promoted by doubles during multiplication.
        """

        i = IntObject(4)
        result = i.call(u"multiply", [DoubleObject(2.1)])
        self.assertTrue(isinstance(result, DoubleObject))
        self.assertEqual(result.getDouble(), 8.4)
开发者ID:markrwilliams,项目名称:typhon,代码行数:9,代码来源:test_data.py

示例2: testPow

 def testPow(self):
     i = IntObject(3)
     result = i.call(u"pow", [IntObject(100)])
     self.assertTrue(result.bi.eq(rbigint.fromint(3).pow(rbigint.fromint(100))))
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例3: testPowSmall

 def testPowSmall(self):
     i = IntObject(5)
     result = i.call(u"pow", [IntObject(7)])
     self.assertEqual(result.getInt(), 78125)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例4: testOr

 def testOr(self):
     i = IntObject(0x3)
     result = i.call(u"or", [IntObject(0x5)])
     self.assertEqual(result.getInt(), 0x7)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例5: testApproxDivideNaN

 def testApproxDivideNaN(self):
     i = IntObject(0)
     result = i.call(u"approxDivide", [i])
     self.assertTrue(math.isnan(result.getDouble()))
开发者ID:washort,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例6: testSubtractDouble

 def testSubtractDouble(self):
     i = IntObject(5)
     result = i.call(u"subtract", [DoubleObject(1.5)])
     self.assertAlmostEqual(result.getDouble(), 3.5)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例7: testShiftRightLarge

 def testShiftRightLarge(self):
     i = IntObject(0x7fffffffffffffff)
     result = i.call(u"shiftRight", [IntObject(64)])
     self.assertEqual(result.getInt(), 0x0)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例8: testShiftLeftFar

 def testShiftLeftFar(self):
     i = IntObject(0x1)
     result = i.call(u"shiftLeft", [IntObject(65)])
     bi = rbigint.fromint(0x1).lshift(65)
     self.assertTrue(result.bi.eq(bi))
开发者ID:markrwilliams,项目名称:typhon,代码行数:5,代码来源:test_data.py

示例9: testMax

 def testMax(self):
     i = IntObject(3)
     result = i.call(u"max", [IntObject(5)])
     self.assertEqual(result.getInt(), 5)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例10: testComplement

 def testComplement(self):
     i = IntObject(5)
     result = i.call(u"complement", [])
     self.assertEqual(result.getInt(), -6)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例11: testApproxDivideBigInt

 def testApproxDivideBigInt(self):
     i = IntObject(7937000378463977)
     # Hack.
     bi = BigInt(rbigint.fromint(1000000000000000000).int_mul(10))
     result = i.call(u"approxDivide", [bi])
     self.assertAlmostEqual(result._d, 0.0007937000378463977)
开发者ID:markrwilliams,项目名称:typhon,代码行数:6,代码来源:test_data.py

示例12: testApproxDivide

 def testApproxDivide(self):
     i = IntObject(4)
     result = i.call(u"approxDivide", [IntObject(2)])
     self.assertAlmostEqual(result.getDouble(), 2.0)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例13: testAddDouble

 def testAddDouble(self):
     i = IntObject(32)
     result = i.call(u"add", [DoubleObject(1.1)])
     self.assertAlmostEqual(result.getDouble(), 33.1)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例14: testAdd

 def testAdd(self):
     i = IntObject(32)
     result = i.call(u"add", [IntObject(11)])
     self.assertEqual(result.getInt(), 43)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py

示例15: testModPow

 def testModPow(self):
     i = IntObject(3)
     result = i.call(u"modPow", [IntObject(1000000), IntObject(255)])
     self.assertEqual(result.getInt(), 171)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py


注:本文中的typhon.objects.data.IntObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。