本文整理汇总了Python中segpy.ibm_float.ibm2ieee函数的典型用法代码示例。如果您正苦于以下问题:Python ibm2ieee函数的具体用法?Python ibm2ieee怎么用?Python ibm2ieee使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibm2ieee函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_zero
def test_zero(self):
ibm_start = b'\0\0\0\0'
f = ibm2ieee(ibm_start)
ibm_result = ieee2ibm(f)
assert ibm_start == ibm_result
示例2: test_error_2
def test_error_2(self):
self.assertEqual(ibm2ieee(bytes((191, 128, 0, 0))), -0.03125)
示例3: test_subnormal_is_subnormal
def test_subnormal_is_subnormal(self):
self.assertTrue(0 < ibm2ieee(bytes((0x00, 0x00, 0x00, 0x20))) < SMALLEST_POSITIVE_NORMAL_IBM_FLOAT)
示例4: test_smallest_positive_normalised_number
def test_smallest_positive_normalised_number(self):
self.assertEqual(ibm2ieee(bytes((0b00000000, 0b00010000, 0b00000000, 0b00000000))), SMALLEST_POSITIVE_NORMAL_IBM_FLOAT)
示例5: test_smallest_representable_number
def test_smallest_representable_number(self):
self.assertEqual(ibm2ieee(bytes((0b11111111, 0b11111111, 0b11111111, 0b11111111))), MIN_IBM_FLOAT)
示例6: test_negative_half
def test_negative_half(self):
self.assertEqual(ibm2ieee(bytes((0b01000000, 0x80, 0x00, 0x00))), 0.5)
示例7: test_negative_118_625
def test_negative_118_625(self):
# Example taken from Wikipedia http://en.wikipedia.org/wiki/IBM_Floating_Point_Architecture
self.assertEqual(ibm2ieee(bytes((0b11000010, 0b01110110, 0b10100000, 0b00000000))), -118.625)
示例8: test_negative_half
def test_negative_half(self):
assert ibm2ieee(bytes((0b01000000, 0x80, 0x00, 0x00))) == 0.5
示例9: test_one
def test_one(self):
assert ibm2ieee(b'\x41\x10\x00\x00') == 1.0
示例10: test_positive_half
def test_positive_half(self):
assert ibm2ieee(bytes((0b11000000, 0x80, 0x00, 0x00))) == -0.5
示例11: test_subnormal
def test_subnormal(self):
ibm_start = bytes((0x00, 0x00, 0x00, 0x20))
f = ibm2ieee(ibm_start)
ibm_result = ieee2ibm(f)
assert ibm_start == ibm_result
示例12: test_zero
def test_zero(self):
self.assertEqual(ibm2ieee(b'\0\0\0\0'), 0.0)
示例13: test_largest_representable_number
def test_largest_representable_number(self):
assert ibm2ieee(bytes((0b01111111, 0b11111111, 0b11111111, 0b11111111))) == MAX_IBM_FLOAT
示例14: test_positive_half
def test_positive_half(self):
self.assertEqual(ibm2ieee(bytes((0b11000000, 0x80, 0x00, 0x00))), -0.5)
示例15: test_smallest_representable_number
def test_smallest_representable_number(self):
assert ibm2ieee(bytes((0b11111111, 0b11111111, 0b11111111, 0b11111111))) == MIN_IBM_FLOAT