text: /**
  * @license Apache-2.0
  *
  * Copyright (c) 2020 The Stdlib Authors.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  
  'use strict';
  
  // MODULES //
  
  var resolve = require( 'path' ).resolve;
  var tape = require( 'tape' );
  var invf = require( '@stdlib/math/base/special/invf' );
  var uniform = require( '@stdlib/random/base/uniform' ).factory;
  var Float32Array = require( '@stdlib/array/float32' );
  var tryRequire = require( '@stdlib/utils/try-require' );
  
  
  // VARIABLES //
  
  var sinv = tryRequire( resolve( __dirname, './../lib/sinv.native.js' ) );
  var opts = {
  	'skip': ( sinv instanceof Error )
  };
  var rand = uniform( -50.0, 50.0 );
  
  
  // TESTS //
  
  tape( 'main export is a function', opts, function test( t ) {
  	t.ok( true, __filename );
  	t.strictEqual( typeof sinv, 'function', 'main export is a function' );
  	t.end();
  });
  
  tape( 'the function has an arity of 5', opts, function test( t ) {
  	t.strictEqual( sinv.length, 5, 'arity of 5' );
  	t.end();
  });
  
  tape( 'the function computes the multiplicative inverse for each element', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  	var i;
  
  	x = new Float32Array( 10 );
  	y = new Float32Array( x.length );
  
  	expected = new Float32Array( x.length );
  	for ( i = 0; i < x.length; i++ ) {
  		x[ i ] = rand();
  		expected[ i ] = invf( x[ i ] );
  	}
  
  	sinv( x.length, x, 1, y, 1 );
  
  	t.deepEqual( y, expected, 'deep equal' );
  	t.end();
  });
  
  tape( 'the function supports an `x` stride', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  	var N;
  
  	x = new Float32Array([
  		rand(), // 0
  		rand(),
  		rand(), // 1
  		rand(),
  		rand()  // 2
  	]);
  	y = new Float32Array([
  		0.0, // 0
  		0.0, // 1
  		0.0, // 2
  		0.0,
  		0.0
  	]);
  	N = 3;
  
  	sinv( N, x, 2, y, 1 );
  
  	expected = new Float32Array([
  		invf( x[ 0 ] ),
  		invf( x[ 2 ] ),
  		invf( x[ 4 ] ),
  		0.0,
  		0.0
  	]);
  
  	t.deepEqual( y, expected, 'deep equal' );
  	t.end();
  });
  
  tape( 'the function supports a `y` stride', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  	var N;
  
  	x = new Float32Array([
  		rand(), // 0
  		rand(), // 1
  		rand(), // 2
  		rand(),
  		rand()
  	]);
  	y = new Float32Array([
  		0.0, // 0
  		0.0,
  		0.0, // 1
  		0.0,
  		0.0  // 2
  	]);
  	N = 3;
  
  	sinv( N, x, 1, y, 2 );
  
  	expected = new Float32Array([
  		invf( x[ 0 ] ),
  		0.0,
  		invf( x[ 1 ] ),
  		0.0,
  		invf( x[ 2 ] )
  	]);
  
  	t.deepEqual( y, expected, 'deep equal' );
  	t.end();
  });
  
  tape( 'the function returns a reference to the destination array', opts, function test( t ) {
  	var out;
  	var x;
  	var y;
  
  	x = new Float32Array( 5 );
  	y = new Float32Array( x.length );
  
  	out = sinv( x.length, x, 1, y, 1 );
  
  	t.strictEqual( out, y, 'same reference' );
  	t.end();
  });
  
  tape( 'if provided an `N` parameter less than or equal to `0`, the function returns `y` unchanged', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  
  	x = new Float32Array( [ rand(), rand(), rand(), rand(), rand() ] );
  	y = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
  
  	expected = new Float32Array( [ 0.0, 0.0, 0.0, 0.0, 0.0 ] );
  
  	sinv( -1, x, 1, y, 1 );
  	t.deepEqual( y, expected, 'returns `y` unchanged' );
  
  	sinv( 0, x, 1, y, 1 );
  	t.deepEqual( y, expected, 'returns `y` unchanged' );
  
  	t.end();
  });
  
  tape( 'the function supports negative strides', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  	var N;
  
  	x = new Float32Array([
  		rand(), // 2
  		rand(),
  		rand(), // 1
  		rand(),
  		rand()  // 0
  	]);
  	y = new Float32Array([
  		0.0, // 2
  		0.0, // 1
  		0.0, // 0
  		0.0,
  		0.0
  	]);
  	N = 3;
  
  	sinv( N, x, -2, y, -1 );
  
  	expected = new Float32Array([
  		invf( x[ 0 ] ),
  		invf( x[ 2 ] ),
  		invf( x[ 4 ] ),
  		0.0,
  		0.0
  	]);
  
  	t.deepEqual( y, expected, 'deep equal' );
  	t.end();
  });
  
  tape( 'the function supports complex access patterns', opts, function test( t ) {
  	var expected;
  	var x;
  	var y;
  	var N;
  
  	x = new Float32Array([
  		rand(), // 0
  		rand(),
  		rand(), // 1
  		rand(),
  		rand(), // 2
  		rand()
  	]);
  	y = new Float32Array([
  		0.0,  // 2
  		0.0,  // 1
  		0.0,  // 0
  		0.0,
  		0.0,
  		0.0
  	]);
  	N = 3;
  
  	sinv( N, x, 2, y, -1 );
  
  	expected = new Float32Array([
  		invf( x[ 4 ] ),
  		invf( x[ 2 ] ),
  		invf( x[ 0 ] ),
  		0.0,
  		0.0,
  		0.0
  	]);
  
  	t.deepEqual( y, expected, 'deep equal' );
  	t.end();
  });
  
  tape( 'the function supports view offsets', opts, function test( t ) {
  	var expected;
  	var x0;
  	var y0;
  	var x1;
  	var y1;
  	var N;
  
  	// Initial arrays...
  	x0 = new Float32Array([
  		rand(),
  		rand(), // 2
  		rand(),
  		rand(), // 1
  		rand(),
  		rand()  // 0
  	]);
  	y0 = new Float32Array([
  		0.0,
  		0.0,
  		0.0,
  		0.0, // 0
  		0.0, // 1
  		0.0  // 2
  	]);
  
  	// Create offset views...
  	x1 = new Float32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // begin at 2nd element
  	y1 = new Float32Array( y0.buffer, y0.BYTES_PER_ELEMENT*3 ); // begin at the 4th element
  
  	N = 3;
  
  	sinv( N, x1, -2, y1, 1 );
  	expected = new Float32Array([
  		0.0,
  		0.0,
  		0.0,
  		invf( x0[ 5 ] ),
  		invf( x0[ 3 ] ),
  		invf( x0[ 1 ] )
  	]);
  
  	t.deepEqual( y0, expected, 'deep equal' );
  	t.end();
  });
  