Function Math Engineering Class

LnRel

Evaluate ln(1+X) accurate in the sense of relative error.

Signature (Visual Basic / VBA)

Public Function LnRel( _
    ByVal vX As Variant _
    ) As Variant

Code Example

    LnRel(-0.5) = -0.693147180559945
    LnRel(-0.1) = -0.105360515657826
    LnRel(+0.0) = 0
    LnRel(+0.5) = 0.405465108108164
    LnRel(+1.0) = 0.693147180559945
    LnRel(+5.0) = 1.79175946922805

Parameters

Parameter Description
vX Function returns Null if vX is Null or cannot be fixed up to a Double precision floating point number. LnRel(X) calculates the double precision natural logarithm of (1.0+X) for double precision argument X. This routine should be used when X is small and accurate to calculate the logarithm accurately (in the relative error sense) in the neighborhood of 1.0.