Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–102 unchanged (102 lines)
103 * @return CDF evaluted at <code>x</code>.
104 * @throws MathException if the algorithm fails to converge; unless
105 * x is more than 20 standard deviations from the mean, in which case the
106 * convergence exception is caught and 0 or 1 is returned.
107 */
108 public double cumulativeProbability(double x) throws MathException {
109 return 0.5 * (1.0 + Erf.erf((x - mean) /
110 (standardDeviation * Math.sqrt(2.0))));
111 }
112
113 /**
114 * For this distribution, X, this method returns the critical point x, such
115 * that P(X &lt; x) = <code>p</code>.
116 * <p>
117 * Returns <code>Double.NEGATIVE_INFINITY</code> for p=0 and
…lines 118–202 unchanged (85 lines)

After

…lines 1–102 unchanged (102 lines)
103 * @return CDF evaluted at <code>x</code>.
104 * @throws MathException if the algorithm fails to converge; unless
105 * x is more than 20 standard deviations from the mean, in which case the
106 * convergence exception is caught and 0 or 1 is returned.
107 */
108 public double cumulativeProbability(double x) throws MathException {
109 try {
110 return 0.5 * (1.0 + Erf.erf((x - mean) /
111 (standardDeviation * Math.sqrt(2.0))));
112 } catch (MaxIterationsExceededException ex) {
113 if (x < (mean - 20 * standardDeviation)) { // JDK 1.5 blows at 38
114 return 0.0d;
115 } else if (x > (mean + 20 * standardDeviation)) {
116 return 1.0d;
117 } else {
118 throw ex;
119 }
120 }
121 }
122
123 /**
124 * For this distribution, X, this method returns the critical point x, such
125 * that P(X &lt; x) = <code>p</code>.
126 * <p>
…lines 127–212 unchanged (86 lines)

Before

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MathException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MaxIterationsExceededException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "special"
. "."
identifier "Erf"
; ";"
block_comment "/**\n * Default implementation of\n * {@link org.apache.common"...
class_declaration
modifiers
public "public"
class "class"
identifier "NormalDistributionImpl"
superclass
extends "extends"
type_identifier "AbstractContinuousDistribution"
super_interfaces
implements "implements"
type_list
type_identifier "NormalDistribution"
, ","
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "8589540077390120676L"
; ";"
block_comment "/** The mean of this distribution. */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "mean"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** The standard deviation of this distribution. */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "standardDeviation"
= "="
decimal_integer_literal "1"
; ";"
block_comment "/**\n * Create a normal distribution using the given mean"...
constructor_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates normal distribution with the mean equal t"...
constructor_declaration
modifiers
public "public"
identifier "NormalDistributionImpl"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
decimal_floating_point_literal "0.0"
, ","
decimal_floating_point_literal "1.0"
) ")"
; ";"
} "}"
block_comment "/**\n * Access the mean.\n * @return mean for this dis"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getMean"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "mean"
; ";"
} "}"
block_comment "/**\n * Modify the mean.\n * @param mean for this dist"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Access the standard deviation.\n * @return sta"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getStandardDeviation"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "standardDeviation"
; ";"
} "}"
block_comment "/**\n * Modify the standard deviation.\n * @param sd s"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n * For this disbution, X, this method returns P(X &l"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "cumulativeProbability"
formal_parameters
( "("
formal_parameter
floating_point_type
double "double"
identifier "x"
) ")"
throws
throws "throws"
type_identifier "MathException"
block
{ "{"
return_statement (+42 nodes collapsed)
} "}"
block_comment "/**\n * For this distribution, X, this method returns the"...
method_declaration (+70 nodes collapsed)
block_comment "/**\n * Access the domain value lower bound, based on <co"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Access the domain value upper bound, based on <co"...
method_declaration (+61 nodes collapsed)
block_comment "/**\n * Access the initial domain value, based on <code>p"...
method_declaration (+99 nodes collapsed)
} "}"

After

program
block_comment "/*\n * Licensed to the Apache Software Foundation (ASF) under"...
package_declaration
package "package"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "distribution"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
identifier "java"
. "."
identifier "io"
. "."
identifier "Serializable"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MathException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "MaxIterationsExceededException"
; ";"
import_declaration
import "import"
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
scoped_identifier
identifier "org"
. "."
identifier "apache"
. "."
identifier "commons"
. "."
identifier "math"
. "."
identifier "special"
. "."
identifier "Erf"
; ";"
block_comment "/**\n * Default implementation of\n * {@link org.apache.common"...
class_declaration
modifiers
public "public"
class "class"
identifier "NormalDistributionImpl"
superclass
extends "extends"
type_identifier "AbstractContinuousDistribution"
super_interfaces
implements "implements"
type_list
type_identifier "NormalDistribution"
, ","
type_identifier "Serializable"
class_body
{ "{"
block_comment "/** Serializable version identifier */"
field_declaration
modifiers
private "private"
static "static"
final "final"
integral_type
long "long"
variable_declarator
identifier "serialVersionUID"
= "="
decimal_integer_literal "8589540077390120676L"
; ";"
block_comment "/** The mean of this distribution. */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "mean"
= "="
decimal_integer_literal "0"
; ";"
block_comment "/** The standard deviation of this distribution. */"
field_declaration
modifiers
private "private"
floating_point_type
double "double"
variable_declarator
identifier "standardDeviation"
= "="
decimal_integer_literal "1"
; ";"
block_comment "/**\n * Create a normal distribution using the given mean"...
constructor_declaration (+41 nodes collapsed)
block_comment "/**\n * Creates normal distribution with the mean equal t"...
constructor_declaration
modifiers
public "public"
identifier "NormalDistributionImpl"
formal_parameters
( "("
) ")"
constructor_body
{ "{"
explicit_constructor_invocation
this "this"
argument_list
( "("
decimal_floating_point_literal "0.0"
, ","
decimal_floating_point_literal "1.0"
) ")"
; ";"
} "}"
block_comment "/**\n * Access the mean.\n * @return mean for this dis"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getMean"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "mean"
; ";"
} "}"
block_comment "/**\n * Modify the mean.\n * @param mean for this dist"...
method_declaration (+24 nodes collapsed)
block_comment "/**\n * Access the standard deviation.\n * @return sta"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "getStandardDeviation"
formal_parameters
( "("
) ")"
block
{ "{"
return_statement
return "return"
identifier "standardDeviation"
; ";"
} "}"
block_comment "/**\n * Modify the standard deviation.\n * @param sd s"...
method_declaration (+46 nodes collapsed)
block_comment "/**\n * For this disbution, X, this method returns P(X &l"...
method_declaration
modifiers
public "public"
floating_point_type
double "double"
identifier "cumulativeProbability"
formal_parameters
( "("
formal_parameter
floating_point_type
double "double"
identifier "x"
) ")"
throws
throws "throws"
type_identifier "MathException"
block
{ "{"
try_statement
try "try"
block
{ "{"
return_statement (+42 nodes collapsed)
} "}"
catch_clause
catch "catch"
( "("
catch_formal_parameter
catch_type
type_identifier "MaxIterationsExceededException"
identifier "ex"
) ")"
block
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "x"
< "<"
parenthesized_expression
( "("
binary_expression
identifier "mean"
- "-"
binary_expression
decimal_integer_literal "20"
* "*"
identifier "standardDeviation"
) ")"
) ")"
block
{ "{"
line_comment "// JDK 1.5 blows at 38"
return_statement
return "return"
decimal_floating_point_literal "0.0d"
; ";"
} "}"
else "else"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
identifier "x"
> ">"
parenthesized_expression
( "("
binary_expression
identifier "mean"
+ "+"
binary_expression
decimal_integer_literal "20"
* "*"
identifier "standardDeviation"
) ")"
) ")"
block
{ "{"
return_statement
return "return"
decimal_floating_point_literal "1.0d"
; ";"
} "}"
else "else"
block
{ "{"
throw_statement
throw "throw"
identifier "ex"
; ";"
} "}"
} "}"
} "}"
block_comment "/**\n * For this distribution, X, this method returns the"...
method_declaration (+70 nodes collapsed)
block_comment "/**\n * Access the domain value lower bound, based on <co"...
method_declaration (+63 nodes collapsed)
block_comment "/**\n * Access the domain value upper bound, based on <co"...
method_declaration (+61 nodes collapsed)
block_comment "/**\n * Access the initial domain value, based on <code>p"...
method_declaration (+99 nodes collapsed)
} "}"