Skip to content

Commit 33675ed

Browse files
committed
Sonarqube: Only the sign of the result should be examined.
1 parent b6b6691 commit 33675ed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MathModuleBuiltins.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ protected static BigDecimal sqrtBigNumber(BigInteger value) {
174174
@Override
175175
public double doPI(PInt value) {
176176
BigInteger bValue = value.getValue();
177-
checkMathDomainError(bValue.compareTo(BigInteger.ZERO) == -1);
177+
checkMathDomainError(bValue.compareTo(BigInteger.ZERO) < 0);
178178
return sqrtBigNumber(bValue).doubleValue();
179179
}
180180

@@ -1252,7 +1252,7 @@ public abstract static class AcoshNode extends MathDoubleUnaryBuiltinNode {
12521252
@Override
12531253
public double doPI(PInt value) {
12541254
BigInteger bValue = value.getValue();
1255-
checkMathDomainError(bValue.compareTo(BigInteger.ONE) == -1);
1255+
checkMathDomainError(bValue.compareTo(BigInteger.ONE) < 0);
12561256

12571257
BigDecimal sqrt = SqrtNode.sqrtBigNumber(bValue.multiply(bValue).subtract(BigInteger.ONE));
12581258
BigDecimal bd = new BigDecimal(bValue);
@@ -1526,7 +1526,7 @@ public double logDN(double value, @SuppressWarnings("unused") PNone novalue,
15261526
public double logPIN(PInt value, @SuppressWarnings("unused") PNone novalue,
15271527
@Cached("createBinaryProfile()") ConditionProfile doNotFit) {
15281528
BigInteger bValue = value.getValue();
1529-
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) == -1);
1529+
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) < 0);
15301530
return logBigInteger(bValue);
15311531
}
15321532

@@ -1584,7 +1584,7 @@ public double logPID(PInt value, double base,
15841584
@Cached("createBinaryProfile()") ConditionProfile doNotFit,
15851585
@Cached("createBinaryProfile()") ConditionProfile divByZero) {
15861586
BigInteger bValue = value.getValue();
1587-
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) == -1 || base <= 0);
1587+
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) < 0 || base <= 0);
15881588
double logBase = countBase(base, divByZero);
15891589
return logBigInteger(bValue) / logBase;
15901590
}
@@ -1607,7 +1607,7 @@ public double logPIPI(PInt value, PInt base,
16071607
@Cached("createBinaryProfile()") ConditionProfile divByZero) {
16081608
BigInteger bValue = value.getValue();
16091609
BigInteger bBase = base.getValue();
1610-
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) == -1 || bBase.compareTo(BigInteger.ZERO) <= 0);
1610+
raiseMathError(doNotFit, bValue.compareTo(BigInteger.ZERO) < 0 || bBase.compareTo(BigInteger.ZERO) <= 0);
16111611
double logBase = countBase(bBase, divByZero);
16121612
return logBigInteger(bValue) / logBase;
16131613
}

0 commit comments

Comments
 (0)