PROBLEM

Calculating logarithm mathematical operation returns unexpected result

Last Published: August 10, 2023

Description

When running the log() or math.log() function to calculate the logarithm value of a field in an attribute table using the Arcade and Python parser in the Calculate Field tool, the result returned is the value for natural logarithm (ln) instead of the logarithm value. The following image demonstrates the wrong result.

Wrong result when using the log() function

Cause

This is an expected behavior when running the log() or math.log() function in the Calculate Field tool. The log() and math.log() functions in ArcGIS Pro are designed to return the natural logarithm to the base irrational number, or e, of the value instead of the logarithm to the base ten (10). Refer to ArcGIS Arcade: Log for more information.

Solution or Workaround

To calculate the base ten logarithm value with the Python parser, use the math.log10() function in the Calculate Field tool.

math.log10(!<FieldName>!)

The following image shows the sample usage and the correct result.

Correct result when using the math.log10() function

To calculate the base ten logarithm value with the Arcade parser, divide the natural logarithm value by 2.302585 using the following expression.

log($feature.<fieldName>)/2.302585
Correct result when using the log() Arcade parser

Article ID: 000030961

Software:
  • ArcGIS Pro 3 1
  • ArcGIS Pro 3 0
  • ArcGIS Pro 2 8 x
  • ArcGIS Pro 2 9x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options