addLog: Add two log values.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

When two numbers that are on the log scale must be summed, transforming them back to the non-log scale and taking the sum is slow. This function takes the exp() of the values only when neccessary.

Usage

1
  addLog(x, y)

Arguments

x

Numeric containing a value on the log scale.

y

Numeric containing a value on the log scale.

Details

This function checks to see if the difference between the maximum value and the other value is less than the machine precision. If it is, then the exp() is taken for those values that differ by less than the machine precision, they are summed and returned to a log scale. If the maximum value is differs from the other values by greater than the machine precision, then return the maximum value.

Value

Numeric value containing the sum of the arguments on a log scale.

Author(s)

Daniel Gatti

See Also

addLogVector

Examples

1
  addLog(log(10), log(1))

DOQTL documentation built on May 6, 2019, 3:09 a.m.