WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8dba89f

Browse files
committed
fix: restore correct includes in main.c - use pow/trunc instead of powf/truncf
1 parent 1cfe041 commit 8dba89f

File tree

1 file changed

+12
-8
lines changed
  • lib/node_modules/@stdlib/math/base/special/truncbf/lib

1 file changed

+12
-8
lines changed

lib/node_modules/@stdlib/math/base/special/truncbf/lib/main.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* you may not use this file except in compliance with the License.
88
* You may obtain a copy of the License at
99
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
10+
* http://www.apache.org/licenses/LICENSE-2.0
1111
*
1212
* Unless required by applicable law or agreed to in writing, software
1313
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,8 +22,8 @@
2222

2323
var isnanf = require( '@stdlib/math/base/assert/is-nanf' );
2424
var isInfinitef = require( '@stdlib/math/base/assert/is-infinitef' );
25-
var powf = require( '@stdlib/math/base/special/powf' );
26-
var truncf = require( '@stdlib/math/base/special/truncf' );
25+
var pow = require( '@stdlib/math/base/special/pow' );
26+
var trunc = require( '@stdlib/math/base/special/trunc' );
2727
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
2828

2929

@@ -39,19 +39,19 @@ var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );
3939
*
4040
* @example
4141
* var v = truncbf( 3.14159, 2, 10 );
42-
* // returns 3.14
42+
* // returns 3.140000104904175
4343
*
4444
* @example
4545
* var v = truncbf( 3.14159, 3, 10 );
46-
* // returns 3.141
46+
* // returns 3.1410000324249268
4747
*
4848
* @example
4949
* var v = truncbf( 15.0, -1, 10 );
5050
* // returns 10.0
5151
*
5252
* @example
5353
* var v = truncbf( -3.14159, 2, 10 );
54-
* // returns -3.14
54+
* // returns -3.140000104904175
5555
*
5656
* @example
5757
* var v = truncbf( NaN, 2, 10 );
@@ -62,16 +62,20 @@ function truncbf( x, n, b ) {
6262
var y;
6363

6464
x = float64ToFloat32( x );
65+
6566
if ( x === 0.0 || isnanf( x ) || isInfinitef( x ) ) {
6667
return x;
6768
}
6869
if ( b === 0 ) {
6970
return NaN;
7071
}
72+
7173
// Compute scale factor: s = b^n
72-
s = powf( b, n );
74+
s = pow( b, n );
75+
7376
// Multiply by scale, truncate, then divide by scale
74-
y = truncf( x * s ) / s;
77+
y = trunc( x * s ) / s;
78+
7579
return float64ToFloat32( y );
7680
}
7781

0 commit comments

Comments
 (0)