time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

index.js (2349B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 /**
     22 * Create a double-precision floating-point number from a literal bit representation.
     23 *
     24 * @module @stdlib/number/float64/base/from-binary-string
     25 *
     26 * @example
     27 * var fromBinaryString = require( '@stdlib/number/float64/base/from-binary-string' );
     28 *
     29 * var bstr = '0100000000010000000000000000000000000000000000000000000000000000';
     30 * var val = fromBinaryString( bstr );
     31 * // returns 4.0
     32 *
     33 * bstr = '0100000000001001001000011111101101010100010001000010110100011000';
     34 * val = fromBinaryString( bstr );
     35 * // returns 3.141592653589793
     36 *
     37 * bstr = '1111111111100001110011001111001110000101111010111100100010100000';
     38 * val = fromBinaryString( bstr );
     39 * // returns -1.0e308
     40 *
     41 * bstr = '1000000000000000000000000000000000000000000000000001100011010011';
     42 * val = fromBinaryString( bstr );
     43 * // returns -3.14e-320
     44 *
     45 * bstr = '0000000000000000000000000000000000000000000000000000000000000001';
     46 * val = fromBinaryString( bstr );
     47 * // returns 5.0e-324
     48 *
     49 * bstr = '0000000000000000000000000000000000000000000000000000000000000000';
     50 * val = fromBinaryString( bstr );
     51 * // returns 0.0
     52 *
     53 * bstr = '1000000000000000000000000000000000000000000000000000000000000000';
     54 * val = fromBinaryString( bstr );
     55 * // returns -0.0
     56 *
     57 * bstr = '0111111111111000000000000000000000000000000000000000000000000000';
     58 * val = fromBinaryString( bstr );
     59 * // returns NaN
     60 *
     61 * bstr = '0111111111110000000000000000000000000000000000000000000000000000';
     62 * val = fromBinaryString( bstr );
     63 * // returns Infinity
     64 *
     65 * bstr = '1111111111110000000000000000000000000000000000000000000000000000';
     66 * val = fromBinaryString( bstr );
     67 * // returns -Infinity
     68 */
     69 
     70 // MODULES //
     71 
     72 var fromBinaryString = require( './main.js' );
     73 
     74 
     75 // EXPORTS //
     76 
     77 module.exports = fromBinaryString;