S3518 reporting division by zero with double as throwing arithmetic exception

Server Version 6.7.4 (build 38452)
SonarJava 5.8

‘’’ return ((double) variable1 / (double) variable2 > CONSTANT);’’’

as a potential division by zero throwing an arithmetic exception …
… but division by zero with doubles either returns Nan or Infinity; no exception is ever thrown.

Hi @stephenrpalmer,

Your analysis is spot on, ticket created to handle the issue: https://jira.sonarsource.com/browse/SONARJAVA-3026

Thanks for the feedback,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.