3
Math.acosh() Javascript Method with Acrobat doesn't work (???)
Community Expert
,
/t5/acrobat-discussions/math-acosh-javascript-method-with-acrobat-doesn-t-work/td-p/14268021
Nov 30, 2023
Nov 30, 2023
Copy link to clipboard
Copied
Hi,
Unless I'm mistaken, I just realized that the Math.acosh() Javascript method doesn't work with Acrobat. So I recreated it with a function:
function acosh(x) {
return Math.log(x+Math.sqrt(Math.pow(x,2)-1));
}
Has anyone heard of this and know why? Are there other Math methods that don't work?
Thanks
@+
TOPICS
JavaScript
,
PDF
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/acrobat-discussions/math-acosh-javascript-method-with-acrobat-doesn-t-work/m-p/14268084#M440930
Nov 30, 2023
Nov 30, 2023
Copy link to clipboard
Copied
Math.trunc() doesn't work.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
bebarth
AUTHOR
Community Expert
,
LATEST
/t5/acrobat-discussions/math-acosh-javascript-method-with-acrobat-doesn-t-work/m-p/14269938#M441050
Nov 30, 2023
Nov 30, 2023
Copy link to clipboard
Copied
Hi,
Instead of, you can use this function:
function trunc(x) {
return Number(x.toString().substr(0,x.toString().indexOf(".")));
};
@+
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
/t5/acrobat-discussions/math-acosh-javascript-method-with-acrobat-doesn-t-work/m-p/14269444#M441014
Nov 30, 2023
Nov 30, 2023
Copy link to clipboard
Copied
This is a verision thing. Acrobat does not incorporate the latest version of core JavaScript. So there are a number of JS features that do not work.
Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often
Use the Acrobat JavaScript Reference early and often
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
bebarth
AUTHOR
Community Expert
,
/t5/acrobat-discussions/math-acosh-javascript-method-with-acrobat-doesn-t-work/m-p/14269470#M441015
Nov 30, 2023
Nov 30, 2023
Copy link to clipboard
Copied
Apparently all hyperbolic functions don't work!
If you're interested, here are the associated functions:
//********
// cosh **
//********
function cosh(x) {
return (Math.exp(x)+Math.exp(-x))/2;
};
//*********
// acosh **
//*********
function acosh(x) {
return Math.log(x+Math.sqrt(Math.pow(x,2)-1));
}
//********
// sinh **
//********
function sinh(x) {
return (Math.exp(x)-Math.exp(-x))/2;
};
//*********
// asinh **
//*********
function asinh(x) {
if (x===-Infinity) return x;
else return Math.log(x+Math.sqrt(Math.pow(x,2)+1));
}
//********
// tanh **
//********
function tanh(x) {
var a=Math.exp(+x);
var b=Math.exp(-x);
return a==Infinity?1:b==Infinity?-1:(a-b)/(a+b);
};
//*********
// atanh **
//*********
function atanh(x) {
return Math.log((1+x)/(1-x))/2;
};
@+
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

