@stdlib/number-float64-base-to-float32 0.0.7 → 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/CITATION.cff +30 -0
- package/NOTICE +1 -1
- package/README.md +15 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/package.json +11 -11
- package/docs/repl.txt +0 -22
- package/docs/types/test.ts +0 -43
package/CITATION.cff
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
title: stdlib
|
|
3
|
+
message: >-
|
|
4
|
+
If you use this software, please cite it using the
|
|
5
|
+
metadata from this file.
|
|
6
|
+
|
|
7
|
+
type: software
|
|
8
|
+
|
|
9
|
+
authors:
|
|
10
|
+
- name: The Stdlib Authors
|
|
11
|
+
url: https://github.com/stdlib-js/stdlib/graphs/contributors
|
|
12
|
+
|
|
13
|
+
repository-code: https://github.com/stdlib-js/stdlib
|
|
14
|
+
url: https://stdlib.io
|
|
15
|
+
|
|
16
|
+
abstract: |
|
|
17
|
+
Standard library for JavaScript and Node.js.
|
|
18
|
+
|
|
19
|
+
keywords:
|
|
20
|
+
- JavaScript
|
|
21
|
+
- Node.js
|
|
22
|
+
- TypeScript
|
|
23
|
+
- standard library
|
|
24
|
+
- scientific computing
|
|
25
|
+
- numerical computing
|
|
26
|
+
- statistical computing
|
|
27
|
+
|
|
28
|
+
license: Apache-2.0 AND BSL-1.0
|
|
29
|
+
|
|
30
|
+
date-released: 2016
|
package/NOTICE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Copyright (c) 2016-
|
|
1
|
+
Copyright (c) 2016-2023 The Stdlib Authors.
|
package/README.md
CHANGED
|
@@ -18,6 +18,17 @@ limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
-->
|
|
20
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
|
+
|
|
21
32
|
# toFloat32
|
|
22
33
|
|
|
23
34
|
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] -->
|
|
@@ -125,7 +136,7 @@ See [LICENSE][stdlib-license].
|
|
|
125
136
|
|
|
126
137
|
## Copyright
|
|
127
138
|
|
|
128
|
-
Copyright © 2016-
|
|
139
|
+
Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors].
|
|
129
140
|
|
|
130
141
|
</section>
|
|
131
142
|
|
|
@@ -138,8 +149,8 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
138
149
|
[npm-image]: http://img.shields.io/npm/v/@stdlib/number-float64-base-to-float32.svg
|
|
139
150
|
[npm-url]: https://npmjs.org/package/@stdlib/number-float64-base-to-float32
|
|
140
151
|
|
|
141
|
-
[test-image]: https://github.com/stdlib-js/number-float64-base-to-float32/actions/workflows/test.yml/badge.svg?branch=v0.0
|
|
142
|
-
[test-url]: https://github.com/stdlib-js/number-float64-base-to-float32/actions/workflows/test.yml?query=branch:v0.0
|
|
152
|
+
[test-image]: https://github.com/stdlib-js/number-float64-base-to-float32/actions/workflows/test.yml/badge.svg?branch=v0.1.0
|
|
153
|
+
[test-url]: https://github.com/stdlib-js/number-float64-base-to-float32/actions/workflows/test.yml?query=branch:v0.1.0
|
|
143
154
|
|
|
144
155
|
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float64-base-to-float32/main.svg
|
|
145
156
|
[coverage-url]: https://codecov.io/github/stdlib-js/number-float64-base-to-float32?branch=main
|
|
@@ -152,7 +163,7 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
|
|
|
152
163
|
-->
|
|
153
164
|
|
|
154
165
|
[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
|
|
155
|
-
[chat-url]: https://gitter.im
|
|
166
|
+
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im
|
|
156
167
|
|
|
157
168
|
[stdlib]: https://github.com/stdlib-js/stdlib
|
|
158
169
|
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";var e=function(t,r){return function(){return r||t((r={exports:{}}).exports,r),r.exports}};var a=e(function(F,u){
|
|
2
|
+
var s=typeof Math.fround=="function"?Math.fround:null;u.exports=s
|
|
3
|
+
});var f=e(function(d,n){
|
|
4
|
+
var c=require('@stdlib/array-float32/dist'),i=new c(1);function p(t){return i[0]=t,i[0]}n.exports=p
|
|
5
|
+
});var l=a(),v=f(),o;typeof l=="function"?o=l:o=v;module.exports=o;
|
|
6
|
+
/** @license Apache-2.0 */
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../lib/main.js", "../lib/polyfill.js", "../lib/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MAIN //\n\nvar fround = ( typeof Math.fround === 'function' ) ? Math.fround : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nmodule.exports = fround;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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// MODULES //\n\nvar Float32Array = require( '@stdlib/array-float32' );\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest single-precision floating-point number\n*\n* @example\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\nfunction float64ToFloat32( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn FLOAT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nmodule.exports = float64ToFloat32;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 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* Convert a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @module @stdlib/number-float64-base-to-float32\n*\n* @example\n* var float64ToFloat32 = require( '@stdlib/number-float64-base-to-float32' );\n*\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\n\n// MODULES //\n\nvar builtin = require( './main.js' );\nvar polyfill = require( './polyfill.js' );\n\n\n// MAIN //\n\nvar float64ToFloat32;\nif ( typeof builtin === 'function' ) {\n\tfloat64ToFloat32 = builtin;\n} else {\n\tfloat64ToFloat32 = polyfill;\n}\n\n\n// EXPORTS //\n\nmodule.exports = float64ToFloat32;\n"],
|
|
5
|
+
"mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,OAAO,KAAK,QAAW,WAAe,KAAK,OAAS,KAKnED,EAAO,QAAUC,IC3BjB,IAAAC,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAe,QAAS,uBAAwB,EAKhDC,EAAe,IAAID,EAAc,CAAE,EAevC,SAASE,EAAkBC,EAAI,CAC9B,OAAAF,EAAc,CAAE,EAAIE,EACbF,EAAc,CAAE,CACxB,CAKAF,EAAO,QAAUG,IChBjB,IAAIE,EAAU,IACVC,EAAW,IAKXC,EACC,OAAOF,GAAY,WACvBE,EAAmBF,EAEnBE,EAAmBD,EAMpB,OAAO,QAAUC",
|
|
6
|
+
"names": ["require_main", "__commonJSMin", "exports", "module", "fround", "require_polyfill", "__commonJSMin", "exports", "module", "Float32Array", "FLOAT32_VIEW", "float64ToFloat32", "x", "builtin", "polyfill", "float64ToFloat32"]
|
|
7
|
+
}
|
package/docs/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stdlib/number-float64-base-to-float32",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Convert a double-precision floating-point number to the nearest single-precision floating-point number.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -37,19 +37,19 @@
|
|
|
37
37
|
"url": "https://github.com/stdlib-js/stdlib/issues"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@stdlib/array-float32": "^0.0
|
|
40
|
+
"@stdlib/array-float32": "^0.1.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@stdlib/bench": "^0.0
|
|
44
|
-
"@stdlib/constants-float64-ninf": "^0.0
|
|
45
|
-
"@stdlib/constants-float64-pinf": "^0.0
|
|
46
|
-
"@stdlib/math-base-assert-is-nan": "^0.0
|
|
47
|
-
"@stdlib/math-base-assert-is-negative-zero": "^0.0
|
|
48
|
-
"@stdlib/random-base-randu": "^0.0.
|
|
43
|
+
"@stdlib/bench": "^0.1.0",
|
|
44
|
+
"@stdlib/constants-float64-ninf": "^0.1.0",
|
|
45
|
+
"@stdlib/constants-float64-pinf": "^0.1.0",
|
|
46
|
+
"@stdlib/math-base-assert-is-nan": "^0.1.0",
|
|
47
|
+
"@stdlib/math-base-assert-is-negative-zero": "^0.1.0",
|
|
48
|
+
"@stdlib/random-base-randu": "^0.0.8",
|
|
49
49
|
"proxyquire": "^2.0.0",
|
|
50
50
|
"tape": "git+https://github.com/kgryte/tape.git#fix/globby",
|
|
51
51
|
"istanbul": "^0.4.1",
|
|
52
|
-
"tap-
|
|
52
|
+
"tap-min": "git+https://github.com/Planeshifter/tap-min.git"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=0.10.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"number"
|
|
89
89
|
],
|
|
90
90
|
"funding": {
|
|
91
|
-
"type": "
|
|
92
|
-
"url": "https://
|
|
91
|
+
"type": "opencollective",
|
|
92
|
+
"url": "https://opencollective.com/stdlib"
|
|
93
93
|
}
|
|
94
94
|
}
|
package/docs/repl.txt
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}( x )
|
|
3
|
-
Converts a double-precision floating-point number to the nearest single-
|
|
4
|
-
precision floating-point number.
|
|
5
|
-
|
|
6
|
-
Parameters
|
|
7
|
-
----------
|
|
8
|
-
x: number
|
|
9
|
-
Double-precision floating-point number.
|
|
10
|
-
|
|
11
|
-
Returns
|
|
12
|
-
-------
|
|
13
|
-
out: float
|
|
14
|
-
Nearest single-precision floating-point number.
|
|
15
|
-
|
|
16
|
-
Examples
|
|
17
|
-
--------
|
|
18
|
-
> var y = {{alias}}( 1.337 )
|
|
19
|
-
1.3370000123977661
|
|
20
|
-
|
|
21
|
-
See Also
|
|
22
|
-
--------
|
package/docs/types/test.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @license Apache-2.0
|
|
3
|
-
*
|
|
4
|
-
* Copyright (c) 2019 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
|
-
import float64ToFloat32 = require( './index' );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// TESTS //
|
|
23
|
-
|
|
24
|
-
// The function returns a number...
|
|
25
|
-
{
|
|
26
|
-
float64ToFloat32( 3.14 ); // $ExpectType number
|
|
27
|
-
float64ToFloat32( 0 ); // $ExpectType number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// The function does not compile if provided a value other than a number...
|
|
31
|
-
{
|
|
32
|
-
float64ToFloat32( true ); // $ExpectError
|
|
33
|
-
float64ToFloat32( false ); // $ExpectError
|
|
34
|
-
float64ToFloat32( '5' ); // $ExpectError
|
|
35
|
-
float64ToFloat32( [] ); // $ExpectError
|
|
36
|
-
float64ToFloat32( {} ); // $ExpectError
|
|
37
|
-
float64ToFloat32( ( x: number ): number => x ); // $ExpectError
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// The function does not compile if provided insufficient arguments...
|
|
41
|
-
{
|
|
42
|
-
float64ToFloat32(); // $ExpectError
|
|
43
|
-
}
|