Skip to content

Commit 4eb9aea

Browse files
refactor: replace fabs with stdlib_base_abs in C implementation of blas/ext/base/dapxsumkbn
PR-URL: #3214 Reviewed-by: Athan Reines <[email protected]> Co-authored-by: stdlib-bot <[email protected]>
1 parent 49f4678 commit 4eb9aea

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/manifest.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"@stdlib/napi/argv-int64",
4444
"@stdlib/napi/argv-double",
4545
"@stdlib/napi/argv-strided-float64array",
46-
"@stdlib/napi/create-double"
46+
"@stdlib/napi/create-double",
47+
"@stdlib/math/base/special/abs"
4748
]
4849
},
4950
{
@@ -58,7 +59,8 @@
5859
"libpath": [],
5960
"dependencies": [
6061
"@stdlib/blas/base/shared",
61-
"@stdlib/strided/base/stride2offset"
62+
"@stdlib/strided/base/stride2offset",
63+
"@stdlib/math/base/special/abs"
6264
]
6365
},
6466
{
@@ -73,7 +75,8 @@
7375
"libpath": [],
7476
"dependencies": [
7577
"@stdlib/blas/base/shared",
76-
"@stdlib/strided/base/stride2offset"
78+
"@stdlib/strided/base/stride2offset",
79+
"@stdlib/math/base/special/abs"
7780
]
7881
}
7982
]

lib/node_modules/@stdlib/blas/ext/base/dapxsumkbn/src/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "stdlib/blas/ext/base/dapxsumkbn.h"
2020
#include "stdlib/blas/base/shared.h"
2121
#include "stdlib/strided/base/stride2offset.h"
22-
#include <math.h>
22+
#include "stdlib/math/base/special/abs.h"
2323

2424
/**
2525
* Adds a scalar constant to each double-precision floating-point strided array element and computes the sum using an improved Kahan–Babuška algorithm.
@@ -72,7 +72,7 @@ double API_SUFFIX(stdlib_strided_dapxsumkbn_ndarray)( const CBLAS_INT N, const d
7272
for ( i = 0; i < N; i++ ) {
7373
v = alpha + X[ ix ];
7474
t = sum + v;
75-
if ( fabs( sum ) >= fabs( v ) ) {
75+
if ( stdlib_base_abs( sum ) >= stdlib_base_abs( v ) ) {
7676
c += (sum-t) + v;
7777
} else {
7878
c += (v-t) + sum;

0 commit comments

Comments
 (0)