Skip to content

Commit 98ee3a4

Browse files
committed
Auto-generated commit
1 parent 7880270 commit 98ee3a4

9 files changed

Lines changed: 50 additions & 13 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Features
1212

13+
- [`cbba7f4`](https://github.com/stdlib-js/stdlib/commit/cbba7f44e7fab218c8c49cf6b71349c89f1c35b5) - add float16 dtype support in `array/to-json` [(#12709)](https://github.com/stdlib-js/stdlib/pull/12709)
1314
- [`52599f6`](https://github.com/stdlib-js/stdlib/commit/52599f691c05f744f17c423e5ccb890a8c2a5cea) - add float16 dtype support in `array/promotion-rules` [(#12707)](https://github.com/stdlib-js/stdlib/pull/12707)
1415
- [`8f96e06`](https://github.com/stdlib-js/stdlib/commit/8f96e060e05149da6a7d598e4c54b1c327d94abb) - add float16 dtype support in `array/next-dtype` [(#12706)](https://github.com/stdlib-js/stdlib/pull/12706)
1516
- [`40bd8d6`](https://github.com/stdlib-js/stdlib/commit/40bd8d6381f5a91d08312ff01c04b53f1765dfdd) - add float16 datatype support in `array/mostly-safe-casts` [(#12702)](https://github.com/stdlib-js/stdlib/pull/12702)
@@ -33,6 +34,7 @@
3334

3435
<details>
3536

37+
- [`cbba7f4`](https://github.com/stdlib-js/stdlib/commit/cbba7f44e7fab218c8c49cf6b71349c89f1c35b5) - **feat:** add float16 dtype support in `array/to-json` [(#12709)](https://github.com/stdlib-js/stdlib/pull/12709) _(by Gururaj Gurram)_
3638
- [`52599f6`](https://github.com/stdlib-js/stdlib/commit/52599f691c05f744f17c423e5ccb890a8c2a5cea) - **feat:** add float16 dtype support in `array/promotion-rules` [(#12707)](https://github.com/stdlib-js/stdlib/pull/12707) _(by Gururaj Gurram)_
3739
- [`8f96e06`](https://github.com/stdlib-js/stdlib/commit/8f96e060e05149da6a7d598e4c54b1c327d94abb) - **feat:** add float16 dtype support in `array/next-dtype` [(#12706)](https://github.com/stdlib-js/stdlib/pull/12706) _(by Gururaj Gurram)_
3840
- [`40bd8d6`](https://github.com/stdlib-js/stdlib/commit/40bd8d6381f5a91d08312ff01c04b53f1765dfdd) - **feat:** add float16 datatype support in `array/mostly-safe-casts` [(#12702)](https://github.com/stdlib-js/stdlib/pull/12702) _(by Gururaj Gurram)_

‎to-json/README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ For guidance on reviving a JSON-serialized typed array, see [`reviver()`][@stdli
7474

7575
- [`Float64Array`][@stdlib/array/float64]
7676
- [`Float32Array`][@stdlib/array/float32]
77+
- [`Float16Array`][@stdlib/array/float16]
7778
- [`Complex128Array`][@stdlib/array/complex128]
7879
- [`Complex64Array`][@stdlib/array/complex64]
7980
- [`BooleanArray`][@stdlib/array/bool]
@@ -122,6 +123,7 @@ For guidance on reviving a JSON-serialized typed array, see [`reviver()`][@stdli
122123
```javascript
123124
var Float64Array = require( '@stdlib/array/float64' );
124125
var Float32Array = require( '@stdlib/array/float32' );
126+
var Float16Array = require( '@stdlib/array/float16' );
125127
var Int32Array = require( '@stdlib/array/int32' );
126128
var Uint32Array = require( '@stdlib/array/uint32' );
127129
var Int16Array = require( '@stdlib/array/int16' );
@@ -152,6 +154,15 @@ json = typedarray2json( arr );
152154
}
153155
*/
154156
157+
arr = new Float16Array( [ 5.0, -3.0 ] );
158+
json = typedarray2json( arr );
159+
/* returns
160+
{
161+
'type': 'Float16Array',
162+
'data': [ 5.0, -3.0 ]
163+
}
164+
*/
165+
155166
arr = new Complex128Array( [ 5.0, 3.0 ] );
156167
json = typedarray2json( arr );
157168
/* returns
@@ -279,6 +290,8 @@ json = typedarray2json( arr );
279290

280291
[@stdlib/array/float32]: https://github.com/stdlib-js/array/tree/main/float32
281292

293+
[@stdlib/array/float16]: https://github.com/stdlib-js/array/tree/main/float16
294+
282295
[@stdlib/array/complex128]: https://github.com/stdlib-js/array/tree/main/complex128
283296

284297
[@stdlib/array/complex64]: https://github.com/stdlib-js/array/tree/main/complex64

‎to-json/docs/repl.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
- Float64Array
88
- Float32Array
9+
- Float16Array
910
- Int32Array
1011
- Uint32Array
1112
- Int16Array

‎to-json/docs/types/index.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { RealOrComplexTypedArray } from '@stdlib/types/array';
2525
/**
2626
* Typed array data type.
2727
*/
28-
type dtype = 'Float64Array' | 'Float32Array' | 'Int32Array' | 'Uint32Array' | 'Int16Array' | 'Uint16Array' | 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Complex64Array' | 'Complex128Array' | 'BooleanArray';
28+
type dtype = 'Float64Array' | 'Float32Array' | 'Float16Array' | 'Int32Array' | 'Uint32Array' | 'Int16Array' | 'Uint16Array' | 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Complex64Array' | 'Complex128Array' | 'BooleanArray';
2929

3030
/**
3131
* JSON representation of typed array.

‎to-json/docs/types/test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import typedarray2json = require( './index' );
3535
typedarray2json( true ); // $ExpectError
3636
typedarray2json( false ); // $ExpectError
3737
typedarray2json( {} ); // $ExpectError
38-
typedarray2json( [] ); // $ExpectError
3938
typedarray2json( null ); // $ExpectError
4039
typedarray2json( undefined ); // $ExpectError
4140
}

‎to-json/examples/index.js‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
var Float64Array = require( './../../float64' );
2222
var Float32Array = require( './../../float32' );
23+
var Float16Array = require( './../../float16' );
2324
var Int32Array = require( './../../int32' );
2425
var Uint32Array = require( './../../uint32' );
2526
var Int16Array = require( './../../int16' );
@@ -50,6 +51,15 @@ console.log( typedarray2json( arr ) );
5051
}
5152
*/
5253

54+
arr = new Float16Array( [ 5.0, -3.0 ] );
55+
console.log( typedarray2json( arr ) );
56+
/* =>
57+
{
58+
'type': 'Float16Array',
59+
'data': [ 5.0, -3.0 ]
60+
}
61+
*/
62+
5363
arr = new Complex128Array( [ 5.0, -3.0 ] );
5464
console.log( typedarray2json( arr ) );
5565
/* =>
@@ -71,10 +81,10 @@ console.log( typedarray2json( arr ) );
7181
arr = new BooleanArray( [ true, false ] );
7282
console.log( typedarray2json( arr ) );
7383
/* =>
74-
{
75-
'type': 'BooleanArray',
76-
'data': [ 1, 0 ]
77-
}
84+
{
85+
'type': 'BooleanArray',
86+
'data': [ 1, 0 ]
87+
}
7888
*/
7989

8090
arr = new Int32Array( [ -5, 3 ] );

‎to-json/lib/ctors.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var Int16Array = require( './../../int16' );
2727
var Uint16Array = require( './../../uint16' );
2828
var Int32Array = require( './../../int32' );
2929
var Uint32Array = require( './../../uint32' );
30+
var Float16Array = require( './../../float16' );
3031
var Float32Array = require( './../../float32' );
3132
var Float64Array = require( './../../float64' );
3233
var Complex64Array = require( './../../complex64' );
@@ -39,6 +40,7 @@ var BooleanArray = require( './../../bool' );
3940
var CTORS = [
4041
[ Float64Array, 'Float64Array' ],
4142
[ Float32Array, 'Float32Array' ],
43+
[ Float16Array, 'Float16Array' ],
4244
[ Int32Array, 'Int32Array' ],
4345
[ Uint32Array, 'Uint32Array' ],
4446
[ Int16Array, 'Int16Array' ],

‎to-json/test/test.js‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var Int16Array = require( './../../int16' );
3232
var Uint16Array = require( './../../uint16' );
3333
var Int32Array = require( './../../int32' );
3434
var Uint32Array = require( './../../uint32' );
35+
var Float16Array = require( './../../float16' );
3536
var Float32Array = require( './../../float32' );
3637
var Float64Array = require( './../../float64' );
3738
var Complex64Array = require( './../../complex64' );
@@ -112,6 +113,7 @@ tape( 'the JSON object includes a typed array type', function test( t ) {
112113
values = [
113114
new Float64Array( 1 ),
114115
new Float32Array( 1 ),
116+
new Float16Array( 1 ),
115117
new Int32Array( 1 ),
116118
new Uint32Array( 1 ),
117119
new Int16Array( 1 ),
@@ -127,6 +129,7 @@ tape( 'the JSON object includes a typed array type', function test( t ) {
127129
expected = [
128130
'Float64Array',
129131
'Float32Array',
132+
'Float16Array',
130133
'Int32Array',
131134
'Uint32Array',
132135
'Int16Array',
@@ -155,13 +158,14 @@ tape( 'the JSON object includes a data property', function test( t ) {
155158
values = [
156159
new Float64Array( [ 1.0 ] ),
157160
new Float32Array( [ 2.0 ] ),
158-
new Int32Array( [ 3.0 ] ),
159-
new Uint32Array( [ 4.0 ] ),
160-
new Int16Array( [ 5.0 ] ),
161-
new Uint16Array( [ 6.0 ] ),
162-
new Int8Array( [ 7.0 ] ),
163-
new Uint8Array( [ 8.0 ] ),
164-
new Uint8ClampedArray( [ 9.0 ] ),
161+
new Float16Array( [ 3.0 ] ),
162+
new Int32Array( [ 4.0 ] ),
163+
new Uint32Array( [ 5.0 ] ),
164+
new Int16Array( [ 6.0 ] ),
165+
new Uint16Array( [ 7.0 ] ),
166+
new Int8Array( [ 8.0 ] ),
167+
new Uint8Array( [ 9.0 ] ),
168+
new Uint8ClampedArray( [ 10.0 ] ),
165169
new Complex64Array( [ 1.0, 2.0 ] ),
166170
new Complex128Array( [ 1.0, 2.0 ] ),
167171
new BooleanArray( [ true, false ] )
@@ -177,6 +181,7 @@ tape( 'the JSON object includes a data property', function test( t ) {
177181
[ 7.0 ],
178182
[ 8.0 ],
179183
[ 9.0 ],
184+
[ 10.0 ],
180185
[ 1.0, 2.0 ],
181186
[ 1.0, 2.0 ],
182187
[ 1, 0 ]

‎to-json/test/test.type.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var Int16Array = require( './../../int16' );
2929
var Uint16Array = require( './../../uint16' );
3030
var Int32Array = require( './../../int32' );
3131
var Uint32Array = require( './../../uint32' );
32+
var Float16Array = require( './../../float16' );
3233
var Float32Array = require( './../../float32' );
3334
var Float64Array = require( './../../float64' );
3435
var Complex64Array = require( './../../complex64' );
@@ -53,6 +54,7 @@ tape( 'if provided a typed array, the function returns the closest typed array t
5354
values = [
5455
new Float64Array( [ 5.0, 3.0 ] ),
5556
new Float32Array( [ 5.0, 3.0 ] ),
57+
new Float16Array( [ 5.0, 3.0 ] ),
5658
new Int32Array( [ 5, 3 ] ),
5759
new Uint32Array( [ 5, 3 ] ),
5860
new Int16Array( [ 5, 3 ] ),
@@ -68,6 +70,7 @@ tape( 'if provided a typed array, the function returns the closest typed array t
6870
expected = [
6971
'Float64Array',
7072
'Float32Array',
73+
'Float16Array',
7174
'Int32Array',
7275
'Uint32Array',
7376
'Int16Array',
@@ -99,6 +102,7 @@ tape( 'if provided a typed array from a different realm, the function returns th
99102
values = [
100103
new Float64Array( [ 5.0, 3.0 ] ),
101104
new Float32Array( [ 5.0, 3.0 ] ),
105+
new Float16Array( [ 5.0, 3.0 ] ),
102106
new Int32Array( [ 5, 3 ] ),
103107
new Uint32Array( [ 5, 3 ] ),
104108
new Int16Array( [ 5, 3 ] ),
@@ -114,6 +118,7 @@ tape( 'if provided a typed array from a different realm, the function returns th
114118
expected = [
115119
'Float64Array',
116120
'Float32Array',
121+
'Float16Array',
117122
'Int32Array',
118123
'Uint32Array',
119124
'Int16Array',

0 commit comments

Comments
 (0)