Numeric Types and Operations (NUM)
Rules
- NUM00-J. Detect or prevent integer overflow
- NUM01-J. Do not perform bitwise and arithmetic operations on the same data
- NUM02-J. Ensure that division and remainder operations do not result in divide-by-zero errors
- NUM03-J. Use integer types that can fully represent the possible range of unsigned data
- NUM04-J. Do not use floating-point numbers if precise computation is required
- NUM07-J. Do not attempt comparisons with NaN
- NUM08-J. Check floating-point inputs for exceptional values
- NUM09-J. Do not use floating-point variables as loop counters
- NUM10-J. Do not construct BigDecimal objects from floating-point literals
- NUM11-J. Do not compare or inspect the string representation of floating-point values
- NUM12-J. Ensure conversions of numeric types to narrower types do not result in lost or misinterpreted data
- NUM13-J. Avoid loss of precision when converting primitive integers to floating-point
- NUM14-J. Use shift operators correctly
Risk Assessment Summary
| Rule | Severity | Likelihood | Detectable | Repairable | Priority | Level |
|---|---|---|---|---|---|---|
| NUM00-J | Medium | Unlikely | No | No | P2 | L3 |
| NUM01-J | Medium | Unlikely | Yes | No | P4 | L3 |
| NUM02-J | Low | Likely | No | Yes | P6 | L2 |
| NUM03-J | Low | Unlikely | No | No | P1 | L3 |
| NUM04-J | Low | Probable | No | No | P2 | L3 |
| NUM07-J | Low | Probable | Yes | Yes | P6 | L2 |
| NUM08-J | Low | Probable | No | Yes | P4 | L3 |
| NUM09-J | Low | Probable | Yes | No | P4 | L3 |
| NUM10-J | Low | Probable | Yes | Yes | P6 | L2 |
| NUM11-J | Low | Likely | Yes | Yes | P9 | L2 |
| NUM12-J | Low | Unlikely | Yes | Yes | P3 | L3 |
| NUM13-J | Low | Unlikely | No | No | P1 | L3 |
| NUM14-J | Low | Probable | No | No | P2 | L3 |


