Skip to content

Commit 3248c7e

Browse files
committed
fix: use STDLIB_CONSTANT_FLOAT64_SQRT_TWO instead of recomputing sqrt(2)
1 parent 2e43df0 commit 3248c7e

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

lib/node_modules/@stdlib/stats/base/dists/normal/quantile/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ for ( i = 0; i < 10; i++ ) {
152152

153153
<!-- /.examples -->
154154

155-
<!-- 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. -->
156-
157-
<section class="references">
158-
159155
<!-- C interface documentation. -->
160156

161157
* * *
@@ -249,8 +245,14 @@ int main( void ) {
249245

250246
</section>
251247

248+
<!-- /.c -->
249+
252250
<!-- /.references -->
253251

252+
<!-- 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. -->
253+
254+
<section class="references">
255+
254256
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
255257

256258
<section class="related">

lib/node_modules/@stdlib/stats/base/dists/normal/quantile/benchmark/c/benchmark.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ static double random_uniform( const double min, const double max ) {
9393
* @return elapsed time in seconds
9494
*/
9595
static double benchmark( void ) {
96-
double elapsed;
9796
double p[ 100 ];
9897
double mu[ 100 ];
9998
double sigma[ 100 ];
99+
double elapsed;
100100
double y;
101101
double t;
102102
int i;

lib/node_modules/@stdlib/stats/base/dists/normal/quantile/src/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818

1919
#include "stdlib/stats/base/dists/normal/quantile.h"
2020
#include "stdlib/math/base/assert/is_nan.h"
21-
#include "stdlib/math/base/special/sqrt.h"
2221
#include "stdlib/math/base/special/erfinv.h"
22+
#include "stdlib/constants/float64/sqrt_two.h"
23+
24+
2325

2426
/**
2527
* Evaluates the quantile function for a normal distribution with mean `mu` and standard deviation `sigma` at a probability `p`.
@@ -47,5 +49,5 @@ double stdlib_base_dists_normal_quantile( const double p, const double mu, const
4749
if ( sigma == 0.0 ) {
4850
return mu;
4951
}
50-
return mu + ( ( sigma * stdlib_base_sqrt( 2.0 ) ) * stdlib_base_erfinv( ( 2.0 * p ) - 1.0 ) );
52+
return mu + ( ( sigma * STDLIB_CONSTANT_FLOAT64_SQRT_TWO ) * stdlib_base_erfinv( ( 2.0 * p ) - 1.0 ) );
5153
}

stdlib

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 77c2bfdf819a4efe39648942bbecc931b846453d

0 commit comments

Comments
 (0)