File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
lib/node_modules/@stdlib/number/float16/base/to-word/benchmark/c Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1818
1919#include "stdlib/number/float16/base/to_word.h"
2020#include "stdlib/number/float64/base/to_float16.h"
21+ #include "stdlib/number/float64/ctor.h"
2122#include <stdlib.h>
2223#include <stdio.h>
2324#include <stdint.h>
@@ -92,19 +93,19 @@ static double rand_double( void ) {
9293* @return elapsed time in seconds
9394*/
9495static double benchmark ( void ) {
95- double x [ 100 ];
96+ stdlib_float16_t x [ 100 ];
9697 double elapsed ;
9798 uint16_t w ;
9899 double t ;
99100 int i ;
100101
101102 for ( i = 0 ; i < 100 ; i ++ ) {
102- x [ i ] = ( 1000.0 * rand_double () ) - 500.0 ;
103+ x [ i ] = stdlib_base_float64_to_float16 ( ( 1000.0 * rand_double () ) - 500.0 ) ;
103104 }
104105
105106 t = tic ();
106107 for ( i = 0 ; i < ITERATIONS ; i ++ ) {
107- stdlib_base_float16_to_word ( stdlib_base_float64_to_float16 ( x [ i % 100 ] ) , & w );
108+ stdlib_base_float16_to_word ( x [ i % 100 ], & w );
108109 if ( w == 1 ) { // Note: should not generate the smallest subnormal
109110 printf ( "unexpected result\n" );
110111 break ;
You can’t perform that action at this time.
0 commit comments