Because the official documentation (https://docs.python.org/3/library/decimal.html) comprises more than 35 pages, this section will only provide a brief examination of the decimal module:
-
When using the decimal module, it is a good idea to figure out what the current conditions are and modify them, if needed:
In this case, getcontext tells us the following:
-
- The system is set for 28 places of precision.
- Rounding is to the nearest whole value with ties going to the nearest even integer.
- Emin and Emax are the bottom/top limits allowed for exponents.
- Capital letters are used for designating exponents, for example, 1.2E+12 ...