Skip to main content
christopherj66219798
Participant
February 25, 2020
Answered

How to calculate a log base 10 equation

  • February 25, 2020
  • 3 replies
  • 2194 views

Math.log( ) just givesme the natural log. I've tried Math.log(10, ( ) ), Math.log10( ), console.log(getBaseLog(10, ( ) ), console.log(Math.log10( )). Now I'm at a loss on how to go about solving this.

This topic has been closed for replies.
Correct answer try67

However, you can easily write a function that returns the log10 value using the log method, like this:

 

function log10(val) {
return Math.log(val) / Math.LN10;
}

 

And then you can call it like this, for example:

log10(2)

3 replies

try67
Community Expert
Community Expert
February 25, 2020

The log10 method of the Math object was introduced in a later version of EMCAScript (the technical name of JavaScript), which might not be supported in Acrobat (it doesn't work in Acrobat XI, for sure).

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 25, 2020

However, you can easily write a function that returns the log10 value using the log method, like this:

 

function log10(val) {
return Math.log(val) / Math.LN10;
}

 

And then you can call it like this, for example:

log10(2)

christopherj66219798
Participant
February 25, 2020

Thank you. Was stuck on how to write it out for Acrobat for a while.

Legend
February 25, 2020

https://sciencing.com/convert-ln-log-10-8359505.html

 

Also, read the Acrobat JavaScript API, you need to know the methods specific to Acrobat. 

Bernd Alheit
Community Expert
Community Expert
February 25, 2020

What is console.log?

christopherj66219798
Participant
February 25, 2020

It's used to print variables defined before or any message, basically for general output of information. I've used the command on browser's wasn't sure if it would do anything in Acrobat though, and I guess it doesn't. 

Bernd Alheit
Community Expert
Community Expert
February 25, 2020

In Acrobat use:

console.show();

console.println( ... );