float (TP011)#
Automatic fix is available.
What it does#
Checks for usage of float types.
Why not?#
Floating point types are inexact, variable-precision numeric types. Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and retrieving a value might show slight discrepancies.
Comparing two floating-point values for equality might not always work as expected.
When should you?#
When approximates are acceptable, no comparison for equality is needed.
Use instead:#
- numeric
- decimal