Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var ctor = ctors( 'float64' );

The function returns constructors for the following data types:

- `float16`: half-precision floating-point numbers.
- `float32`: single-precision floating-point numbers.
- `float64`: double-precision floating-point numbers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

The function returns constructors for the following data types:

- float16: half-precision floating-point numbers.
- float32: single-precision floating-point numbers.
- float64: double-precision floating-point numbers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@

// TypeScript Version: 4.1

import Float16Array = require( '@stdlib/array/float16' );


/**
* Returns a `Float64Array` constructor.
*
Expand All @@ -42,6 +45,18 @@ declare function ctors( dtype: 'float64' ): typeof Float64Array;
*/
declare function ctors( dtype: 'float32' ): typeof Float32Array;

/**
* Returns a `Float16Array` constructor.
*
* @param dtype - data type
* @returns constructor
*
* @example
* var ctor = ctors( 'float16' );
* // returns <Function>
*/
declare function ctors( dtype: 'float16' ): typeof Float16Array;

/**
* Returns a real-valued floating-point typed array constructor.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import ctors = require( './index' );
{
ctors( 'float64' ); // $ExpectType Float64ArrayConstructor
ctors( 'float32' ); // $ExpectType Float32ArrayConstructor
ctors( 'float16' ); // $ExpectType Float16ArrayConstructor
ctors( 'float' ); // $ExpectType Function | null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@

var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
var Float16Array = require( '@stdlib/array/float16' );


// MAIN //

// Mapping from data types to constructors...
var ctors = {
'float64': Float64Array,
'float32': Float32Array
'float32': Float32Array,
'float16': Float16Array
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var tape = require( 'tape' );
var dtypes = require( '@stdlib/array/typed-real-float-dtypes' );
var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
var Float16Array = require( '@stdlib/array/float16' );
var isFunction = require( '@stdlib/assert/is-function' );
var ctors = require( './../lib' );

Expand All @@ -44,11 +45,13 @@ tape( 'the function returns typed array constructors', function test( t ) {

dtypes = [
'float64',
'float32'
'float32',
'float16'
];
expected = [
Float64Array,
Float32Array
Float32Array,
Float16Array
];
for ( i = 0; i < dtypes.length; i++ ) {
ctor = ctors( dtypes[ i ] );
Expand Down