time-to-botec

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

repl.txt (1548B)


      1 
      2 {{alias}}( [out,] x )
      3     Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp` as
      4     an array.
      5 
      6     The first element of the returned array corresponds to `y` and the second to
      7     `exp`.
      8 
      9     While the function accepts higher precision floating-point numbers, beware
     10     that providing such numbers can be a source of subtle bugs as the relation
     11     `x = y * 2^exp` may not hold.
     12 
     13     Parameters
     14     ----------
     15     out: Array|TypedArray|Object (optional)
     16         Output array.
     17 
     18     x: float
     19         Single-precision floating-point number.
     20 
     21     Returns
     22     -------
     23     out: Array|TypedArray|Object
     24         An array containing `y` and `exp`.
     25 
     26     Examples
     27     --------
     28     > var out = {{alias}}( {{alias:@stdlib/number/float64/base/to-float32}}( 1.401e-45 ) )
     29     [ 1.1754943508222875e-38, -23 ]
     30     > var y = out[ 0 ];
     31     > var exp = out[ 1 ];
     32     > var bool = ( y*{{alias:@stdlib/math/base/special/pow}}(2,exp) === {{alias:@stdlib/number/float64/base/to-float32}}(1.401e-45) )
     33     true
     34 
     35     // Special cases:
     36     > out = {{alias}}( {{alias:@stdlib/constants/float32/pinf}} )
     37     [ Infinity, 0 ]
     38     > out = {{alias}}( {{alias:@stdlib/constants/float32/ninf}} )
     39     [ -Infinity, 0 ]
     40     > out = {{alias}}( NaN )
     41     [ NaN, 0 ]
     42 
     43     // Provide an output array:
     44     > out = new {{alias:@stdlib/array/float32}}( 2 );
     45     > var v = {{alias}}( out, {{alias:@stdlib/number/float64/base/to-float32}}( 1.401e-45 ) )
     46     <Float32Array>[ 1.1754943508222875e-38, -23.0 ]
     47     > bool = ( v === out )
     48     true
     49 
     50     See Also
     51     --------
     52