@stdlib/number-float64-base-identity 0.1.0
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/LICENSE +177 -0
- package/NOTICE +1 -0
- package/README.md +305 -0
- package/SECURITY.md +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/docs/img/equation_identity_function.svg +18 -0
- package/docs/types/index.d.ts +52 -0
- package/include/stdlib/number/float64/base/identity.h +38 -0
- package/lib/index.js +52 -0
- package/lib/main.js +54 -0
- package/lib/native.js +62 -0
- package/manifest.json +67 -0
- package/package.json +70 -0
- package/src/addon.c +22 -0
- package/src/main.c +33 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
package/NOTICE
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Copyright (c) 2016-2026 The Stdlib Authors.
|
package/README.md
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
|
|
3
|
+
@license Apache-2.0
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2020 The Stdlib Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>
|
|
24
|
+
About stdlib...
|
|
25
|
+
</summary>
|
|
26
|
+
<p>We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.</p>
|
|
27
|
+
<p>The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.</p>
|
|
28
|
+
<p>When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.</p>
|
|
29
|
+
<p>To join us in bringing numerical computing to the web, get started by checking us out on <a href="https://github.com/stdlib-js/stdlib">GitHub</a>, and please consider <a href="https://opencollective.com/stdlib">financially supporting stdlib</a>. We greatly appreciate your continued support!</p>
|
|
30
|
+
</details>
|
|
31
|
+
|
|
32
|
+
# Identity Function
|
|
33
|
+
|
|
34
|
+
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
35
|
+
|
|
36
|
+
> Evaluate the [identity function][identity-function] of a double-precision floating-point number.
|
|
37
|
+
|
|
38
|
+
<section class="intro">
|
|
39
|
+
|
|
40
|
+
The [identity-function][identity-function] is defined as
|
|
41
|
+
|
|
42
|
+
<!-- <equation class="equation" label="eq:identity_function" align="center" raw="f(x) = x" alt="Identity function"> -->
|
|
43
|
+
|
|
44
|
+
<div class="equation" align="center" data-raw-text="f(x) = x" data-equation="eq:identity_function">
|
|
45
|
+
<img src="https://cdn.jsdelivr.net/gh/stdlib-js/stdlib@ad7afa5d7ec1b1596f8a4828153d8c2e87a90161/lib/node_modules/@stdlib/number/float64/base/identity/docs/img/equation_identity_function.svg" alt="Identity function">
|
|
46
|
+
<br>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<!-- </equation> -->
|
|
50
|
+
|
|
51
|
+
for all `x`.
|
|
52
|
+
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<!-- /.intro -->
|
|
56
|
+
|
|
57
|
+
<section class="installation">
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @stdlib/number-float64-base-identity
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
</section>
|
|
66
|
+
|
|
67
|
+
<section class="usage">
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
var identity = require( '@stdlib/number-float64-base-identity' );
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### identity( x )
|
|
76
|
+
|
|
77
|
+
Evaluates the [identity function][identity-function] for a double-precision floating-point number.
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
var v = identity( -1.0 );
|
|
81
|
+
// returns -1.0
|
|
82
|
+
|
|
83
|
+
v = identity( 2.0 );
|
|
84
|
+
// returns 2.0
|
|
85
|
+
|
|
86
|
+
v = identity( 0.0 );
|
|
87
|
+
// returns 0.0
|
|
88
|
+
|
|
89
|
+
v = identity( -0.0 );
|
|
90
|
+
// returns -0.0
|
|
91
|
+
|
|
92
|
+
v = identity( NaN );
|
|
93
|
+
// returns NaN
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
</section>
|
|
97
|
+
|
|
98
|
+
<!-- /.usage -->
|
|
99
|
+
|
|
100
|
+
<section class="examples">
|
|
101
|
+
|
|
102
|
+
## Examples
|
|
103
|
+
|
|
104
|
+
<!-- eslint no-undef: "error" -->
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
var randu = require( '@stdlib/random-base-randu' );
|
|
108
|
+
var round = require( '@stdlib/math-base-special-round' );
|
|
109
|
+
var identity = require( '@stdlib/number-float64-base-identity' );
|
|
110
|
+
|
|
111
|
+
var rand;
|
|
112
|
+
var i;
|
|
113
|
+
|
|
114
|
+
for ( i = 0; i < 100; i++ ) {
|
|
115
|
+
rand = round( randu() * 100.0 ) - 50.0;
|
|
116
|
+
console.log( 'identity(%d) = %d', rand, identity( rand ) );
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
</section>
|
|
121
|
+
|
|
122
|
+
<!-- /.examples -->
|
|
123
|
+
|
|
124
|
+
<!-- C interface documentation. -->
|
|
125
|
+
|
|
126
|
+
* * *
|
|
127
|
+
|
|
128
|
+
<section class="c">
|
|
129
|
+
|
|
130
|
+
## C APIs
|
|
131
|
+
|
|
132
|
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
|
|
133
|
+
|
|
134
|
+
<section class="intro">
|
|
135
|
+
|
|
136
|
+
</section>
|
|
137
|
+
|
|
138
|
+
<!-- /.intro -->
|
|
139
|
+
|
|
140
|
+
<!-- C usage documentation. -->
|
|
141
|
+
|
|
142
|
+
<section class="usage">
|
|
143
|
+
|
|
144
|
+
### Usage
|
|
145
|
+
|
|
146
|
+
```c
|
|
147
|
+
#include "stdlib/number/float64/base/identity.h"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### stdlib_base_float64_identity( x )
|
|
151
|
+
|
|
152
|
+
Evaluates the identity function for a double-precision floating-point number.
|
|
153
|
+
|
|
154
|
+
```c
|
|
155
|
+
double y = stdlib_base_float64_identity( 2.0 );
|
|
156
|
+
// returns 2.0
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
The function accepts the following arguments:
|
|
160
|
+
|
|
161
|
+
- **x**: `[in] double` input value.
|
|
162
|
+
|
|
163
|
+
```c
|
|
164
|
+
double stdlib_base_float64_identity( const double x );
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
</section>
|
|
168
|
+
|
|
169
|
+
<!-- /.usage -->
|
|
170
|
+
|
|
171
|
+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
172
|
+
|
|
173
|
+
<section class="notes">
|
|
174
|
+
|
|
175
|
+
</section>
|
|
176
|
+
|
|
177
|
+
<!-- /.notes -->
|
|
178
|
+
|
|
179
|
+
<!-- C API usage examples. -->
|
|
180
|
+
|
|
181
|
+
<section class="examples">
|
|
182
|
+
|
|
183
|
+
### Examples
|
|
184
|
+
|
|
185
|
+
```c
|
|
186
|
+
#include "stdlib/number/float64/base/identity.h"
|
|
187
|
+
#include <stdio.h>
|
|
188
|
+
|
|
189
|
+
int main( void ) {
|
|
190
|
+
const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 };
|
|
191
|
+
|
|
192
|
+
double y;
|
|
193
|
+
int i;
|
|
194
|
+
for ( i = 0; i < 4; i++ ) {
|
|
195
|
+
y = stdlib_base_float64_identity( x[ i ] );
|
|
196
|
+
printf( "f(%lf) = %lf\n", x[ i ], y );
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
</section>
|
|
202
|
+
|
|
203
|
+
<!-- /.examples -->
|
|
204
|
+
|
|
205
|
+
</section>
|
|
206
|
+
|
|
207
|
+
<!-- /.c -->
|
|
208
|
+
|
|
209
|
+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
|
|
210
|
+
|
|
211
|
+
<section class="related">
|
|
212
|
+
|
|
213
|
+
* * *
|
|
214
|
+
|
|
215
|
+
## See Also
|
|
216
|
+
|
|
217
|
+
- <span class="package-name">[`@stdlib/number-float32/base/identity`][@stdlib/number/float32/base/identity]</span><span class="delimiter">: </span><span class="description">evaluate the identity function for a single-precision floating-point number.</span>
|
|
218
|
+
|
|
219
|
+
</section>
|
|
220
|
+
|
|
221
|
+
<!-- /.related -->
|
|
222
|
+
|
|
223
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
<section class="main-repo" >
|
|
227
|
+
|
|
228
|
+
* * *
|
|
229
|
+
|
|
230
|
+
## Notice
|
|
231
|
+
|
|
232
|
+
This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
|
|
233
|
+
|
|
234
|
+
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
|
|
235
|
+
|
|
236
|
+
#### Community
|
|
237
|
+
|
|
238
|
+
[![Chat][chat-image]][chat-url]
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
See [LICENSE][stdlib-license].
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
## Copyright
|
|
248
|
+
|
|
249
|
+
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
|
|
250
|
+
|
|
251
|
+
</section>
|
|
252
|
+
|
|
253
|
+
<!-- /.stdlib -->
|
|
254
|
+
|
|
255
|
+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
|
|
256
|
+
|
|
257
|
+
<section class="links">
|
|
258
|
+
|
|
259
|
+
[npm-image]: http://img.shields.io/npm/v/@stdlib/number-float64-base-identity.svg
|
|
260
|
+
[npm-url]: https://npmjs.org/package/@stdlib/number-float64-base-identity
|
|
261
|
+
|
|
262
|
+
[test-image]: https://github.com/stdlib-js/number-float64-base-identity/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
263
|
+
[test-url]: https://github.com/stdlib-js/number-float64-base-identity/actions/workflows/test.yml?query=branch:v0.1.0
|
|
264
|
+
|
|
265
|
+
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float64-base-identity/main.svg
|
|
266
|
+
[coverage-url]: https://codecov.io/github/stdlib-js/number-float64-base-identity?branch=main
|
|
267
|
+
|
|
268
|
+
<!--
|
|
269
|
+
|
|
270
|
+
[dependencies-image]: https://img.shields.io/david/stdlib-js/number-float64-base-identity.svg
|
|
271
|
+
[dependencies-url]: https://david-dm.org/stdlib-js/number-float64-base-identity/main
|
|
272
|
+
|
|
273
|
+
-->
|
|
274
|
+
|
|
275
|
+
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
|
|
276
|
+
[chat-url]: https://stdlib.zulipchat.com
|
|
277
|
+
|
|
278
|
+
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
279
|
+
|
|
280
|
+
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
281
|
+
|
|
282
|
+
[umd]: https://github.com/umdjs/umd
|
|
283
|
+
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
|
|
284
|
+
|
|
285
|
+
[deno-url]: https://github.com/stdlib-js/number-float64-base-identity/tree/deno
|
|
286
|
+
[deno-readme]: https://github.com/stdlib-js/number-float64-base-identity/blob/deno/README.md
|
|
287
|
+
[umd-url]: https://github.com/stdlib-js/number-float64-base-identity/tree/umd
|
|
288
|
+
[umd-readme]: https://github.com/stdlib-js/number-float64-base-identity/blob/umd/README.md
|
|
289
|
+
[esm-url]: https://github.com/stdlib-js/number-float64-base-identity/tree/esm
|
|
290
|
+
[esm-readme]: https://github.com/stdlib-js/number-float64-base-identity/blob/esm/README.md
|
|
291
|
+
[branches-url]: https://github.com/stdlib-js/number-float64-base-identity/blob/main/branches.md
|
|
292
|
+
|
|
293
|
+
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/number-float64-base-identity/main/LICENSE
|
|
294
|
+
|
|
295
|
+
[identity-function]: https://en.wikipedia.org/wiki/Identity_function
|
|
296
|
+
|
|
297
|
+
<!-- <related-links> -->
|
|
298
|
+
|
|
299
|
+
[@stdlib/number/float32/base/identity]: https://www.npmjs.com/package/@stdlib/number-float32-base-identity
|
|
300
|
+
|
|
301
|
+
<!-- </related-links> -->
|
|
302
|
+
|
|
303
|
+
</section>
|
|
304
|
+
|
|
305
|
+
<!-- /.links -->
|
package/SECURITY.md
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/main.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Evaluates the identity function for a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} input value\n*\n* @example\n* var v = identity( -1.0 );\n* // returns -1.0\n*\n* @example\n* var v = identity( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = identity( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = identity( -0.0 );\n* // returns -0.0\n*\n* @example\n* var v = identity( NaN );\n* // returns NaN\n*/\nfunction identity( x ) {\n\treturn x;\n}\n\n\n// EXPORTS //\n\nmodule.exports = identity;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Evaluate the identity function for a double-precision floating-point number.\n*\n* @module @stdlib/number-float64-base-identity\n*\n* @example\n* var identity = require( '@stdlib/number-float64-base-identity' );\n*\n* var v = identity( -1.0 );\n* // returns -1.0\n*\n* v = identity( 2.0 );\n* // returns 2.0\n*\n* v = identity( 0.0 );\n* // returns 0.0\n*\n* v = identity( -0.0 );\n* // returns -0.0\n*\n* v = identity( NaN );\n* // returns NaN\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cA8CA,SAASC,EAAUC,EAAI,CACtB,OAAOA,CACR,CAKAF,EAAO,QAAUC,ICPjB,IAAIE,EAAO,IAKX,OAAO,QAAUA",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "identity", "x", "main"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="8.846ex" height="2.843ex" style="vertical-align: -0.838ex;" viewBox="0 -863.1 3808.6 1223.9" role="img" focusable="false" xmlns="http://www.w3.org/2000/svg" aria-labelledby="MathJax-SVG-1-Title">
|
|
2
|
+
<title id="MathJax-SVG-1-Title">f left-parenthesis x right-parenthesis equals x</title>
|
|
3
|
+
<defs aria-hidden="true">
|
|
4
|
+
<path stroke-width="1" id="E1-MJMATHI-66" d="M118 -162Q120 -162 124 -164T135 -167T147 -168Q160 -168 171 -155T187 -126Q197 -99 221 27T267 267T289 382V385H242Q195 385 192 387Q188 390 188 397L195 425Q197 430 203 430T250 431Q298 431 298 432Q298 434 307 482T319 540Q356 705 465 705Q502 703 526 683T550 630Q550 594 529 578T487 561Q443 561 443 603Q443 622 454 636T478 657L487 662Q471 668 457 668Q445 668 434 658T419 630Q412 601 403 552T387 469T380 433Q380 431 435 431Q480 431 487 430T498 424Q499 420 496 407T491 391Q489 386 482 386T428 385H372L349 263Q301 15 282 -47Q255 -132 212 -173Q175 -205 139 -205Q107 -205 81 -186T55 -132Q55 -95 76 -78T118 -61Q162 -61 162 -103Q162 -122 151 -136T127 -157L118 -162Z"></path>
|
|
5
|
+
<path stroke-width="1" id="E1-MJMAIN-28" d="M94 250Q94 319 104 381T127 488T164 576T202 643T244 695T277 729T302 750H315H319Q333 750 333 741Q333 738 316 720T275 667T226 581T184 443T167 250T184 58T225 -81T274 -167T316 -220T333 -241Q333 -250 318 -250H315H302L274 -226Q180 -141 137 -14T94 250Z"></path>
|
|
6
|
+
<path stroke-width="1" id="E1-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442 430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454 404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150 469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133 -10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97 36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404 142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path>
|
|
7
|
+
<path stroke-width="1" id="E1-MJMAIN-29" d="M60 749L64 750Q69 750 74 750H86L114 726Q208 641 251 514T294 250Q294 182 284 119T261 12T224 -76T186 -143T145 -194T113 -227T90 -246Q87 -249 86 -250H74Q66 -250 63 -250T58 -247T55 -238Q56 -237 66 -225Q221 -64 221 250T66 725Q56 737 55 738Q55 746 60 749Z"></path>
|
|
8
|
+
<path stroke-width="1" id="E1-MJMAIN-3D" d="M56 347Q56 360 70 367H707Q722 359 722 347Q722 336 708 328L390 327H72Q56 332 56 347ZM56 153Q56 168 72 173H708Q722 163 722 153Q722 140 707 133H70Q56 140 56 153Z"></path>
|
|
9
|
+
</defs>
|
|
10
|
+
<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)" aria-hidden="true">
|
|
11
|
+
<use xlink:href="#E1-MJMATHI-66" x="0" y="0"></use>
|
|
12
|
+
<use xlink:href="#E1-MJMAIN-28" x="550" y="0"></use>
|
|
13
|
+
<use xlink:href="#E1-MJMATHI-78" x="940" y="0"></use>
|
|
14
|
+
<use xlink:href="#E1-MJMAIN-29" x="1512" y="0"></use>
|
|
15
|
+
<use xlink:href="#E1-MJMAIN-3D" x="2179" y="0"></use>
|
|
16
|
+
<use xlink:href="#E1-MJMATHI-78" x="3236" y="0"></use>
|
|
17
|
+
</g>
|
|
18
|
+
</svg>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates the identity function for double-precision floating-point number `x`.
|
|
23
|
+
*
|
|
24
|
+
* @param x - input value
|
|
25
|
+
* @returns input value
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* var v = identity( -1.0 );
|
|
29
|
+
* // returns -1.0
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* var v = identity( 2.0 );
|
|
33
|
+
* // returns 2.0
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var v = identity( 0.0 );
|
|
37
|
+
* // returns 0.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var v = identity( -0.0 );
|
|
41
|
+
* // returns -0.0
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* var v = identity( NaN );
|
|
45
|
+
* // returns NaN
|
|
46
|
+
*/
|
|
47
|
+
declare function identity( x: number ): number;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// EXPORTS //
|
|
51
|
+
|
|
52
|
+
export = identity;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
#ifndef STDLIB_NUMBER_FLOAT64_BASE_IDENTITY_H
|
|
20
|
+
#define STDLIB_NUMBER_FLOAT64_BASE_IDENTITY_H
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler.
|
|
24
|
+
*/
|
|
25
|
+
#ifdef __cplusplus
|
|
26
|
+
extern "C" {
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Evaluates the identity function for a double-precision floating-point number.
|
|
31
|
+
*/
|
|
32
|
+
double stdlib_base_float64_identity( const double x );
|
|
33
|
+
|
|
34
|
+
#ifdef __cplusplus
|
|
35
|
+
}
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#endif // !STDLIB_NUMBER_FLOAT64_BASE_IDENTITY_H
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Evaluate the identity function for a double-precision floating-point number.
|
|
23
|
+
*
|
|
24
|
+
* @module @stdlib/number-float64-base-identity
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* var identity = require( '@stdlib/number-float64-base-identity' );
|
|
28
|
+
*
|
|
29
|
+
* var v = identity( -1.0 );
|
|
30
|
+
* // returns -1.0
|
|
31
|
+
*
|
|
32
|
+
* v = identity( 2.0 );
|
|
33
|
+
* // returns 2.0
|
|
34
|
+
*
|
|
35
|
+
* v = identity( 0.0 );
|
|
36
|
+
* // returns 0.0
|
|
37
|
+
*
|
|
38
|
+
* v = identity( -0.0 );
|
|
39
|
+
* // returns -0.0
|
|
40
|
+
*
|
|
41
|
+
* v = identity( NaN );
|
|
42
|
+
* // returns NaN
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
// MODULES //
|
|
46
|
+
|
|
47
|
+
var main = require( './main.js' );
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
// EXPORTS //
|
|
51
|
+
|
|
52
|
+
module.exports = main;
|
package/lib/main.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates the identity function for a double-precision floating-point number `x`.
|
|
23
|
+
*
|
|
24
|
+
* @param {number} x - input value
|
|
25
|
+
* @returns {number} input value
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* var v = identity( -1.0 );
|
|
29
|
+
* // returns -1.0
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* var v = identity( 2.0 );
|
|
33
|
+
* // returns 2.0
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var v = identity( 0.0 );
|
|
37
|
+
* // returns 0.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var v = identity( -0.0 );
|
|
41
|
+
* // returns -0.0
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* var v = identity( NaN );
|
|
45
|
+
* // returns NaN
|
|
46
|
+
*/
|
|
47
|
+
function identity( x ) {
|
|
48
|
+
return x;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// EXPORTS //
|
|
53
|
+
|
|
54
|
+
module.exports = identity;
|
package/lib/native.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
// MODULES //
|
|
22
|
+
|
|
23
|
+
var addon = require( './../src/addon.node' );
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
// MAIN //
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Evaluates the identity function for a double-precision floating-point number `x`.
|
|
30
|
+
*
|
|
31
|
+
* @private
|
|
32
|
+
* @param {number} x - input value
|
|
33
|
+
* @returns {number} input value
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* var v = identity( -1.0 );
|
|
37
|
+
* // returns -1.0
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* var v = identity( 2.0 );
|
|
41
|
+
* // returns 2.0
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* var v = identity( 0.0 );
|
|
45
|
+
* // returns 0.0
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* var v = identity( -0.0 );
|
|
49
|
+
* // returns -0.0
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* var v = identity( NaN );
|
|
53
|
+
* // returns NaN
|
|
54
|
+
*/
|
|
55
|
+
function identity( x ) {
|
|
56
|
+
return addon( x );
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// EXPORTS //
|
|
61
|
+
|
|
62
|
+
module.exports = identity;
|
package/manifest.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": {
|
|
3
|
+
"task": "build"
|
|
4
|
+
},
|
|
5
|
+
"fields": [
|
|
6
|
+
{
|
|
7
|
+
"field": "src",
|
|
8
|
+
"resolve": true,
|
|
9
|
+
"relative": true
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"field": "include",
|
|
13
|
+
"resolve": true,
|
|
14
|
+
"relative": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"field": "libraries",
|
|
18
|
+
"resolve": false,
|
|
19
|
+
"relative": false
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"field": "libpath",
|
|
23
|
+
"resolve": true,
|
|
24
|
+
"relative": false
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"confs": [
|
|
28
|
+
{
|
|
29
|
+
"task": "build",
|
|
30
|
+
"src": [
|
|
31
|
+
"./src/main.c"
|
|
32
|
+
],
|
|
33
|
+
"include": [
|
|
34
|
+
"./include"
|
|
35
|
+
],
|
|
36
|
+
"libraries": [],
|
|
37
|
+
"libpath": [],
|
|
38
|
+
"dependencies": [
|
|
39
|
+
"@stdlib/math-base-napi-unary"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"task": "benchmark",
|
|
44
|
+
"src": [
|
|
45
|
+
"./src/main.c"
|
|
46
|
+
],
|
|
47
|
+
"include": [
|
|
48
|
+
"./include"
|
|
49
|
+
],
|
|
50
|
+
"libraries": [],
|
|
51
|
+
"libpath": [],
|
|
52
|
+
"dependencies": []
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"task": "examples",
|
|
56
|
+
"src": [
|
|
57
|
+
"./src/main.c"
|
|
58
|
+
],
|
|
59
|
+
"include": [
|
|
60
|
+
"./include"
|
|
61
|
+
],
|
|
62
|
+
"libraries": [],
|
|
63
|
+
"libpath": [],
|
|
64
|
+
"dependencies": []
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stdlib/number-float64-base-identity",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Evaluate the identity function for a double-precision floating-point number.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "The Stdlib Authors",
|
|
8
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
9
|
+
},
|
|
10
|
+
"contributors": [
|
|
11
|
+
{
|
|
12
|
+
"name": "The Stdlib Authors",
|
|
13
|
+
"url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"main": "./lib",
|
|
17
|
+
"gypfile": false,
|
|
18
|
+
"directories": {
|
|
19
|
+
"doc": "./docs",
|
|
20
|
+
"include": "./include",
|
|
21
|
+
"lib": "./lib",
|
|
22
|
+
"src": "./src",
|
|
23
|
+
"dist": "./dist"
|
|
24
|
+
},
|
|
25
|
+
"types": "./docs/types",
|
|
26
|
+
"scripts": {},
|
|
27
|
+
"homepage": "https://stdlib.io",
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "git://github.com/stdlib-js/number-float64-base-identity.git"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@stdlib/math-base-napi-unary": "^0.2.4",
|
|
37
|
+
"@stdlib/utils-library-manifest": "^0.2.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=0.10.0",
|
|
42
|
+
"npm": ">2.7.0"
|
|
43
|
+
},
|
|
44
|
+
"os": [
|
|
45
|
+
"aix",
|
|
46
|
+
"darwin",
|
|
47
|
+
"freebsd",
|
|
48
|
+
"linux",
|
|
49
|
+
"macos",
|
|
50
|
+
"openbsd",
|
|
51
|
+
"sunos",
|
|
52
|
+
"win32",
|
|
53
|
+
"windows"
|
|
54
|
+
],
|
|
55
|
+
"keywords": [
|
|
56
|
+
"stdlib",
|
|
57
|
+
"stdmath",
|
|
58
|
+
"mathematics",
|
|
59
|
+
"math",
|
|
60
|
+
"identity",
|
|
61
|
+
"double",
|
|
62
|
+
"double-precision",
|
|
63
|
+
"dbl",
|
|
64
|
+
"float64"
|
|
65
|
+
],
|
|
66
|
+
"funding": {
|
|
67
|
+
"type": "opencollective",
|
|
68
|
+
"url": "https://opencollective.com/stdlib"
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/addon.c
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
#include "stdlib/number/float64/base/identity.h"
|
|
20
|
+
#include "stdlib/math/base/napi/unary.h"
|
|
21
|
+
|
|
22
|
+
STDLIB_MATH_BASE_NAPI_MODULE_D_D( stdlib_base_float64_identity )
|
package/src/main.c
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Apache-2.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020 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
|
+
#include "stdlib/number/float64/base/identity.h"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Evaluates the identity function for a double-precision floating-point number.
|
|
23
|
+
*
|
|
24
|
+
* @param x number
|
|
25
|
+
* @return input value
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* double y = stdlib_base_float64_identity( 3.0 );
|
|
29
|
+
* // returns 3.0
|
|
30
|
+
*/
|
|
31
|
+
double stdlib_base_float64_identity( const double x ) {
|
|
32
|
+
return x;
|
|
33
|
+
}
|