@stdlib/math-base-special-ceiln 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +1 -1
- package/README.md +5 -5
- package/include/stdlib/math/base/special/ceiln.h +0 -3
- package/manifest.json +6 -3
- package/package.json +13 -13
- package/src/{ceiln.c → main.c} +7 -13
- package/include.gypi +0 -53
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -259,7 +259,7 @@ See [LICENSE][stdlib-license].
|
|
|
259
259
|
|
|
260
260
|
## Copyright
|
|
261
261
|
|
|
262
|
-
Copyright © 2016-
|
|
262
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
263
263
|
|
|
264
264
|
</section>
|
|
265
265
|
|
|
@@ -272,8 +272,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
272
272
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/math-base-special-ceiln.svg
|
|
273
273
|
[npm-url]: https://npmjs.org/package/@stdlib/math-base-special-ceiln
|
|
274
274
|
|
|
275
|
-
[test-image]: https://github.com/stdlib-js/math-base-special-ceiln/actions/workflows/test.yml/badge.svg?branch=v0.2.
|
|
276
|
-
[test-url]: https://github.com/stdlib-js/math-base-special-ceiln/actions/workflows/test.yml?query=branch:v0.2.
|
|
275
|
+
[test-image]: https://github.com/stdlib-js/math-base-special-ceiln/actions/workflows/test.yml/badge.svg?branch=v0.2.3
|
|
276
|
+
[test-url]: https://github.com/stdlib-js/math-base-special-ceiln/actions/workflows/test.yml?query=branch:v0.2.3
|
|
277
277
|
|
|
278
278
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/math-base-special-ceiln/main.svg
|
|
279
279
|
[coverage-url]: https://codecov.io/github/stdlib-js/math-base-special-ceiln?branch=main
|
|
@@ -285,8 +285,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
|
|
|
285
285
|
|
|
286
286
|
-->
|
|
287
287
|
|
|
288
|
-
[chat-image]: https://img.shields.io/
|
|
289
|
-
[chat-url]: https://
|
|
288
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
289
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
290
290
|
|
|
291
291
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
292
292
|
|
package/manifest.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
{
|
|
29
29
|
"task": "build",
|
|
30
30
|
"src": [
|
|
31
|
-
"./src/
|
|
31
|
+
"./src/main.c"
|
|
32
32
|
],
|
|
33
33
|
"include": [
|
|
34
34
|
"./include"
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@stdlib/math-base-napi-binary",
|
|
42
42
|
"@stdlib/math-base-special-abs",
|
|
43
43
|
"@stdlib/math-base-special-ceil",
|
|
44
|
+
"@stdlib/math-base-special-pow",
|
|
44
45
|
"@stdlib/math-base-assert-is-nan",
|
|
45
46
|
"@stdlib/math-base-assert-is-infinite",
|
|
46
47
|
"@stdlib/constants-float64-max-base10-exponent",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
{
|
|
54
55
|
"task": "benchmark",
|
|
55
56
|
"src": [
|
|
56
|
-
"./src/
|
|
57
|
+
"./src/main.c"
|
|
57
58
|
],
|
|
58
59
|
"include": [
|
|
59
60
|
"./include"
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"dependencies": [
|
|
66
67
|
"@stdlib/math-base-special-abs",
|
|
67
68
|
"@stdlib/math-base-special-ceil",
|
|
69
|
+
"@stdlib/math-base-special-pow",
|
|
68
70
|
"@stdlib/math-base-assert-is-nan",
|
|
69
71
|
"@stdlib/math-base-assert-is-infinite",
|
|
70
72
|
"@stdlib/constants-float64-max-base10-exponent",
|
|
@@ -77,7 +79,7 @@
|
|
|
77
79
|
{
|
|
78
80
|
"task": "examples",
|
|
79
81
|
"src": [
|
|
80
|
-
"./src/
|
|
82
|
+
"./src/main.c"
|
|
81
83
|
],
|
|
82
84
|
"include": [
|
|
83
85
|
"./include"
|
|
@@ -89,6 +91,7 @@
|
|
|
89
91
|
"dependencies": [
|
|
90
92
|
"@stdlib/math-base-special-abs",
|
|
91
93
|
"@stdlib/math-base-special-ceil",
|
|
94
|
+
"@stdlib/math-base-special-pow",
|
|
92
95
|
"@stdlib/math-base-assert-is-nan",
|
|
93
96
|
"@stdlib/math-base-assert-is-infinite",
|
|
94
97
|
"@stdlib/constants-float64-max-base10-exponent",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/math-base-special-ceiln",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Round a numeric value to the nearest multiple of 10^n toward positive infinity.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@stdlib/constants-float64-max-base10-exponent": "^0.2.
|
|
37
|
-
"@stdlib/constants-float64-max-safe-integer": "^0.2.
|
|
38
|
-
"@stdlib/constants-float64-min-base10-exponent": "^0.2.
|
|
39
|
-
"@stdlib/constants-float64-min-base10-exponent-subnormal": "^0.2.
|
|
40
|
-
"@stdlib/constants-float64-pinf": "^0.2.
|
|
41
|
-
"@stdlib/math-base-assert-is-infinite": "^0.2.
|
|
42
|
-
"@stdlib/math-base-assert-is-nan": "^0.2.
|
|
43
|
-
"@stdlib/math-base-napi-binary": "^0.
|
|
44
|
-
"@stdlib/math-base-special-abs": "^0.2.
|
|
45
|
-
"@stdlib/math-base-special-ceil": "^0.2.
|
|
46
|
-
"@stdlib/math-base-special-pow": "^0.
|
|
47
|
-
"@stdlib/utils-library-manifest": "^0.2.
|
|
36
|
+
"@stdlib/constants-float64-max-base10-exponent": "^0.2.3",
|
|
37
|
+
"@stdlib/constants-float64-max-safe-integer": "^0.2.3",
|
|
38
|
+
"@stdlib/constants-float64-min-base10-exponent": "^0.2.3",
|
|
39
|
+
"@stdlib/constants-float64-min-base10-exponent-subnormal": "^0.2.1",
|
|
40
|
+
"@stdlib/constants-float64-pinf": "^0.2.3",
|
|
41
|
+
"@stdlib/math-base-assert-is-infinite": "^0.2.3",
|
|
42
|
+
"@stdlib/math-base-assert-is-nan": "^0.2.3",
|
|
43
|
+
"@stdlib/math-base-napi-binary": "^0.3.3",
|
|
44
|
+
"@stdlib/math-base-special-abs": "^0.2.3",
|
|
45
|
+
"@stdlib/math-base-special-ceil": "^0.2.3",
|
|
46
|
+
"@stdlib/math-base-special-pow": "^0.3.0",
|
|
47
|
+
"@stdlib/utils-library-manifest": "^0.2.4"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {},
|
|
50
50
|
"engines": {
|
package/src/{ceiln.c → main.c}
RENAMED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include "stdlib/math/base/special/ceiln.h"
|
|
20
20
|
#include "stdlib/math/base/special/ceil.h"
|
|
21
21
|
#include "stdlib/math/base/special/abs.h"
|
|
22
|
+
#include "stdlib/math/base/special/pow.h"
|
|
22
23
|
#include "stdlib/math/base/assert/is_nan.h"
|
|
23
24
|
#include "stdlib/math/base/assert/is_infinite.h"
|
|
24
25
|
#include "stdlib/constants/float64/max_base10_exponent.h"
|
|
@@ -27,16 +28,9 @@
|
|
|
27
28
|
#include "stdlib/constants/float64/max_safe_integer.h"
|
|
28
29
|
#include "stdlib/constants/float64/pinf.h"
|
|
29
30
|
#include <stdint.h>
|
|
30
|
-
#include <math.h>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// VARIABLES //
|
|
34
31
|
|
|
35
32
|
static const double MAX_INT = STDLIB_CONSTANT_FLOAT64_MAX_SAFE_INTEGER + 1.0;
|
|
36
|
-
static const double
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// MAIN //
|
|
33
|
+
static const double HUGE_VALUE = 1.0e+308;
|
|
40
34
|
|
|
41
35
|
/**
|
|
42
36
|
* Rounds a double-precision floating-point number to the nearest multiple of \\(10^n\\) toward positive infinity.
|
|
@@ -63,7 +57,7 @@ static const double HUGE = 1.0e+308;
|
|
|
63
57
|
double stdlib_base_ceiln( const double x, const int32_t n ) {
|
|
64
58
|
double s;
|
|
65
59
|
double y;
|
|
66
|
-
if ( stdlib_base_is_nan( x ) ){
|
|
60
|
+
if ( stdlib_base_is_nan( x ) ) {
|
|
67
61
|
return x;
|
|
68
62
|
}
|
|
69
63
|
if (
|
|
@@ -90,14 +84,14 @@ double stdlib_base_ceiln( const double x, const int32_t n ) {
|
|
|
90
84
|
}
|
|
91
85
|
// If we overflow, return `x`, as the number of digits to the right of the decimal is too small (i.e., `x` is too large / lacks sufficient fractional precision) for there to be any effect when rounding...
|
|
92
86
|
if ( n < STDLIB_CONSTANT_FLOAT64_MIN_BASE10_EXPONENT ) {
|
|
93
|
-
s =
|
|
94
|
-
y = ( x *
|
|
87
|
+
s = stdlib_base_pow( 10.0, -( n + STDLIB_CONSTANT_FLOAT64_MAX_BASE10_EXPONENT ) );
|
|
88
|
+
y = ( x * HUGE_VALUE ) * s; // order of operation matters!
|
|
95
89
|
if ( stdlib_base_is_infinite( y ) ) {
|
|
96
90
|
return x;
|
|
97
91
|
}
|
|
98
|
-
return ( stdlib_base_ceil( y ) /
|
|
92
|
+
return ( stdlib_base_ceil( y ) / HUGE_VALUE ) / s;
|
|
99
93
|
}
|
|
100
|
-
s =
|
|
94
|
+
s = stdlib_base_pow( 10.0, -n );
|
|
101
95
|
y = x * s;
|
|
102
96
|
if ( stdlib_base_is_infinite( y ) ) {
|
|
103
97
|
return x;
|
package/include.gypi
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# @license Apache-2.0
|
|
2
|
-
#
|
|
3
|
-
# Copyright (c) 2023 The Stdlib Authors.
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
# A GYP include file for building a Node.js native add-on.
|
|
18
|
-
#
|
|
19
|
-
# Main documentation:
|
|
20
|
-
#
|
|
21
|
-
# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md
|
|
22
|
-
# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md
|
|
23
|
-
{
|
|
24
|
-
# Define variables to be used throughout the configuration for all targets:
|
|
25
|
-
'variables': {
|
|
26
|
-
# Source directory:
|
|
27
|
-
'src_dir': './src',
|
|
28
|
-
|
|
29
|
-
# Include directories:
|
|
30
|
-
'include_dirs': [
|
|
31
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
# Add-on destination directory:
|
|
35
|
-
'addon_output_dir': './src',
|
|
36
|
-
|
|
37
|
-
# Source files:
|
|
38
|
-
'src_files': [
|
|
39
|
-
'<(src_dir)/addon.c',
|
|
40
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).src; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
41
|
-
],
|
|
42
|
-
|
|
43
|
-
# Library dependencies:
|
|
44
|
-
'libraries': [
|
|
45
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libraries; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
# Library directories:
|
|
49
|
-
'library_dirs': [
|
|
50
|
-
'<!@(node -e "var arr = require(\'@stdlib/utils-library-manifest\')(\'./manifest.json\',{},{\'basedir\':process.cwd(),\'paths\':\'posix\'}).libpath; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }")',
|
|
51
|
-
],
|
|
52
|
-
}, # end variables
|
|
53
|
-
}
|