FLOAT32_SIGNIFICAND_MASK

Mask for the significand of a single-precision floating-point number.

Usage

var FLOAT32_SIGNIFICAND_MASK = require( '@stdlib/constants/float32/significand-mask' );

FLOAT32_SIGNIFICAND_MASK

Mask for the significand of a single-precision floating-point number.

// 0x007fffff = 8388607 => 0 00000000 11111111111111111111111
var bool = ( FLOAT32_SIGNIFICAND_MASK === 0x007fffff );
// returns true

Examples

var toWord = require( '@stdlib/number/float32/base/to-word' );
var FLOAT32_SIGNIFICAND_MASK = require( '@stdlib/constants/float32/significand-mask' );

var x = 11.5;
var w = toWord( x ); // 0 10000010 01110000000000000000000
// returns 1094189056

// Mask off all bits except for the significand bits:
var out = w & FLOAT32_SIGNIFICAND_MASK; // 0 00000000 01110000000000000000000
// returns 3670016

// Mask on the significand bits and leave other bits unchanged:
out = w | FLOAT32_SIGNIFICAND_MASK; // 0 10000010 11111111111111111111111
// returns 1098907647

C APIs

Usage

#include "stdlib/constants/float32/significand_mask.h"

STDLIB_CONSTANT_FLOAT32_SIGNIFICAND_MASK

Macro for the mask for the significand of a single-precision floating-point number.

Did you find this page helpful?