diff --git a/lib/node_modules/@stdlib/number/float64/base/to-float16/README.md b/lib/node_modules/@stdlib/number/float64/base/to-float16/README.md index cffc92c6572a..a4803a8f46c5 100644 --- a/lib/node_modules/@stdlib/number/float64/base/to-float16/README.md +++ b/lib/node_modules/@stdlib/number/float64/base/to-float16/README.md @@ -75,6 +75,94 @@ logEachMap( 'float64: %f => float16: %f', x, float64ToFloat16 ); + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/number/float64/base/to_float16.h" +``` + +#### stdlib_base_float64_to_float16( x ) + +Converts a [double-precision floating-point number][ieee754] to the nearest [half-precision floating-point number][half-precision-floating-point-format]. + +```c +#include "stdlib/number/float16/ctor.h" + +stdlib_float16_t x = stdlib_base_float64_to_float16( 3.14 ); +``` + +The function accepts the following arguments: + +- **x**: `[in] double` input value. + +```c +stdlib_float16_t stdlib_base_float64_to_float16( const double x ); +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +#include "stdlib/number/float64/base/to_float16.h" +#include "stdlib/number/float16/ctor.h" +#include +#include + +int main( void ) { + const double x[] = { 3.14, -3.14, 0.0, 0.0/0.0 }; + + stdlib_float16_t v; + int i; + for ( i = 0; i < 4; i++ ) { + v = stdlib_base_float64_to_float16( x[ i ] ); + printf( "%lf => uint16: %d\n", x[ i ], stdlib_float16_to_bits( v ) ); + } +} +``` + +
+ + + +
+ + +