mathematics his describes modules for performing various kinds of mathematical operations in additionthe decimal modulewhich provides generalized support for decimal floating-point numbersis described decimal the python float data type is represented using double-precision binary floatingpoint encoding (usually as defined by the ieee standarda subtle consequence of this encoding is that decimal values such as can' be represented exactly insteadthe closest value is this inexactness carries over to calculations involving floating-point numbers and can sometimes lead to unexpected results (for example * = evaluates as falsethe decimal module provides an implementation of the ibm general decimal arithmetic standardwhich allows for the exact representation of decimals it also gives precise control over mathematical precisionsignificant digitsand rounding behavior these features can be useful if interacting with external systems that precisely define properties of decimal numbers for exampleif writing python programs that must interact with business applications the decimal module defines two basic data typesa decimal type that represents decimal number and context type that represents various parameters concerning computation such as precision and round-off error-handling here are few simple examples that illustrate the basics of how the module worksimport decimal decimal decimal(' ' decimal decimal(' 'create some decimal numbers perform some math calculations using the default context decimal decimal(' ' decimal decimal(' 'change the precision and perform calculations decimal getcontext(prec decimal decimal(' ' decimal decimal(' 'change the precision for just single block of statements with decimal localcontext(decimal context(prec= )) decimal decimal(' ' decimal decimal(' ' lib fl ff