• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to calculate a log base 10 equation

New Here ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 25, 2020 Feb 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)

Votes

Translate

Translate
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

What is console.log?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

In Acrobat use:

console.show();

console.println( ... );

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

There's nothing Acrobat-specific in the code above. It's generic JS code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

Oh maybe I was just thinking of the wrong thing. I was trying:

function getBaseLog(x,y) {

return Math.log(y) / Math.log(x);

}

 

console.log(getBaseLog(2,8));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 25, 2020 Feb 25, 2020

Copy link to clipboard

Copied

LATEST

That should work too... Only console.log() won't work, as you were told before. Use console.println(), instead.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines