Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "array/min-dtype/docs/types/index.d"

Index

Functions

Functions

Export assignment minDataType

  • Returns the minimum array data type of the closest "kind" necessary for storing a provided scalar value.

    Notes

    • The function does not provide precision guarantees for non-integer-valued real numbers. In other words, the function returns the smallest possible floating-point (i.e., inexact) data type for storing numbers having decimals.

    Parameters

    • value: number

      scalar value

    Returns RealDataType

    array data type

    Example

    var dt = minDataType( 3.141592653589793 );
    // returns 'float32'

    Example

    var dt = minDataType( 3 );
    // returns 'uint8'
  • Returns the minimum array data type of the closest "kind" necessary for storing a provided scalar value.

    Notes

    • The function does not provide precision guarantees for non-integer-valued real numbers. In other words, the function returns the smallest possible floating-point (i.e., inexact) data type for storing numbers having decimals.

    Parameters

    Returns ComplexDataType

    array data type

    Example

    var z = {
        're': 3.141592653589793,
        'im': 1.0
    };
    var dt = minDataType( z );
    // returns 'complex64'
  • Returns the minimum array data type of the closest "kind" necessary for storing a provided scalar value.

    Notes

    • The function does not provide precision guarantees for non-integer-valued real numbers. In other words, the function returns the smallest possible floating-point (i.e., inexact) data type for storing numbers having decimals.

    Parameters

    • value: any

      scalar value

    Returns "generic"

    array data type

    Example

    var dt = minDataType( 'beep' );
    // returns 'generic'