Does Python always round floats to 10 decimal places like in this exercise? What if you were working with very precise numbers and you needed more? Would you work in terms of e/powers of 10 (e.g. 0.123456789123 could be written as 12.3456789123e-2) or is there a module you could use?

1 Like

The rounding is platform-specific. 16 places is most common.

You can use notation such as 66e10 and Python will understand it and even change it to proper scientific notation: 6.6e11. It is the default for very small floats.

There is a built-in **decimal** module that works directly with decimal floating point arithmetic, rather than translating from binary (which is the underlying cause of most floating point errors, rather than simply â€śnumber of placesâ€ť), and there are many third-party modules available, one called **bigfloat**.

1 Like