aherbert commented on code in PR #217:
URL: https://github.com/apache/commons-math/pull/217#discussion_r1002012928
##########
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/SparseGradient.java:
##########
@@ -382,7 +360,7 @@ public SparseGradient signum() {
public SparseGradient copySign(final SparseGradient sign) {
final long m = Double.doubleToLongBits(value);
final long s = Double.doubleToLongBits(sign.value);
- if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
Review Comment:
Didn't notice this before. I would not remove the extra parentheses as it
makes it obvious over knowing the operator precedence of && over ||.
##########
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/fitting/SimpleCurveFitter.java:
##########
@@ -318,8 +317,8 @@ private WeightedObservedPoint[]
getInterpolationPointsForY(WeightedObservedPoint
private boolean isBetween(double value,
double boundary1,
double boundary2) {
- return (value >= boundary1 && value <= boundary2) ||
Review Comment:
Please revert
##########
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/analysis/differentiation/SparseGradient.java:
##########
@@ -393,7 +371,7 @@ public SparseGradient copySign(final SparseGradient sign) {
public SparseGradient copySign(final double sign) {
final long m = Double.doubleToLongBits(value);
final long s = Double.doubleToLongBits(sign);
- if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
Review Comment:
Again please revert
##########
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/ode/nonstiff/AdamsNordsieckFieldTransformer.java:
##########
@@ -170,9 +170,9 @@ private AdamsNordsieckFieldTransformer(final Field<T>
field, final int n) {
// Nordsieck to multistep, then shifting rows to represent step advance
// then applying inverse transform
T[][] shiftedP = bigP.getData();
- for (int i = shiftedP.length - 1; i > 0; --i) {
- // shift rows
- shiftedP[i] = shiftedP[i - 1];
+ // shift rows
+ if (shiftedP.length - 1 >= 0) {
Review Comment:
use `> 0`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]