Sonar fix: Replace x != x with Double.isNaN
This commit is contained in:
parent
e97c3288a5
commit
f6fe96b23f
|
@ -288,7 +288,7 @@ public class Dfp implements RealFieldElement<Dfp> {
|
||||||
|
|
||||||
if (exponent == 1024) {
|
if (exponent == 1024) {
|
||||||
// infinity or NAN
|
// infinity or NAN
|
||||||
if (x != x) {
|
if (Double.isNaN(x)) {
|
||||||
sign = (byte) 1;
|
sign = (byte) 1;
|
||||||
nans = QNAN;
|
nans = QNAN;
|
||||||
} else if (x < 0) {
|
} else if (x < 0) {
|
||||||
|
|
|
@ -636,7 +636,7 @@ final class AccurateMathCalc {
|
||||||
* @return formatted number
|
* @return formatted number
|
||||||
*/
|
*/
|
||||||
static String format(double d) {
|
static String format(double d) {
|
||||||
if (d != d) {
|
if (Double.isNaN(d)) {
|
||||||
return "Double.NaN,";
|
return "Double.NaN,";
|
||||||
} else {
|
} else {
|
||||||
return ((d >= 0) ? "+" : "") + Double.toString(d) + "d,";
|
return ((d >= 0) ? "+" : "") + Double.toString(d) + "d,";
|
||||||
|
|
Loading…
Reference in New Issue