log10 (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

3.10 / 1.00.00


This function will calculate the base-10 logarithm of the argument.

 

Note: This function works with DOUBLE, but can also work with FLOAT as described in the Floating-point math introductory section.

 

Input:

V : DOUBLE

Value.

 

Returns: DOUBLE

The base-10 logarithm of V. If the value is 0, -Infinity is returned. If the value is less than 0, NaN is returned.

 

Declaration:

FUNCTION log10 : DOUBLE;
VAR_INPUT
v : DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
 
DebugMsg( message := "  log(100) = " + doubleToStr(v := log( v:= 100.0)));
DebugMsg( message := " log2(100) = " + doubleToStr(v := log2( v:= 100.0)));
DebugMsg( message := "log10(100) = " + doubleToStr(v := log10( v:= 100.0)));
 
END_PROGRAM;