diff --git a/lib/node_modules/@stdlib/number/float16/base/mul/README.md b/lib/node_modules/@stdlib/number/float16/base/mul/README.md index 1227ce4d5d9f..4a98ec6a9d0e 100644 --- a/lib/node_modules/@stdlib/number/float16/base/mul/README.md +++ b/lib/node_modules/@stdlib/number/float16/base/mul/README.md @@ -82,20 +82,122 @@ v = mul( NaN, NaN ); ```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +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 mul = require( '@stdlib/number/float16/base/mul' ); -var x = discreteUniform( 100, -50, 50 ); -var y = discreteUniform( 100, -50, 50 ); +// Create arrays of random half-precision floating-point numbers: +var x = map( uniform( 100, -50.0, 50.0 ), toFloat16 ); +var y = map( uniform( 100, -50.0, 50.0 ), toFloat16 ); -logEachMap( '%d x %d = %d', x, y, mul ); +// Perform multiplication on half-precision floating-point numbers: +logEachMap( 'x: %f, y: %f => %f', x, y, mul ); ``` + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/number/float16/base/mul.h" +``` + +#### stdlib_base_float16_mul( x, y ) + +Multiplies two half-precision floating-point numbers. + +```c +#include "stdlib/number/float16/ctor.h" + +stdlib_float16_t x = stdlib_float16_from_bits( 17664 ); // => 5.0 +stdlib_float16_t y = stdlib_float16_from_bits( 16384 ); // => 2.0 + +stdlib_float16_t v = stdlib_base_float16_mul( x, y ); +``` + +The function accepts the following arguments: + +- **x**: `[in] stdlib_float16_t` first input value. +- **y**: `[in] stdlib_float16_t` second input value. + +```c +stdlib_float16_t stdlib_base_float16_mul( const stdlib_float16_t x, const stdlib_float16_t y ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/number/float16/base/mul.h" +#include "stdlib/number/float16/ctor.h" +#include "stdlib/number/float32/base/to_float16.h" +#include "stdlib/number/float16/base/to_float32.h" +#include + +int main( void ) { + const float x[] = { 3.14f, -3.14f, 0.0f, 0.0f/0.0f }; + const float y[] = { 3.14f, -3.14f, -0.0f, 0.0f/0.0f }; + + stdlib_float16_t a; + stdlib_float16_t b; + stdlib_float16_t z; + int i; + for ( i = 0; i < 4; i++ ) { + a = stdlib_base_float32_to_float16( x[ i ] ); + b = stdlib_base_float32_to_float16( y[ i ] ); + z = stdlib_base_float16_mul( a, b ); + printf( "%f x %f = %f\n", stdlib_base_float16_to_float32( a ), stdlib_base_float16_to_float32( b ), stdlib_base_float16_to_float32( z ) ); + } +} +``` + +
+ + + +
+ + +