Skip to content

Commit

Permalink
Consistent constant names and values
Browse files Browse the repository at this point in the history
  • Loading branch information
aherbert committed Oct 23, 2021
1 parent 481e922 commit 1a70cb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/
public final class NormalDistribution extends AbstractContinuousDistribution {
/** 0.5 * ln(2 * pi). Computed to 25-digits precision. */
private static final double HALF_LOG_2_PI = 0.9189385332046727417803297;
private static final double HALF_LOG_TWO_PI = 0.9189385332046727417803297;

/** Mean of this distribution. */
private final double mean;
Expand Down Expand Up @@ -58,7 +58,7 @@ private NormalDistribution(double mean,
double sd) {
this.mean = mean;
standardDeviation = sd;
logStandardDeviationPlusHalfLog2Pi = Math.log(sd) + HALF_LOG_2_PI;
logStandardDeviationPlusHalfLog2Pi = Math.log(sd) + HALF_LOG_TWO_PI;
// Minimise rounding error by computing sqrt(2 * sd * sd) exactly.
// Compute using extended precision with care to avoid over/underflow.
sdSqrt2 = ExtendedPrecision.sqrt2xx(sd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
* Implementation of the <a href="http://en.wikipedia.org/wiki/Poisson_distribution">Poisson distribution</a>.
*/
public final class PoissonDistribution extends AbstractDiscreteDistribution {
/** 0.5 * ln(2 &pi;). */
private static final double HALF_LOG_TWO_PI = 0.5 * Math.log(2 * Math.PI);
/** 0.5 * ln(2 * pi). Computed to 25-digits precision. */
private static final double HALF_LOG_TWO_PI = 0.9189385332046727417803297;
/** Default maximum number of iterations. */
private static final int DEFAULT_MAX_ITERATIONS = 10000000;
/** Default convergence criterion. */
Expand Down

0 comments on commit 1a70cb0

Please sign in to comment.