Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 1.84 KB

info.md

File metadata and controls

62 lines (40 loc) · 1.84 KB

info

Describe the range and storage details of a data type.

API

Numeric.dtype.info(input = 'float64')

Reports the range and storage details of a type.

  • Parameters:
    • input: Data type name or value to describe
  • Returns: Descriptor of the requested data type
  • NumPy: Covers np.finfo, np.iinfo, np.shape, np.ndim, np.size, ndarray.shape, ndarray.ndim, ndarray.size, ndarray.dtype, ndarray.itemsize, ndarray.nbytes through a single Numerix method.

Examples

Describe an unsigned byte type

import Numeric from '@neabyte/numerix'

const descriptor = Numeric.dtype.info('uint8')

console.log(descriptor)
// {"dtype":"uint8","bits":8,"eps":1,"itemSize":1,"max":255,"min":0,"shape":[],"ndim":0,"size":0,"nbytes":0}

Describe the default floating point type

import Numeric from '@neabyte/numerix'

const descriptor = Numeric.dtype.info('float64')

console.log(descriptor)
// {"dtype":"float64","bits":64,"eps":2.220446049250313e-16,"itemSize":8,"max":1.7976931348623157e+308,"min":-1.7976931348623157e+308,"tiny":2.2250738585072014e-308,"shape":[],"ndim":0,"size":0,"nbytes":0}

Describe an array of values

import Numeric from '@neabyte/numerix'

const descriptor = Numeric.dtype.info([1, 2, 3])

console.log(descriptor)
// {"dtype":"float64","bits":64,"eps":2.220446049250313e-16,"itemSize":8,"max":1.7976931348623157e+308,"min":-1.7976931348623157e+308,"tiny":2.2250738585072014e-308,"shape":[3],"ndim":1,"size":3,"nbytes":24}

Describe a single floating point value

import Numeric from '@neabyte/numerix'

const descriptor = Numeric.dtype.info(1.5)

console.log(descriptor)
// {"dtype":"float64","bits":64,"eps":2.220446049250313e-16,"itemSize":8,"max":1.7976931348623157e+308,"min":-1.7976931348623157e+308,"tiny":2.2250738585072014e-308,"shape":[],"ndim":0,"size":1,"nbytes":8}