# xarray.ufuncs.expm1

### xarray.ufuncs.expm1 *= <xarray.ufuncs._unary_ufunc object>*

xarray specific variant of `numpy.expm1()`. Handles xarray objects by dispatching to the appropriate function for the underlying array type.

Documentation from numpy:

Calculate `exp(x) - 1` for all elements in the array.

* **Parameters:**
  * **x** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like)) – Input values.
  * **out** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray), [`None`](https://docs.python.org/3/builtins/constants.html#None), or [`tuple`](https://docs.python.org/3/builtins/stdtypes.html#tuple) of [`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) and [`None`](https://docs.python.org/3/builtins/constants.html#None), *optional*) – A location into which the result is stored. If provided, it must have
    a shape that the inputs broadcast to. If not provided or None,
    a freshly-allocated array is returned. A tuple (possible only as a
    keyword argument) must have length equal to the number of outputs.
  * **where** ([array_like](https://numpy.org/doc/stable/glossary.html#term-array_like), *optional*) – This condition is broadcast over the input. At locations where the
    condition is True, the out array will be set to the ufunc result.
    Elsewhere, the out array will retain its original value.
    Note that if an uninitialized out array is created via the default
    `out=None`, locations within it where the condition is False will
    remain uninitialized.
  * **\*\*kwargs** – For other keyword-only arguments, see the
    [ufunc docs](https://numpy.org/doc/stable/reference/ufuncs.html#ufuncs-kwargs).
* **Returns:**
  **out** ([`ndarray`](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray) or [scalar](../user-guide/terminology.html.md#term-scalar)) – Element-wise exponential minus one: `out = exp(x) - 1`.
  This is a scalar if x is a scalar.

#### SEE ALSO
[`log1p`](xarray.ufuncs.log1p.html.md#xarray.ufuncs.log1p)
: `log(1 + x)`, the inverse of expm1.

### Notes

This function provides greater precision than `exp(x) - 1`
for small values of `x`.

### Examples

<div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesShowIframe('ab0c48f5-db78-4ba7-acf7-694ad450c1a5','4b32a20a-0c73-4480-8238-27bbeee5e685','8b3e0404-bd9f-4457-821e-208c53d7f545','../lite/tree/../notebooks/index.html?path=65dfcb24_98d6_4970_ad6c_b5f9e402d0bb.ipynb','None')">Try it in your browser!</button></div>

The true value of `exp(1e-10) - 1` is `1.00000000005e-10` to
about 32 significant digits. This example shows the superiority of
expm1 in this case.

```pycon
>>> import numpy as np
>>> np.expm1(1e-10)
1.00000000005e-10
>>> np.exp(1e-10) - 1
1.000000082740371e-10
```

<div id="8b3e0404-bd9f-4457-821e-208c53d7f545" class="try_examples_outer_iframe  hidden"><div class="try_examples_button_container"><button class="try_examples_button" onclick="window.tryExamplesHideIframe('ab0c48f5-db78-4ba7-acf7-694ad450c1a5','8b3e0404-bd9f-4457-821e-208c53d7f545')">Go Back</button><button class="try_examples_button" onclick="window.openInNewTab('ab0c48f5-db78-4ba7-acf7-694ad450c1a5','8b3e0404-bd9f-4457-821e-208c53d7f545')">Open In Tab</button></div><div id="4b32a20a-0c73-4480-8238-27bbeee5e685" class="jupyterlite_sphinx_iframe_container"></div></div><script>document.addEventListener("DOMContentLoaded", function() {window.loadTryExamplesConfig("../try_examples.json");});</script>
