Skip to content

Commit d5b5dd0

Browse files
chore: updaing js implementation
1 parent 2ced89c commit d5b5dd0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • lib/node_modules/@stdlib/number/float16/base/ulp-difference/lib

lib/node_modules/@stdlib/number/float16/base/ulp-difference/lib/main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ var abs = require( '@stdlib/math/base/special/abs' );
3030
// FUNCTIONS //
3131

3232
/**
33-
* Converts an unsigned 32-bit integer corresponding to the IEEE 754 binary representation of a half-precision floating-point number to a lexicographically ordered integer.
33+
* Converts an unsigned 16-bit integer corresponding to the IEEE 754 binary representation of a half-precision floating-point number to a lexicographically ordered integer.
3434
*
3535
* @private
36-
* @param {unsigned32} word - unsigned 32-bit integer
36+
* @param {unsigned16} word - unsigned 16-bit integer
3737
* @returns {integer} lexicographically ordered integer
3838
*/
3939
function monotoneKey( word ) {
4040
if ( word & SIGN_MASK ) { // x < 0
41-
return ( ~word + 1 ) &UINT16_MAX; // two's-complement negation
41+
return ( ( ~word + 1 ) &UINT16_MAX ); // two's-complement negation
4242
}
4343
// x >= 0
44-
return ( word | SIGN_MASK ) &UINT16_MAX; // push +0 to just above -0
44+
return ( word | SIGN_MASK ) >>> 0; // push +0 to just above -0
4545
}
4646

4747

@@ -87,7 +87,7 @@ function ulpdiff( x, y ) {
8787
if ( isnan( x ) || isnan( y ) ) {
8888
return NaN;
8989
}
90-
// Convert input values to unsigned 32-bit integers corresponding to the IEEE 754 binary representation of half-precision floating-point numbers:
90+
// Convert input values to unsigned 16-bit integers corresponding to the IEEE 754 binary representation of half-precision floating-point numbers:
9191
wx = toWord( x );
9292
wy = toWord( y );
9393

0 commit comments

Comments
 (0)