@@ -42,8 +42,8 @@ function caml_ba_get_size(dims) {
4242 return size ;
4343}
4444
45- //Provides: caml_unpackFloat16
46- var caml_unpackFloat16 = ( function ( ) {
45+ //Provides: caml_double_of_float16 pure
46+ var caml_double_of_float16 = ( function ( ) {
4747 var pow = Math . pow ;
4848
4949 var EXP_MASK16 = 31 ; // 2 ** 5 - 1
@@ -72,8 +72,8 @@ var caml_unpackFloat16 = (function () {
7272 } ;
7373} ) ( ) ;
7474
75- //Provides: caml_packFloat16
76- var caml_packFloat16 = ( function ( ) {
75+ //Provides: caml_float16_of_double pure
76+ var caml_float16_of_double = ( function ( ) {
7777 const INVERSE_OF_EPSILON = 1 / Number . EPSILON ;
7878
7979 function roundTiesToEven ( num ) {
@@ -252,7 +252,7 @@ var caml_ba_custom_name = "_bigarr02";
252252//Provides: Ml_Bigarray
253253//Requires: caml_array_bound_error, caml_invalid_argument, caml_ba_custom_name
254254//Requires: caml_int64_create_lo_hi, caml_int64_hi32, caml_int64_lo32
255- //Requires: caml_packFloat16, caml_unpackFloat16
255+ //Requires: caml_float16_of_double, caml_double_of_float16
256256class Ml_Bigarray {
257257 constructor ( kind , layout , dims , buffer ) {
258258 this . kind = kind ;
@@ -299,7 +299,7 @@ class Ml_Bigarray {
299299 var i = this . data [ ofs * 2 + 1 ] ;
300300 return [ 254 , r , i ] ;
301301 case 13 :
302- return caml_unpackFloat16 ( this . data [ ofs ] ) ;
302+ return caml_double_of_float16 ( this . data [ ofs ] ) ;
303303 default :
304304 return this . data [ ofs ] ;
305305 }
@@ -319,7 +319,7 @@ class Ml_Bigarray {
319319 this . data [ ofs * 2 + 1 ] = v [ 2 ] ;
320320 break ;
321321 case 13 :
322- this . data [ ofs ] = caml_packFloat16 ( v ) ;
322+ this . data [ ofs ] = caml_float16_of_double ( v ) ;
323323 break ;
324324 default :
325325 this . data [ ofs ] = v ;
@@ -356,7 +356,7 @@ class Ml_Bigarray {
356356 }
357357 break ;
358358 case 13 :
359- this . data . fill ( caml_packFloat16 ( v ) ) ;
359+ this . data . fill ( caml_float16_of_double ( v ) ) ;
360360 break ;
361361 default :
362362 this . data . fill ( v ) ;
@@ -406,8 +406,8 @@ class Ml_Bigarray {
406406 break ;
407407 case 13 :
408408 for ( var i = 0 ; i < this . data . length ; i ++ ) {
409- var aa = caml_unpackFloat16 ( this . data [ i ] ) ;
410- var bb = caml_unpackFloat16 ( b . data [ i ] ) ;
409+ var aa = caml_double_of_float16 ( this . data [ i ] ) ;
410+ var bb = caml_double_of_float16 ( b . data [ i ] ) ;
411411 if ( aa < bb ) return - 1 ;
412412 if ( aa > bb ) return 1 ;
413413 }
@@ -769,7 +769,7 @@ function caml_ba_reshape(ba, vind) {
769769//Provides: caml_ba_serialize
770770//Requires: caml_int64_bits_of_float, caml_int64_to_bytes
771771//Requires: caml_int32_bits_of_float
772- //Requires: caml_packFloat16
772+ //Requires: caml_float16_of_double
773773function caml_ba_serialize ( writer , ba , sz ) {
774774 writer . write ( 32 , ba . dims . length ) ;
775775 writer . write ( 32 , ba . kind | ( ba . layout << 8 ) ) ;
@@ -859,7 +859,7 @@ function caml_ba_serialize(writer, ba, sz) {
859859//Requires: caml_int64_of_bytes, caml_int64_float_of_bits
860860//Requires: caml_int32_float_of_bits
861861//Requires: caml_ba_create_buffer
862- //Requires: caml_unpackFloat16
862+ //Requires: caml_double_of_float16
863863function caml_ba_deserialize ( reader , sz , name ) {
864864 var num_dims = reader . read32s ( ) ;
865865 if ( num_dims < 0 || num_dims > 16 )
@@ -985,7 +985,7 @@ function caml_ba_create_from(data1, data2, _jstyp, kind, layout, dims) {
985985
986986//Provides: caml_ba_hash const
987987//Requires: caml_ba_get_size, caml_hash_mix_int, caml_hash_mix_float
988- //Requires: caml_unpackFloat16 , caml_hash_mix_float16, caml_hash_mix_float32
988+ //Requires: caml_double_of_float16 , caml_hash_mix_float16, caml_hash_mix_float32
989989function caml_ba_hash ( ba ) {
990990 var num_elts = caml_ba_get_size ( ba . dims ) ;
991991 var h = 0 ;
0 commit comments