Skip to content

Latest commit

 

History

History
62 lines (40 loc) · 954 Bytes

frexp.md

File metadata and controls

62 lines (40 loc) · 954 Bytes

frexp

Split values into a normalized mantissa and a power of two exponent.

API

Numeric.math.frexp(value)

Decomposes each value into fraction and power.

  • Parameters:
    • value: Scalar, vector, or matrix of input values
  • Returns: Mantissa and exponent for each input value
  • NumPy: Equivalent to np.frexp.

Examples

Split one value into parts

import Numeric from '@neabyte/numerix'

const parts = Numeric.math.frexp(12)

console.log(parts)
// [0.75,4]

Split a vector into parts

import Numeric from '@neabyte/numerix'

const parts = Numeric.math.frexp([12, 8])

console.log(parts)
// [[0.75,0.5],[4,4]]

Split a negative value

import Numeric from '@neabyte/numerix'

const parts = Numeric.math.frexp(-12)

console.log(parts)
// [-0.75,4]

Split zero into parts

import Numeric from '@neabyte/numerix'

const parts = Numeric.math.frexp(0)

console.log(parts)
// [0,0]