Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: REM cost reform

...

Converting integer values to floating-point types whose mantissa has fewer bits than the original integer value can result in a rounding error.

Rule

Severity

Likelihood

Detectable

RepairableRemediation Cost

Priority

Level

NUM13-J

Low

Unlikely

No

NoMedium

P2P1

L3

Automated Detection

Automatic detection of casts that can lose precision is straightforward. Sound determination of whether those casts correctly reflect the intent of the programmer is infeasible in the general case. Heuristic warnings could be useful.

ToolVersionCheckerDescription
CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

JAVA.CAST.FTRUNC

Cast: integer to floating point

Parasoft Jtest
Include Page
Parasoft_V
Parasoft_V
CERT.NUM13.AICAvoid implicit casts from integer data types to floating point data types
PVS-Studio

Include Page
PVS-Studio_V
PVS-Studio_V

V6011

...