Java

Java

Made by DeepSource

Float precision math may be imprecise JAVA-S0041

Anti-pattern
Minor

The method performs math operations using floating point precision. Floating point precision is very imprecise.

Examples

Bad Practice

assert 16777216.0f + 1.0f == 16777216.0f; // This will not trigger an error!

Consider using double math instead.

Recommended

assert 16777216.0 + 1.0 == 16777217.0;

References