LN

Returns the natural logarithm of a numeric input.

Signature

    ┌─────────┐
IN ─┤   LN    ├─ OUT
    └─────────┘
FUNCTION LN : ANY_REAL
  VAR_INPUT
    IN : ANY_REAL;
  END_VAR
END_FUNCTION

The return type matches the input type. LN accepts REAL, LREAL.

Inputs

Name

Type

Description

IN

ANY_REAL

The positive value to compute the natural logarithm of.

Outputs

Name

Type

Description

Return value

ANY_REAL

The natural logarithm (base e) of IN. Same type as IN.

Description

Returns the natural logarithm (base e) of IN. The input must be positive; the result of LN applied to zero or a negative value is undefined.

Example

result := LN(REAL#2.718282);  (* result ~ 1.0 *)
value := LN(LREAL#1.0);      (* value = 0.0 *)

See Also

  • LOG — base-10 logarithm

  • EXP — natural exponential

References