Sonar fix: Replace x != x with Double.isNaN

This commit is contained in:
Alex Herbert 2021-08-18 18:30:53 +01:00
parent e97c3288a5
commit f6fe96b23f
2 changed files with 2 additions and 2 deletions

View File

@ -288,7 +288,7 @@ public class Dfp implements RealFieldElement<Dfp> {
if (exponent == 1024) {
// infinity or NAN
if (x != x) {
if (Double.isNaN(x)) {
sign = (byte) 1;
nans = QNAN;
} else if (x < 0) {

View File

@ -636,7 +636,7 @@ final class AccurateMathCalc {
* @return formatted number
*/
static String format(double d) {
if (d != d) {
if (Double.isNaN(d)) {
return "Double.NaN,";
} else {
return ((d >= 0) ? "+" : "") + Double.toString(d) + "d,";