Skip to contents

Element-wise exp(x) - 1, more accurate for small x. You can also use expm1().

Usage

nv_expm1(x)

Arguments

x

(arrayish)
One input. Can be any numeric data type: a float keeps its own, and an integer one is converted to the default float data type (see default_dtypes()). An R value materializes at its default data type and is converted in the same way.

Value

(arrayish)
Has the input's shape, and its data type – or the default float data type (see default_dtypes()) where the input was an integer one.

See also

prim_expm1() for the underlying primitive.

Examples

# the input's data type carries through
x <- nv_array(c(0, 0.001, 1))
nv_expm1(x)
#> AnvlArray
#>  0.0000
#>  0.0010
#>  1.7183
#> [ CPUf32{3} ] 

# an R value materializes at its default data type
nv_expm1(0.001)
#> AnvlArray
#>  0.0010
#> [ CPUf32{} ]