expm1

Contents

expm1#

class saiunit.math.expm1(x, unit_to_scale=None, **kwargs)#

Calculate exp(x) - 1 element-wise with improved precision near zero.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | saiunit.Quantity) – Input array or Quantity.

  • unit_to_scale (saiunit.Unit | None) – Unit used to convert x to a dimensionless number first.

Returns:

out – Element-wise exp(x) - 1.

Return type:

Array

Examples

>>> import saiunit as u
>>> import jax.numpy as jnp
>>> u.math.expm1(jnp.array([0.0, 1e-10]))
Array([0.e+00, 1.e-10], dtype=float32)