LOG Logarithm
Description
The scaling factor may be used to improve numerical computations when calculating logarithms
of integer trace data. For example, the log of a trace value of 8000 is 3.9, which would be
stored as the value 4 in a trace.
The log of trace value of 1 is 0, so the log of a trace containing values from 1 to 8000 would
be compressed to values 0, 1, 2, 3, 4. Computational accuracy can be improved by using the
scaling factor to scale up the log values before they are stored. In this case, because 3.903 is
the log of 8000 and the largest positive trace value is 32,767, a scaling factor of 32,767 divided
by 3.903 or 8,395 may be applied to the data. Because EXP and LOG are inverse functions, the
EXP command has a scaling factor that may be used to “undo” the scaling factor of the LOG
command.
The LOG command can be used to calculate the natural logarithm by using 2.30259 as the
scaling factor.
The LOG function returns an invalid result if the source is zero or a negative number.
When the source is longer than the destination, the source is truncated to fit. When the source
is shorter than the destination, the last element is repeated to fill the destination.
5-300
Programming Commands