本文整理汇总了Python中typhon.objects.data.IntObject类的典型用法代码示例。如果您正苦于以下问题:Python IntObject类的具体用法?Python IntObject怎么用?Python IntObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IntObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: testShiftLeftLarge
def testShiftLeftLarge(self):
i = IntObject(0x5c5c)
result = i.call(u"shiftLeft", [IntObject(64)])
bi = rbigint.fromint(0x5c5c).lshift(64)
self.assertTrue(result.bi.eq(bi))
开发者ID:markrwilliams,项目名称:typhon,代码行数:5,代码来源:test_data.py
示例17: testMin
def testMin(self):
i = IntObject(3)
result = i.call(u"min", [IntObject(5)])
self.assertEqual(result.getInt(), 3)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py
示例18: testShiftRight
def testShiftRight(self):
i = IntObject(0xf0)
result = i.call(u"shiftRight", [IntObject(5)])
self.assertEqual(result.getInt(), 0x7)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py
示例19: testOpCmpDouble
def testOpCmpDouble(self):
i = IntObject(2)
result = i.call(u"op__cmp", [DoubleObject(2.0)])
self.assertEqual(result.getInt(), 0)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py
示例20: testSubtract
def testSubtract(self):
i = IntObject(5)
result = i.call(u"subtract", [IntObject(15)])
self.assertAlmostEqual(result.getInt(), -10)
开发者ID:markrwilliams,项目名称:typhon,代码行数:4,代码来源:test_data.py
注:本文中的typhon.objects.data.IntObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论