README.md (2390B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # Exponent Mask 22 23 > High word mask for the exponent of a [double-precision floating-point number][ieee754]. 24 25 <section class="usage"> 26 27 ## Usage 28 29 <!-- eslint-disable id-length --> 30 31 ```javascript 32 var FLOAT64_HIGH_WORD_EXPONENT_MASK = require( '@stdlib/constants/float64/high-word-exponent-mask' ); 33 ``` 34 35 #### FLOAT64_HIGH_WORD_EXPONENT_MASK 36 37 High word mask for the exponent of a [double-precision floating-point number][ieee754]. 38 39 <!-- eslint-disable id-length --> 40 41 ```javascript 42 // 0x7ff00000 = 2146435072 => 0 11111111111 00000000000000000000 43 var bool = ( FLOAT64_HIGH_WORD_EXPONENT_MASK === 0x7ff00000 ); 44 // returns true 45 ``` 46 47 </section> 48 49 <!-- /.usage --> 50 51 <section class="notes"> 52 53 ## Notes 54 55 - The higher order word of a [double-precision floating-point number][ieee754] is a 32-bit integer containing the more significant bits which include the exponent and sign. 56 57 </section> 58 59 <!-- /.notes --> 60 61 <section class="examples"> 62 63 ## Examples 64 65 <!-- eslint-disable id-length --> 66 67 <!-- eslint no-undef: "error" --> 68 69 ```javascript 70 var getHighWord = require( '@stdlib/number/float64/base/get-high-word' ); 71 var FLOAT64_HIGH_WORD_EXPONENT_MASK = require( '@stdlib/constants/float64/high-word-exponent-mask' ); 72 73 var out; 74 var hi; 75 var x; 76 77 x = 11.5; 78 hi = getHighWord( x ); // => 0 10000000010 01110000000000000000 79 // returns 1076297728 80 81 // Mask off all bits except for the exponent bits: 82 out = hi & FLOAT64_HIGH_WORD_EXPONENT_MASK; // => 0 10000000010 00000000000000000000 83 // returns 1075838976 84 85 // Mask on the exponent bits and leave other bits unchanged: 86 out = hi | FLOAT64_HIGH_WORD_EXPONENT_MASK; // => 0 11111111111 01110000000000000000 87 // returns 2146893824 88 ``` 89 90 </section> 91 92 <!-- /.examples --> 93 94 <section class="links"> 95 96 [ieee754]: http://en.wikipedia.org/wiki/IEEE_754-1985 97 98 </section> 99 100 <!-- /.links -->