Skip to content

Commit 49af9bd

Browse files
authored
refactor: hard-code constant instead of dynamically evaluating it
Signed-off-by: Philipp Burckhardt <[email protected]>
1 parent e2332cc commit 49af9bd

File tree

1 file changed

+2
-3
lines changed
  • lib/node_modules/@stdlib/stats/base/dists/levy/median/src

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "stdlib/math/base/special/erfcinv.h"
2222
#include "stdlib/math/base/special/pow.h"
2323

24-
static double DENOM ;
24+
static const double DENOM = 0.4549364231195728; // 2.0 * stdlib_base_pow( stdlib_base_erfcinv( 0.5 ), 2.0 )
2525

2626
/**
2727
* Returns the median for a Lévy distribution with location `mu` and scale `c`.
@@ -31,11 +31,10 @@ static double DENOM ;
3131
* @return median
3232
*
3333
* @example
34-
* double y = stdlib_base_levy_median( 9.0, 0.0, 10.0 );
34+
* double y = stdlib_base_dists_levy_median( 9.0, 0.0, 10.0 );
3535
* // returns ~0.795
3636
*/
3737
double stdlib_base_dists_levy_median( const double mu, const double c ) {
38-
DENOM = 2.0 * stdlib_base_pow( stdlib_base_erfcinv( 0.5 ), 2.0 );
3938
if (
4039
stdlib_base_is_nan( mu ) ||
4140
stdlib_base_is_nan( c ) ||

0 commit comments

Comments
 (0)