@stdlib/number-float16-base-sub
v0.1.1
Published
Subtract two half-precision floating-point numbers.
Readme
sub
Subtract two half-precision floating-point numbers.
Installation
npm install @stdlib/number-float16-base-subUsage
var sub = require( '@stdlib/number-float16-base-sub' );sub( x, y )
Subtracts two half-precision floating-point numbers.
var v = sub( -1.0, 5.0 );
// returns -6.0
v = sub( 2.0, 5.0 );
// returns -3.0
v = sub( 0.0, 5.0 );
// returns -5.0
v = sub( -0.0, 0.0 );
// returns -0.0
v = sub( NaN, NaN );
// returns NaNExamples
var toFloat16 = require( '@stdlib/number-float64-base-to-float16' );
var uniform = require( '@stdlib/random-array-uniform' );
var map = require( '@stdlib/array-base-map' );
var logEachMap = require( '@stdlib/console-log-each-map' );
var sub = require( '@stdlib/number-float16-base-sub' );
var x = map( uniform( 100, -50.0, 50.0 ), toFloat16 );
var y = map( uniform( 100, -50.0, 50.0 ), toFloat16 );
logEachMap( 'x: %f, y: %f => %f', x, y, sub );Notice
This package is part of 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.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
