File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed
lib/node_modules/@stdlib/math/base/special/rsqrtf Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ var sqrt = require( '@stdlib/math/base/special/sqrt' );
53
53
* // returns NaN
54
54
*/
55
55
function rsqrtf ( x ) {
56
+ // As the square root is a fundamental numerical operation, compute in extended precision in order to avoid precision loss:
56
57
return float64ToFloat32 ( 1.0 / sqrt ( float64ToFloat32 ( x ) ) ) ;
57
58
}
58
59
Original file line number Diff line number Diff line change 39
39
"libpath" : [],
40
40
"dependencies" : [
41
41
" @stdlib/math/base/napi/unary" ,
42
- " @stdlib/math/base/special/sqrtf "
42
+ " @stdlib/math/base/special/sqrt "
43
43
]
44
44
},
45
45
{
55
55
],
56
56
"libpath" : [],
57
57
"dependencies" : [
58
- " @stdlib/math/base/special/sqrtf "
58
+ " @stdlib/math/base/special/sqrt "
59
59
]
60
60
},
61
61
{
71
71
],
72
72
"libpath" : [],
73
73
"dependencies" : [
74
- " @stdlib/math/base/special/sqrtf "
74
+ " @stdlib/math/base/special/sqrt "
75
75
]
76
76
}
77
77
]
Original file line number Diff line number Diff line change 17
17
*/
18
18
19
19
#include "stdlib/math/base/special/rsqrtf.h"
20
- #include "stdlib/math/base/special/sqrtf .h"
20
+ #include "stdlib/math/base/special/sqrt .h"
21
21
22
22
/**
23
23
* Computes the reciprocal square root of a single-precision floating-point number.
30
30
* // returns 0.5
31
31
*/
32
32
float stdlib_base_rsqrtf ( const float x ) {
33
- return 1.0f / stdlib_base_sqrtf ( x );
33
+ // As the square root is a fundamental numerical operation, compute in extended precision in order to avoid precision loss:
34
+ return 1.0f / stdlib_base_sqrt ( x );
34
35
}
You can’t perform that action at this time.
0 commit comments