addLog {DOQTL} | R 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))

[Package DOQTL version 1.16.2 Index]