Home
last modified time | relevance | path

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

12

/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/cpython3/Lib/test/
Dtest_fractions.py27 return op(F.from_float(self.value), other)
249 self.assertRaises(TypeError, F.from_float, 3+4j)
250 self.assertEqual((10, 1), _components(F.from_float(10)))
252 self.assertEqual((bigint, 1), _components(F.from_float(bigint)))
253 self.assertEqual((0, 1), _components(F.from_float(-0.0)))
254 self.assertEqual((10, 1), _components(F.from_float(10.0)))
255 self.assertEqual((-5, 2), _components(F.from_float(-2.5)))
257 _components(F.from_float(1e23)))
258 self.assertEqual(float(10**23), float(F.from_float(1e23)))
260 _components(F.from_float(3.2)))
[all …]
Dtest_numeric_tower.py84 self.check_equal_hash(x, D.from_float(x))
85 self.check_equal_hash(x, F.from_float(x))
Dtest_decimal.py1188 a = A.from_float(42.5)
1191 a = A.from_float(42)
2549 r = MyDecimal.from_float(0.1)
2556 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint))
2557 self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan())
2558 self.assertTrue(MyDecimal.from_float(float('inf')).is_infinite())
2559 self.assertTrue(MyDecimal.from_float(float('-inf')).is_infinite())
2560 self.assertEqual(str(MyDecimal.from_float(float('nan'))),
2562 self.assertEqual(str(MyDecimal.from_float(float('inf'))),
2564 self.assertEqual(str(MyDecimal.from_float(float('-inf'))),
[all …]
/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/cpython3/Lib/
Dfractions.py194 def from_float(cls, f): member in Fraction
582 return a == a.from_float(b)
606 return op(self, self.from_float(other))
D_pydecimal.py659 value = Decimal.from_float(value)
669 def from_float(cls, f): member in Decimal
4121 d = Decimal.from_float(f) # An exact conversion
6024 return Decimal.from_float(other)
6063 return self, Decimal.from_float(other)
/external/fonttools/Lib/fontTools/misc/
Dpy23.py369 d = _decimal.Decimal.from_float(number).quantize(
440 d = _decimal.Decimal.from_float(number).quantize(
/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/python/cpython3/Doc/library/
Dfractions.rst97 .. method:: from_float(flt)
101 ``Fraction.from_float(0.3)`` is not the same value as ``Fraction(3, 10)``.
Ddecimal.rst574 .. method:: from_float(f)
578 Note `Decimal.from_float(0.1)` is not the same as `Decimal('0.1')`.
589 >>> Decimal.from_float(0.1)
591 >>> Decimal.from_float(float('nan'))
593 >>> Decimal.from_float(float('inf'))
595 >>> Decimal.from_float(float('-inf'))
1093 as the context. Unlike the :meth:`Decimal.from_float` class method,
1634 context flags. Explicit conversions with :meth:`~decimal.Decimal.from_float`
/external/python/cpython3/Doc/tutorial/
Dfloatingpoint.rst290 >>> Fraction.from_float(0.1)
296 >>> Decimal.from_float(0.1)
299 >>> format(Decimal.from_float(0.1), '.17')
/external/python/cpython2/Misc/NEWS.d/
D2.6b2.rst234 Fractions from_float() and from_decimal() accept Integral arguments.
D2.7a1.rst4269 Added Decimal.from_float() and Context.create_decimal_from_float() to the
4319 Fractions.from_float() no longer loses precision for integers too big to
/external/skia/src/opts/
DSkRasterPipeline_opts.h2473 SI U16 from_float(float f) { return f * 255.0f + 0.5f; }
2623 r = from_float(rgb[0]);
2624 g = from_float(rgb[1]);
2625 b = from_float(rgb[2]);
3066 U16 c = from_float(*f);
3073 U16 c = from_float(*f);
/external/skqp/src/opts/
DSkRasterPipeline_opts.h2457 SI U16 from_float(float f) { return f * 255.0f + 0.5f; }
2607 r = from_float(rgb[0]);
2608 g = from_float(rgb[1]);
2609 b = from_float(rgb[2]);
3048 U16 c = from_float(*f);
3055 U16 c = from_float(*f);
/external/eigen/Eigen/src/Core/arch/CUDA/
DPacketMathHalf.h494 Packet16f from_float = half2float(from);
495 return half(predux(from_float));
/external/python/cpython3/Doc/whatsnew/
D3.1.rst253 >>> Decimal.from_float(1.1)
D3.2.rst1313 directly so there in no longer a need to use the :meth:`~decimal.Decimal.from_float`
1321 :meth:`~fractions.Fraction.from_float()` and :meth:`~fractions.Fraction.from_decimal`
D2.7.rst1184 :meth:`~decimal.Decimal.from_float` class method that performs an exact
1190 For example, ``Decimal.from_float(0.1)`` returns
/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/cpython3/Misc/NEWS.d/
D3.7.0a1.rst3461 Fixed different behaviour of Decimal.from_float() for _decimal and

12