Home
last modified time | relevance | path

Searched refs:Decimal (Results 1 – 25 of 466) sorted by relevance

12345678910>>...19

/external/python/cpython2/Lib/test/
Dtest_decimal.py337 v = Decimal(v, self.context)
416 self.assertEqual(Decimal(), Decimal("0"))
419 self.assertRaises(TypeError, Decimal, None)
424 d = Decimal(45)
428 d = Decimal(500000123)
432 d = Decimal(-45)
436 d = Decimal(0)
442 self.assertEqual(str(Decimal('')), 'NaN')
445 self.assertEqual(str(Decimal('45')), '45')
448 self.assertEqual(str(Decimal('45.34')), '45.34')
[all …]
Dtest_fractions.py3 from decimal import Decimal
167 _components(F(Decimal('1.1'))))
169 _components(F(Decimal('3.5e-2'))))
171 _components(F(Decimal('.000e20'))))
172 self.assertRaises(TypeError, F, Decimal('nan'))
173 self.assertRaises(TypeError, F, Decimal('snan'))
174 self.assertRaises(TypeError, F, Decimal('inf'))
175 self.assertRaises(TypeError, F, Decimal('-inf'))
279 self.assertEqual(F(0), F.from_decimal(Decimal("-0")))
280 self.assertEqual(F(5, 10), F.from_decimal(Decimal("0.5")))
[all …]
/external/python/cpython3/Lib/test/
Dtest_decimal.py283 return self.decimal.Decimal(v, context)
493 Decimal = self.decimal.Decimal
494 self.assertEqual(Decimal(), Decimal("0"))
497 Decimal = self.decimal.Decimal
498 self.assertRaises(TypeError, Decimal, None)
501 Decimal = self.decimal.Decimal
504 d = Decimal(45)
508 d = Decimal(500000123)
512 d = Decimal(-45)
516 d = Decimal(0)
[all …]
Dtest_statistics.py19 from decimal import Decimal
317 args1 = [2456, 37.8, -12.45, Decimal('2.54'), Fraction(17, 54)]
318 args2 = [2459, 37.2, -12.41, Decimal('2.59'), Fraction(15, 54)]
340 for type_ in (int, float, Decimal, Fraction):
396 D = Decimal
413 self.do_exactly_equal_test(Decimal("3.571"), Decimal("0.01"), 0)
414 self.do_exactly_equal_test(-Decimal("81.3971"), Decimal("0.01"), 0)
420 self.do_exactly_equal_test(Decimal("11.68"), 0, Decimal("0.01"))
426 D = Decimal
457 for d in map(Decimal, "3.1415 298.12 3.47 18.996 0.00245".split()):
[all …]
Dtest_fractions.py3 from decimal import Decimal
149 _components(F(Decimal('1.1'))))
151 _components(F(Decimal('3.5e-2'))))
153 _components(F(Decimal('.000e20'))))
155 self.assertRaises(ValueError, F, Decimal('nan'))
156 self.assertRaises(ValueError, F, Decimal('snan'))
157 self.assertRaises(OverflowError, F, Decimal('inf'))
158 self.assertRaises(OverflowError, F, Decimal('-inf'))
260 self.assertEqual(F(0), F.from_decimal(Decimal("-0")))
261 self.assertEqual(F(5, 10), F.from_decimal(Decimal("0.5")))
[all …]
/external/parameter-framework/upstream/test/test-fixed-point-parameter/
DMain.py34 from decimal import Decimal
83 Decimal(0),
84 Decimal(self._lowerAllowedBound),
85 Decimal(self._upperAllowedBound)
93 Decimal(self._lowerAllowedBound) - Decimal(bigValue),
94 Decimal(self._upperAllowedBound) + Decimal(bigValue),
95 Decimal(self._lowerAllowedBound) - Decimal(littleValue),
96 Decimal(self._upperAllowedBound) + Decimal(littleValue)
159 returnValue = Decimal(firstGet)
164 upperAllowedValue = Decimal(valuePreviouslySet) + (Decimal(self._quantum) / Decimal(2))
[all …]
/external/python/cpython2/Doc/library/
Ddecimal.rst2 :mod:`decimal` --- Decimal fixed point and floating point arithmetic
6 :synopsis: Implementation of the General Decimal Arithmetic Specification.
32 * Decimal "is based on a floating-point model which was designed with people
37 * Decimal numbers can be represented exactly. In contrast, numbers like
62 >>> Decimal(1) / Decimal(7)
63 Decimal('0.142857')
65 >>> Decimal(1) / Decimal(7)
66 Decimal('0.1428571428571428571428571429')
111 * IBM's General Decimal Arithmetic Specification, `The General Decimal Arithmetic
134 Decimal instances can be constructed from integers, strings, floats, or tuples.
[all …]
Dfractions.rst32 either a :class:`float` or a :class:`decimal.Decimal` instance, and return a
72 >>> from decimal import Decimal
73 >>> Fraction(Decimal('1.1'))
85 :class:`decimal.Decimal` instances.
101 value of *dec*, which must be a :class:`decimal.Decimal`.
104 :class:`Fraction` instance directly from a :class:`decimal.Decimal`
Dtokenize.rst119 Example of a script re-writer that transforms float literals into Decimal
125 >>> from decimal import Decimal
128 "print +Decimal ('21.3e-5')*-Decimal ('.1234')/Decimal ('81.7')"
141 (NAME, 'Decimal'),
/external/python/cpython3/Doc/library/
Ddecimal.rst1 :mod:`decimal` --- Decimal fixed point and floating point arithmetic
5 :synopsis: Implementation of the General Decimal Arithmetic Specification.
37 * Decimal "is based on a floating-point model which was designed with people
42 * Decimal numbers can be represented exactly. In contrast, numbers like
67 >>> Decimal(1) / Decimal(7)
68 Decimal('0.142857')
70 >>> Decimal(1) / Decimal(7)
71 Decimal('0.1428571428571428571428571429')
116 * IBM's General Decimal Arithmetic Specification, `The General Decimal Arithmetic
139 Decimal instances can be constructed from integers, strings, floats, or tuples.
[all …]
Dfractions.rst32 either a :class:`float` or a :class:`decimal.Decimal` instance, and return a
72 >>> from decimal import Decimal
73 >>> Fraction(Decimal('1.1'))
85 :class:`decimal.Decimal` instances.
123 value of *dec*, which must be a :class:`decimal.Decimal` instance.
128 :class:`Fraction` instance directly from a :class:`decimal.Decimal`
/external/python/cpython3/Lib/test/test_asyncio/
Dtest_context.py17 a = decimal.Decimal(x) / decimal.Decimal(y)
19 b = decimal.Decimal(x) / decimal.Decimal(y ** 2)
/external/python/cpython2/Doc/tutorial/
Dstdlib2.rst352 Decimal Floating Point Arithmetic
355 The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
372 >>> x = Decimal('0.70') * Decimal('1.05')
374 Decimal('0.7350')
375 >>> x.quantize(Decimal('0.01')) # round to nearest cent
376 Decimal('0.74')
380 The :class:`~decimal.Decimal` result keeps a trailing zero, automatically
382 significance. Decimal reproduces mathematics as done by hand and avoids
386 Exact representation enables the :class:`~decimal.Decimal` class to perform
390 >>> Decimal('1.00') % Decimal('.10')
[all …]
/external/python/cpython3/Doc/tutorial/
Dstdlib2.rst354 Decimal Floating Point Arithmetic
357 The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
374 >>> round(Decimal('0.70') * Decimal('1.05'), 2)
375 Decimal('0.74')
379 The :class:`~decimal.Decimal` result keeps a trailing zero, automatically
381 significance. Decimal reproduces mathematics as done by hand and avoids
385 Exact representation enables the :class:`~decimal.Decimal` class to perform
389 >>> Decimal('1.00') % Decimal('.10')
390 Decimal('0.00')
394 >>> sum([Decimal('0.1')]*10) == Decimal('1.0')
[all …]
/external/llvm/lib/Target/PowerPC/
Dp9-instrs.txt15 // 6.17.2 Decimal Integer Format Conversion Instructions
17 // Decimal Convert From National VX-form p352
20 // Decimal Convert From Zoned VX-form p353
23 // Decimal Convert To National VX-form p354
26 // Decimal Convert To Zoned VX-form p355
29 // Decimal Convert From Signed Quadword VX-form p356
32 // Decimal Convert To Signed Quadword VX-form p356
35 // 6.17.3 Decimal Integer Sign Manipulation Instructions
37 // Decimal Copy Sign VX-form p358
40 // Decimal Set Sign VX-form p358
[all …]
/external/python/cpython2/Lib/json/tests/
Dtest_decode.py9 rval = self.loads('1.1', parse_float=decimal.Decimal)
10 self.assertTrue(isinstance(rval, decimal.Decimal))
11 self.assertEqual(rval, decimal.Decimal('1.1'))
/external/python/cpython3/Lib/
D_pydecimal.py513 class Decimal(object): class
597 if isinstance(value, Decimal):
663 value = Decimal.from_float(value)
712 if cls is Decimal:
941 return Decimal(self._cmp(other))
1131 ans = Decimal(self)
1178 return Decimal(self)
1180 return Decimal(other) # Can't both be infinity here
1239 ans = Decimal(result)
1529 ans = Decimal(self)
[all …]
/external/python/cpython3/Modules/_decimal/tests/
Ddeccheck.py412 cmp = 1 if x.compare_total(P.Decimal("+0")) >= 0 else -1
455 if P.Decimal("-0.6") < err < P.Decimal("0.6"):
458 if P.Decimal("-0.1") < err < P.Decimal("1.1"):
461 if P.Decimal("-1.1") < err < P.Decimal("0.1"):
464 if P.Decimal("-1.1") < err < P.Decimal("1.1"):
488 rounded = P.Decimal(t.cresults[0])
665 if isinstance(a, C.Decimal):
695 c = C.Decimal(op)
710 maxop = C.Decimal(op)
838 if isinstance(t.rc, C.Decimal) and isinstance(t.rp, P.Decimal):
[all …]
Dbench.py38 D = C.Decimal
50 D = P.Decimal
110 x = factorial(C.Decimal(n), 0)
/external/python/cpython2/Lib/
Ddecimal.py505 class Decimal(object): class
589 if isinstance(value, Decimal):
650 value = Decimal.from_float(value)
693 if cls is Decimal:
932 return Decimal(self._cmp(other))
966 if Decimal.from_float(self_as_float) == self:
1098 ans = Decimal(self)
1145 return Decimal(self)
1147 return Decimal(other) # Can't both be infinity here
1206 ans = Decimal(result)
[all …]
/external/python/pybind11/docs/advanced/pycpp/
Dobject.rst54 This example obtains a reference to the Python ``Decimal`` class.
58 // Equivalent to "from decimal import Decimal"
59 py::object Decimal = py::module_::import("decimal").attr("Decimal");
78 // Construct a Python object of class Decimal
79 py::object pi = Decimal("3.14159");
118 py::object decimal_exp = Decimal.attr("exp");
122 py::print(decimal_exp(Decimal(n));
/external/fonttools/Tests/misc/
Dpy23_test.py374 from decimal import Decimal
377 (Decimal('1.00000001'), Decimal('1.0')),
378 (Decimal('1.00000001e-20'), Decimal('1.0e-20')),
379 (Decimal('1.00000001e-100'), Decimal('1.0e-100'))]
/external/python/cpython2/Doc/whatsnew/
D2.4.rst471 PEP 327: Decimal Data Type
478 accurately. The new :class:`Decimal` type can represent these fractions
482 Why is Decimal needed?
533 Hence, the :class:`Decimal` type was created.
536 The :class:`Decimal` type
540 contains two classes, :class:`Decimal` and :class:`Context`. :class:`Decimal`
544 :class:`Decimal` instances are immutable, like regular Python integers and FP
546 represents. :class:`Decimal` instances can be created from integers or
550 >>> decimal.Decimal(1972)
551 Decimal("1972")
[all …]
/external/python/cpython3/Doc/whatsnew/
D2.4.rst471 PEP 327: Decimal Data Type
478 accurately. The new :class:`Decimal` type can represent these fractions
482 Why is Decimal needed?
533 Hence, the :class:`Decimal` type was created.
536 The :class:`Decimal` type
540 contains two classes, :class:`Decimal` and :class:`Context`. :class:`Decimal`
544 :class:`Decimal` instances are immutable, like regular Python integers and FP
546 represents. :class:`Decimal` instances can be created from integers or
550 >>> decimal.Decimal(1972)
551 Decimal("1972")
[all …]
/external/python/cpython3/Lib/test/test_json/
Dtest_decode.py9 rval = self.loads('1.1', parse_float=decimal.Decimal)
10 self.assertTrue(isinstance(rval, decimal.Decimal))
11 self.assertEqual(rval, decimal.Decimal('1.1'))

12345678910>>...19