time-to-botec

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

repl.txt (1346B)


      1 
      2 {{alias}}( bstr )
      3     Creates a single-precision floating-point number from an IEEE 754 literal
      4     bit representation.
      5 
      6     Parameters
      7     ----------
      8     bstr: string
      9         Literal bit representation.
     10 
     11     Returns
     12     -------
     13     out: float
     14         Single-precision floating-point number.
     15 
     16     Examples
     17     --------
     18     > var bstr = '01000000100000000000000000000000';
     19     > var val = {{alias}}( bstr )
     20     4.0
     21     > bstr = '01000000010010010000111111011011';
     22     > val = {{alias}}( bstr )
     23     ~3.14
     24     > bstr = '11111111011011000011101000110011';
     25     > val = {{alias}}( bstr )
     26     ~-3.14e+38
     27 
     28     // The function handles subnormals:
     29     > bstr = '10000000000000000000000000010110';
     30     > val = {{alias}}( bstr )
     31     ~-3.08e-44
     32     > bstr = '00000000000000000000000000000001';
     33     > val = {{alias}}( bstr )
     34     ~1.40e-45
     35 
     36     // The function handles special values:
     37     > bstr = '00000000000000000000000000000000';
     38     > val = {{alias}}( bstr )
     39     0.0
     40     > bstr = '10000000000000000000000000000000';
     41     > val = {{alias}}( bstr )
     42     -0.0
     43     > bstr = '01111111110000000000000000000000';
     44     > val = {{alias}}( bstr )
     45     NaN
     46     > bstr = '01111111100000000000000000000000';
     47     > val = {{alias}}( bstr )
     48     Infinity
     49     > bstr = '11111111100000000000000000000000';
     50     > val = {{alias}}( bstr )
     51     -Infinity
     52 
     53     See Also
     54     --------
     55