Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Floats are similar to integers, but they can also include decimal fractions. Float means that the numbers always have a decimal part separated by a dot. The number of decimals is also called precision, e.g.

  • 5.8656345
  • -332.8463463463753646

Normally you do not need very high precisions for your calculations and two or three decimals will be enough in 99% of all cases. Floats and integers can be used together and the result is always a floating number:

...

Code Block
themeEclipse
languagepython
linenumberstrue
int(7.57634) = 7 or int(6.99999) = 6
float(3) = 3.0