addLog: Add two log values.

View source: R/addLog.R

addLogR Documentation

Add two log values.

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

  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

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

dmgatti/DOQTL documentation built on April 7, 2024, 10:35 p.m.