Skip to content
Permalink
Browse files
Simplify returns.
  • Loading branch information
arturobernalg committed May 26, 2022
1 parent f97c0f8 commit e674857954c2f8589392f125fe668f341da16a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
@@ -117,7 +117,7 @@ public SharedStateDiscreteSampler create(UniformRandomProvider rng, double[] pro
public SharedStateDiscreteSampler create(UniformRandomProvider rng, double[] probabilities) {
return MarsagliaTsangWangDiscreteSampler.Enumerated.of(rng, probabilities);
}
};
}
}

/**
@@ -262,7 +262,7 @@ enum Specialisation {
/** Instance of {@link SharedStateSampler}. */
SHARED_STATE_SAMPLER,
/** No specialisation. */
NONE;
NONE
}

/**
@@ -196,17 +196,11 @@ private static boolean validateOpenInterval(double lo, double hi) {
// (MAX_VALUE has all bits set except the most significant sign bit.)
bitsx &= Long.MAX_VALUE;
bitsy &= Long.MAX_VALUE;
if (lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN)) {
return false;
}
} else {
// Same signs, subtraction will count the ULP difference.
// This should be above 1.
if (Math.abs(bitsx - bitsy) < MIN_ULP_SAME_SIGN) {
return false;
}
return !lessThanUnsigned(bitsx + bitsy, MIN_ULP_OPPOSITE_SIGN);
}
return true;
// Same signs, subtraction will count the ULP difference.
// This should be above 1.
return Math.abs(bitsx - bitsy) >= MIN_ULP_SAME_SIGN;
}

/**

0 comments on commit e674857

Please sign in to comment.