Home
last modified time | relevance | path

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

/external/python/cpython2/Lib/test/
Dtest_fractions.py31 return op(F.from_float(self.value), other)
250 self.assertRaises(TypeError, F.from_float, 3+4j)
251 self.assertEqual((10, 1), _components(F.from_float(10)))
253 self.assertEqual((bigint, 1), _components(F.from_float(bigint)))
254 self.assertEqual((0, 1), _components(F.from_float(-0.0)))
255 self.assertEqual((10, 1), _components(F.from_float(10.0)))
256 self.assertEqual((-5, 2), _components(F.from_float(-2.5)))
258 _components(F.from_float(1e23)))
259 self.assertEqual(float(10**23), float(F.from_float(1e23)))
261 _components(F.from_float(3.2)))
[all …]
Dtest_decimal.py1725 r = MyDecimal.from_float(0.1)
1730 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint))
1731 self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan())
1732 self.assertTrue(MyDecimal.from_float(float('inf')).is_infinite())
1733 self.assertTrue(MyDecimal.from_float(float('-inf')).is_infinite())
1734 self.assertEqual(str(MyDecimal.from_float(float('nan'))),
1736 self.assertEqual(str(MyDecimal.from_float(float('inf'))),
1738 self.assertEqual(str(MyDecimal.from_float(float('-inf'))),
1740 self.assertRaises(TypeError, MyDecimal.from_float, 'abc')
1743 self.assertEqual(x, float(MyDecimal.from_float(x))) # roundtrip
/external/python/cpython2/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.py650 value = Decimal.from_float(value)
661 def from_float(cls, f): member in Decimal
697 from_float = classmethod(from_float) variable in Decimal
966 if Decimal.from_float(self_as_float) == self:
3953 d = Decimal.from_float(f) # An exact conversion
5868 return Decimal.from_float(other)
/external/python/cpython2/Doc/library/
Dfractions.rst88 .. method:: from_float(flt)
92 ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)``.
Ddecimal.rst542 .. method:: from_float(f)
546 Note `Decimal.from_float(0.1)` is not the same as `Decimal('0.1')`.
557 >>> Decimal.from_float(0.1)
559 >>> Decimal.from_float(float('nan'))
561 >>> Decimal.from_float(float('inf'))
563 >>> Decimal.from_float(float('-inf'))
1115 as the context. Unlike the :meth:`Decimal.from_float` class method,
/external/eigen/Eigen/src/Core/arch/CUDA/
DPacketMathHalf.h494 Packet16f from_float = half2float(from);
495 return half(predux(from_float));
/external/python/cpython2/Doc/whatsnew/
D2.7.rst1169 :meth:`~decimal.Decimal.from_float` class method that performs an exact
1175 For example, ``Decimal.from_float(0.1)`` returns
/external/python/cpython2/Misc/
DNEWS8573 - Issue #4796: Added Decimal.from_float() and
8588 - Fractions.from_float() no longer loses precision for integers too big to cast
9580 - Issue #3285: Fractions from_float() and from_decimal() accept Integral arguments.