Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "math/base/special/frexp/docs/types/index.d"

Index

Functions

Functions

Export assignment frexp

  • Splits a double-precision floating-point number into a normalized fraction and an integer power of two.

    Notes

    • The first element of the returned array is the normalized fraction and the second is the exponent. The normalized fraction and exponent satisfy the relation x = frac * 2^exp.
    • If provided positive or negative zero, NaN, or positive or negative infinity, the function returns a two-element array containing the input value and an exponent equal to zero.
    • For all other numeric input values, the absolute value of the normalized fraction resides on the interval [0.5,1).

    Parameters

    • out: Collection

      output array

    • x: number

      input value

    Returns Collection

    output array

    Example

    var Float64Array = require( `@stdlib/array/float64` );
    
    var out = new Float64Array( 2 );
    
    var y = frexp( out, 4.0 );
    // returns <Float64Array>[ 0.5, 3 ]
    
    var bool = ( y === out );
    // returns true
  • Splits a double-precision floating-point number into a normalized fraction and an integer power of two.

    Notes

    • The first element of the returned array is the normalized fraction and the second is the exponent. The normalized fraction and exponent satisfy the relation x = frac * 2^exp.
    • If provided positive or negative zero, NaN, or positive or negative infinity, the function returns a two-element array containing the input value and an exponent equal to zero.
    • For all other numeric input values, the absolute value of the normalized fraction resides on the interval [0.5,1).

    Parameters

    • x: number

      input value

    Returns Collection

    output array

    Example

    var out = frexp( 4.0 );
    // returns [ 0.5, 3 ]

    Example

    var out = frexp( 0.0 );
    // returns [ 0.0, 0 ]

    Example

    var out = frexp( -0.0 );
    // returns [ -0.0, 0 ]

    Example

    var out = frexp( NaN );
    // returns [ NaN, 0 ]

    Example

    var out = frexp( Infinity );
    // returns [ Infinity , 0 ]

    Example

    var out = frexp( -Infinity );
    // returns [ -Infinity , 0 ]