Skip to contents

Element-wise log(1 + x), more accurate for small x.

Usage

prim_log1p(x)

Arguments

x

(arrayish)
One input. Can be any float data type. An R value materializes at its default data type.

Value

(arrayish)
Has the input's shape and data type.

Implemented Rules

  • stablehlo

  • quickr

  • reverse

StableHLO

Lowers to hlo_log_plus_one(), specified under log_plus_one.

See also

Examples

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

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