Skip to content

Commit

Permalink
Test product with non-finite values and zero/non-zero
Browse files Browse the repository at this point in the history
  • Loading branch information
aherbert committed Oct 15, 2023
1 parent 79cf97b commit c5d9488
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,16 @@ void setup() {
final double b = Double.POSITIVE_INFINITY;
final double c = Double.NEGATIVE_INFINITY;
final double[][] nonFinite = {
{a, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{b, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{c, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{a, a, 0, 0, 0, 0, 0, 0, 0, 0},
{b, b, 0, 0, 0, 0, 0, 0, 0, 0},
{c, c, 0, 0, 0, 0, 0, 0, 0, 0},
{a, b, 0, 0, 0, 0, 0, 0, 0, 0},
{a, c, 0, 0, 0, 0, 0, 0, 0, 0},
{b, c, 0, 0, 0, 0, 0, 0, 0, 0},
{a, b, c, 0, 0, 0, 0, 0, 0, 0},
{a, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{b, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{c, 1, 1, 1, 1, 1, 1, 1, 1, 1},
{a, a, 1, 1, 1, 1, 1, 1, 1, 1},
{b, b, 1, 1, 1, 1, 1, 1, 1, 1},
{c, c, 1, 1, 1, 1, 1, 1, 1, 1},
{a, b, 1, 1, 1, 1, 1, 1, 1, 1},
{a, c, 1, 1, 1, 1, 1, 1, 1, 1},
{b, c, 1, 1, 1, 1, 1, 1, 1, 1},
{a, b, c, 1, 1, 1, 1, 1, 1, 1},
};
Stream.of(nonFinite).forEach(values -> {
final double[] sample = values.clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ protected DoubleTolerance getTolerance() {
@Override
protected Stream<StatisticTestData> streamTestData() {
final Stream.Builder<StatisticTestData> builder = Stream.builder();
// inf * 0 = NaN
builder.accept(addCase(Double.POSITIVE_INFINITY, 0));
builder.accept(addCase(Double.NEGATIVE_INFINITY, 0));
// Python Numpy v1.25.1: numpy.product
builder.accept(addReference(24.0, DoubleTolerances.ulps(1), 1, 2, 3, 4));
builder.accept(addReference(3081078000.0, DoubleTolerances.ulps(1), 5, 9, 13, 14, 10, 12, 11, 15, 19));
Expand Down

0 comments on commit c5d9488

Please sign in to comment.