Numbers¶
Python supports integer and floating point numbers [1].
Integer¶
Example:
output = 1440
type(output)
# result of a mathematical operation
output = 24 * 60
type(output)
Float¶
Floating point numbers (IEEE 754 double precision floating point numbers on most systems).
Example:
output = 1.23
type(output)
# result of a mathematical operation
output = 1.0 * 2.0
type(output)
# result of a multiplication with an int
output = 24 * 60.0
type(output)
# precision issue
output = 0.1 + 0.1 + 0.1
print(output)
Warning
float must not be used for operations where precision is important!