Skip to content

Commit ee16fc8

Browse files
chore: added new test and C implementation
1 parent bb1706f commit ee16fc8

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

lib/node_modules/@stdlib/stats/base/dists/binomial/median/benchmark/benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2024 The Stdlib Authors.
4+
* Copyright (c) 2018 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

lib/node_modules/@stdlib/stats/base/dists/binomial/median/manifest.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"libpath": [],
4040
"dependencies": [
4141
"@stdlib/math/base/napi/binary",
42-
"@stdlib/math/base/assert/is-nan"
42+
"@stdlib/math/base/assert/is-nan",
43+
"@stdlib/math/base/assert/is-nonnegative-integerf"
4344
]
4445
},
4546
{
@@ -54,7 +55,8 @@
5455
"libraries": [],
5556
"libpath": [],
5657
"dependencies": [
57-
"@stdlib/math/base/assert/is-nan"
58+
"@stdlib/math/base/assert/is-nan",
59+
"@stdlib/math/base/assert/is-nonnegative-integerf"
5860
]
5961
},
6062
{
@@ -69,7 +71,8 @@
6971
"libraries": [],
7072
"libpath": [],
7173
"dependencies": [
72-
"@stdlib/math/base/assert/is-nan"
74+
"@stdlib/math/base/assert/is-nan",
75+
"@stdlib/math/base/assert/is-nonnegative-integerf"
7376
]
7477
}
7578
]

lib/node_modules/@stdlib/stats/base/dists/binomial/median/src/main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include "stdlib/stats/base/dists/binomial/median.h"
2020
#include "stdlib/math/base/assert/is_nan.h"
21+
#include "stdlib/math/base/assert/is_nonnegative_integerf.h"
2122
#include <math.h>
2223

2324
/**
@@ -38,9 +39,12 @@
3839
double stdlib_base_dists_binomial_median( const double n, const double p ) {
3940
if (
4041
stdlib_base_is_nan( p ) ||
42+
stdlib_base_is_nan( n ) ||
43+
!stdlib_base_is_nonnegative_integerf( n ) ||
4144
p < 0.0 ||
4245
p > 1.0 ||
43-
n < 0
46+
n < 0 ||
47+
n > 1.0e6
4448
) {
4549
return 0.0 / 0.0; // NaN
4650
}

0 commit comments

Comments
 (0)