Learn R Programming

BaTFLED3D (version 0.2.11)

safe_log: Take logarithm avoiding underflow

Description

Returns the normal log if there is no underflow. If there is underflow, then returns the minimum for which log can return (-744.4401)

Usage

safe_log(x)

Arguments

x

vector

Value

vector log in base e of input or minimum possible log value of -744.4401

Examples

Run this code
# NOT RUN {
log(c(1e-323, 1e-324))      # gives -Inf for the second value
safe_log(c(1e-323, 1e-324)) # gives the minimum value of -744.4401
# }

Run the code above in your browser using DataLab