Logarithmic Functions

Prev Next

Function Names

ln, log

Description

ln(x) calculates logarithm on base e
log(x) calculates logarithm on base 10.

Non-numeric values (including dates) are passed through without modifications. This is particularly suitable in combination with vectorization in order to pass through blank contents, explanatory text, etc.

Vectorization: These functions support vectorization in the 1st function parameter. Instead of providing a single value, you can provide a set or even a nested set which contain multiple values. The function will then process every value and its return value contains a corresponding set containing all results.

Call as: function

Restrictions

Indirect parameter passing is disabled
Vectorization is allowed in the 1st function parameter

Parameter count

1

Parameters

No.TypeDescription
1
input
all types
set
Value

Value or set containing multiple values (vectorization)

Return value

TypeDescription
all types
set
Result

Calculated value(s)

Examples

               echo( log( 1000 ), " ", log( 0.001 ) );
           echo( log( {-1, 0, 0.1, 1, 10, 100, 1000 } ) ); // Vectorization, incl. invalid values
               echo( ln(1000) / ln( 10 ), " ", ln( 0.001) / ln(10) );

Output

3 -3
{# Invalid Value #,# Infinitive Value #,-1,0,1,2,3}
3 -3
Try it yourself: Open LIB_Function_ln.b4p in B4P_Examples.zip. Decompress before use.

See also

Exponential Functions