Lines Matching full:decimal
11 fractions. For example, the decimal fraction ::
23 Unfortunately, most decimal fractions cannot be represented exactly as binary
24 fractions. A consequence is that, in general, the decimal floating-point
46 decimal value 0.1 cannot be represented exactly as a base 2 fraction. In base
54 for a Python float, so the value stored internally when you enter the decimal
62 decimal fraction, because of the way that floats are displayed at the
63 interpreter prompt. Python only prints a decimal approximation to the true
64 decimal value of the binary approximation stored by the machine. If Python
65 were to print the true decimal value of the binary approximation stored for
92 value 2.675 to two decimal places, you get this ::
98 to the nearest value, rounding ties away from zero. Since the decimal fraction
101 decimal string ``2.675`` is converted to a binary floating-point number, it's
109 If you're in a situation where you care which way your decimal halfway-cases
110 are rounded, you should consider using the :mod:`decimal` module.
111 Incidentally, the :mod:`decimal` module also provides a nice way to "see" the
114 >>> from decimal import Decimal
115 >>> Decimal(2.675)
116 Decimal('2.67499999999999982236431605997495353221893310546875')
137 tasks, but you do need to keep in mind that it's not decimal arithmetic, and
142 display of your final results to the number of decimal digits you expect. For
157 decimal fractions cannot be represented exactly as binary (base 2) fractions.
159 others) often won't display the exact decimal number you expect::
216 its 30 most significant decimal digits::
222 the decimal value 0.100000000000000005551115123125. In versions prior to
225 based on the shortest decimal fraction that rounds correctly back to the true