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..c833467040e7 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,124 @@ 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 an array of random half-precision floating-point numbers: +var x = map( uniform( 100, -50.0, 50.0 ), toFloat16 ); -logEachMap( '%d x %d = %d', x, y, mul ); +// Create an array of random half-precision floating-point numbers: +var y = map( uniform( 100, -50.0, 50.0 ), toFloat16 ); + +logEachMap( '%0.4f x %0.4f => %0.4f', 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" +#include + +stdlib_float16_t x = stdlib_float16_from_bits( 51648 ); // => -11.5 +stdlib_float16_t y = stdlib_float16_from_bits( 51648 ); // => -11.5 +stdlib_float16_t out = 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 +#include +#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 v; + stdlib_float16_t w; + stdlib_float16_t z; + int i; + for ( i = 0; i < 4; i++ ) { + v = stdlib_base_float32_to_float16( x[ i ] ); + w = stdlib_base_float32_to_float16( y[ i ] ); + z = stdlib_base_float16_mul( v[ i ], w[ i ] ); + printf( "%f x %f = %f\n", v[ i ], w[ i ], z ); + } +} ```
+
+ + +