File: repl.txt

package info (click to toggle)
node-stdlib 0.0.96%2Bds1%2B~cs0.0.429-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 421,476 kB
  • sloc: javascript: 1,562,831; ansic: 109,702; lisp: 49,823; cpp: 27,224; python: 7,871; sh: 6,807; makefile: 6,089; fortran: 3,102; awk: 387
file content (52 lines) | stat: -rw-r--r-- 1,548 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

{{alias}}( [out,] x )
    Returns a normal number `y` and exponent `exp` satisfying `x = y * 2^exp` as
    an array.

    The first element of the returned array corresponds to `y` and the second to
    `exp`.

    While the function accepts higher precision floating-point numbers, beware
    that providing such numbers can be a source of subtle bugs as the relation
    `x = y * 2^exp` may not hold.

    Parameters
    ----------
    out: Array|TypedArray|Object (optional)
        Output array.

    x: float
        Single-precision floating-point number.

    Returns
    -------
    out: Array|TypedArray|Object
        An array containing `y` and `exp`.

    Examples
    --------
    > var out = {{alias}}( {{alias:@stdlib/number/float64/base/to-float32}}( 1.401e-45 ) )
    [ 1.1754943508222875e-38, -23 ]
    > var y = out[ 0 ];
    > var exp = out[ 1 ];
    > var bool = ( y*{{alias:@stdlib/math/base/special/pow}}(2,exp) === {{alias:@stdlib/number/float64/base/to-float32}}(1.401e-45) )
    true

    // Special cases:
    > out = {{alias}}( {{alias:@stdlib/constants/float32/pinf}} )
    [ Infinity, 0 ]
    > out = {{alias}}( {{alias:@stdlib/constants/float32/ninf}} )
    [ -Infinity, 0 ]
    > out = {{alias}}( NaN )
    [ NaN, 0 ]

    // Provide an output array:
    > out = new {{alias:@stdlib/array/float32}}( 2 );
    > var v = {{alias}}( out, {{alias:@stdlib/number/float64/base/to-float32}}( 1.401e-45 ) )
    <Float32Array>[ 1.1754943508222875e-38, -23.0 ]
    > bool = ( v === out )
    true

    See Also
    --------