File tree Expand file tree Collapse file tree 5 files changed +14
-6
lines changed 
lib/node_modules/@stdlib/stats/base/dists/geometric/median Expand file tree Collapse file tree 5 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 1919#include  "stdlib/stats/base/dists/geometric/median.h" 
2020#include  <stdlib.h> 
2121#include  <stdio.h> 
22- #include  <math.h> 
2322
2423static  double  random_uniform ( const  double  min , const  double  max  ) {
2524	double  v  =  (double )rand () / ( (double )RAND_MAX  +  1.0  );
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ var log2 = require( '@stdlib/math/base/special/log2' );
5252function  median (  p  )  { 
5353	if  ( 
5454		isnan (  p  )  || 
55- 		p  <=   0.0  || 
55+ 		p  <  0.0  || 
5656		p  >  1.0 
5757	)  { 
5858		return  NaN ; 
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ var addon = require( './../src/addon.node' );
2828/** 
2929* Returns the median of a geometric distribution. 
3030* 
31+ * @private  
3132* @param  {Probability } p - success probability 
3233* @returns  {NonNegativeInteger } median 
3334* 
Original file line number Diff line number Diff line change 3939      "libpath" : [],
4040      "dependencies" : [
4141        " @stdlib/math/base/napi/unary" 
42-         " @stdlib/math/base/assert/is-nan" 
42+         " @stdlib/math/base/assert/is-nan" 
43+         " @stdlib/math/base/special/ceil" 
44+         " @stdlib/math/base/special/log2" 
4345      ]
4446    },
4547    {
5456      "libraries" : [],
5557      "libpath" : [],
5658      "dependencies" : [
57-         " @stdlib/math/base/assert/is-nan" 
59+         " @stdlib/math/base/assert/is-nan" 
60+         " @stdlib/math/base/special/ceil" 
61+         " @stdlib/math/base/special/log2" 
5862      ]
5963    },
6064    {
6973      "libraries" : [],
7074      "libpath" : [],
7175      "dependencies" : [
72-         " @stdlib/math/base/assert/is-nan" 
76+         " @stdlib/math/base/assert/is-nan" 
77+         " @stdlib/math/base/special/ceil" 
78+         " @stdlib/math/base/special/log2" 
7379      ]
7480    }
7581  ]
Original file line number Diff line number Diff line change 1818
1919#include  "stdlib/stats/base/dists/geometric/median.h" 
2020#include  "stdlib/math/base/assert/is_nan.h" 
21+ #include  "stdlib/math/base/special/ceil.h" 
22+ #include  "stdlib/math/base/special/log2.h" 
2123#include  <math.h> 
2224
2325/** 
@@ -38,5 +40,5 @@ double stdlib_base_dists_geometric_median( const double p ) {
3840	) {
3941		return  0.0  / 0.0 ; // NaN 
4042	}
41- 	return  ceil ( -1.0  / ( log2 ( 1.0  -  p  ) ) ) -  1.0 ;
43+ 	return  stdlib_base_ceil ( -1.0  / ( stdlib_base_log2 ( 1.0  -  p  ) ) ) -  1.0 ;
4244}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments