Lines Matching full:decimal
352 .. _tut-decimal-fp:
354 Decimal Floating Point Arithmetic
357 The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
358 decimal floating point arithmetic. Compared to the built-in :class:`float`
361 * financial applications and other uses which require exact decimal
365 * tracking of significant decimal places, or
370 results in decimal floating point and binary floating point. The difference
373 >>> from decimal import *
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
383 decimal quantities.
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')
399 The :mod:`decimal` module provides arithmetic with as much precision as needed::
402 >>> Decimal(1) / Decimal(7)
403 Decimal('0.142857142857142857142857142857142857')