Home
last modified time | relevance | path

Searched refs:from_float (Results 1 – 4 of 4) sorted by relevance

/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/test/
Dtest_fractions.py30 return op(F.from_float(self.value), other)
246 self.assertRaises(TypeError, F.from_float, 3+4j)
247 self.assertEqual((10, 1), _components(F.from_float(10)))
249 self.assertEqual((bigint, 1), _components(F.from_float(bigint)))
250 self.assertEqual((0, 1), _components(F.from_float(-0.0)))
251 self.assertEqual((10, 1), _components(F.from_float(10.0)))
252 self.assertEqual((-5, 2), _components(F.from_float(-2.5)))
254 _components(F.from_float(1e23)))
255 self.assertEqual(float(10**23), float(F.from_float(1e23)))
257 _components(F.from_float(3.2)))
[all …]
Dtest_decimal.py1702 r = MyDecimal.from_float(0.1)
1707 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint))
1708 self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan())
1709 self.assertTrue(MyDecimal.from_float(float('inf')).is_infinite())
1710 self.assertTrue(MyDecimal.from_float(float('-inf')).is_infinite())
1711 self.assertEqual(str(MyDecimal.from_float(float('nan'))),
1713 self.assertEqual(str(MyDecimal.from_float(float('inf'))),
1715 self.assertEqual(str(MyDecimal.from_float(float('-inf'))),
1717 self.assertRaises(TypeError, MyDecimal.from_float, 'abc')
1720 self.assertEqual(x, float(MyDecimal.from_float(x))) # roundtrip
/device/linaro/bootloader/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/
Dfractions.py109 value = Fraction.from_float(numerator)
169 def from_float(cls, f): member in Fraction
540 return a == a.from_float(b)
568 return op(self, self.from_float(other))
Ddecimal.py651 value = Decimal.from_float(value)
662 def from_float(cls, f): member in Decimal
698 from_float = classmethod(from_float) variable in Decimal
967 if Decimal.from_float(self_as_float) == self:
3925 d = Decimal.from_float(f) # An exact conversion
5799 return Decimal.from_float(other)