Skip to content

Fixing5902 #6318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

<!-- C interface documentation. -->

* * *
Expand Down Expand Up @@ -209,7 +205,6 @@ double stdlib_base_dists_geometric_logcdf( const double x, const double p );
#include "stdlib/stats/base/dists/geometric/logcdf.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
Expand All @@ -231,8 +226,17 @@ int main( void ) {
}
```



<!-- /.c -->


<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">
</section>


<!-- /.references -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "stdlib/stats/base/dists/geometric/logcdf.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

static double random_uniform( const double min, const double max ) {
double v = (double)rand() / ( (double)RAND_MAX + 1.0 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,6 @@ for ( i = 0; i < 10; i++ ) {

<!-- /.examples -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

<!-- C interface documentation. -->

* * *
Expand Down Expand Up @@ -211,7 +207,6 @@ double stdlib_base_dists_geometric_logpmf( const double x, const double p );

```c
#include "stdlib/stats/base/dists/geometric/logpmf.h"
#include "stdlib/math/base/special/round.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
Expand All @@ -238,8 +233,14 @@ int main( void ) {

</section>

<!-- /.c -->

<!-- /.references -->

<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="references">

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/math/base/special/ln.h"
#include "stdlib/constants/float64/ninf.h"
#include <math.h>

/**
* Evaluates the logarithm of the probability mass function (PMF) for a geometric distribution with success probability `p` at a value `x`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var uniform = require( '@stdlib/random/base/randu' );
var isnan = require( '@stdlib/math/base/assert/is-nan' );
var EPS = require( '@stdlib/constants/float64/eps' );
var pkg = require( './../package.json' ).name;
Expand All @@ -31,16 +31,24 @@ var median = require( './../lib' );
// MAIN //

bench( pkg, function benchmark( b ) {
var rand = uniform( -50.0, 50.0 );
var randC = uniform( EPS, 20.0 + EPS );
var mu;
var c;
var y;
var i;

mu = new Float64Array(b.iterations );
c = new Float64Array( b.iterations );

for ( i = 0; i < b.iterations; i++ ) {
mu[ i ] = randMu();
c[ i ] = randC();
}

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
mu = ( randu()*100.0 ) - 50.0;
c = ( randu()*20.0 ) + EPS;
y = median( mu, c );
y = median( mu[ i ], c[ i ] );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ tape( 'if provided a nonpositive `c`, the function returns `NaN`', function test
y = median( 2.0, -1.0 );
t.equal( isnan( y ), true, 'returns NaN' );

y = median( 2.0, -1.0 );
t.equal( isnan( y ), true, 'returns NaN' );

y = median( 1.0, NINF );
t.equal( isnan( y ), true, 'returns NaN' );

Expand Down
1 change: 1 addition & 0 deletions stdlib
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here. You need to revisit your Git configuration.

Submodule stdlib added at 77c2bf
Loading