Lines Matching full:decimal
353 .. _tut-decimal-fp:
355 Decimal Floating Point Arithmetic
358 The :mod:`decimal` module offers a :class:`~decimal.Decimal` datatype for
359 decimal floating point arithmetic. Compared to the built-in :class:`float`
362 * financial applications and other uses which require exact decimal
366 * tracking of significant decimal places, or
371 results in decimal floating point and binary floating point. The difference
374 >>> from decimal import *
375 >>> round(Decimal('0.70') * Decimal('1.05'), 2)
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
384 decimal quantities.
386 Exact representation enables the :class:`~decimal.Decimal` class to perform
390 >>> Decimal('1.00') % Decimal('.10')
391 Decimal('0.00')
395 >>> sum([Decimal('0.1')]*10) == Decimal('1.0')
400 The :mod:`decimal` module provides arithmetic with as much precision as needed::
403 >>> Decimal(1) / Decimal(7)
404 Decimal('0.142857142857142857142857142857142857')