File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/math/base/special/roundnf Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Rounds a single-precision floating-point number to the nearest multiple of `10^n
3737``` javascript
3838// Round a value to 2 decimal places:
3939var v = roundnf ( 3.141592 , - 2 );
40- // returns 3.14
40+ // returns 3.140000104904175
4141
4242// If n = 0, `roundnf` behaves like `roundf`:
4343v = roundnf ( 3.141592 , 0 );
@@ -64,7 +64,7 @@ v = roundnf( 1234.56, 2 );
6464
6565 // Should round to 0.3...
6666 var v = roundnf ( x, - 16 );
67- // returns ~0.3000000000000001
67+ // returns 0.30000001192092896
6868 ```
6969
7070- Ties are rounded toward positive infinity.
Original file line number Diff line number Diff line change @@ -66,14 +66,14 @@ int main( void ) {
6666 for ( i = 0 ; i < 1000 ; i ++ ) {
6767 stdlib_base_roundnf ( (float )i , -2 );
6868 }
69-
69+
7070 // Benchmark:
7171 printf ( "Benchmark: roundnf\n" );
7272 elapsed = benchmark ();
7373 rate = (double )ITERATIONS / elapsed ;
7474 printf ( " iterations: %d\n" , ITERATIONS );
7575 printf ( " elapsed: %f sec\n" , elapsed );
7676 printf ( " rate: %f ops/sec\n" , rate );
77-
77+
7878 return 0 ;
7979}
Original file line number Diff line number Diff line change 1919 --------
2020 // Round to 2 decimal places:
2121 > var y = {{alias}}( 3.141592, -2 )
22- 3.14
22+ 3.140000104904175
2323
2424 // Round to nearest integer:
2525 > y = {{alias}}( 3.7, 0 )
Original file line number Diff line number Diff line change 1+ /**
2+ * @license Apache-2.0
3+ *
4+ * Copyright (c) 2025 The Stdlib Authors.
5+ *
6+ * Licensed under the Apache License, Version 2.0 (the "License");
7+ * you may not use this file except in compliance with the License.
8+ * You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing, software
13+ * distributed under the License is distributed on an "AS IS" BASIS,
14+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ */
18+
19+ // TypeScript Version: 4.1
20+
121/**
222* Rounds a single-precision floating-point number to the nearest multiple of `10^n`.
323*
1232* @example
1333* // Round a value to 2 decimal places:
1434* var v = roundnf( 3.141592, -2 );
15- * // returns 3.14
35+ * // returns 3.140000104904175
1636*
1737* @example
1838* // If n = 0, `roundnf` behaves like `roundf`:
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ all: $(c_targets)
9999#
100100# @private
101101# /
102- $(c_targets ) : % .c
102+ $(c_targets ) : % : % .c
103103 $(QUIET ) $(CC ) $(CFLAGS ) $(fPIC ) $(INCLUDE ) -o $@ $(SOURCE_FILES ) $< $(LIBPATH ) $(LIBRARIES )
104104
105105# /
Original file line number Diff line number Diff line change 2828*
2929* // Round a value to 2 decimal places:
3030* var v = roundnf( 3.141592, -2 );
31- * // returns 3.14
31+ * // returns 3.140000104904175
3232*
3333* @example
3434* var roundnf = require( '@stdlib/math/base/special/roundnf' );
You can’t perform that action at this time.
0 commit comments