Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Error Function] math.erf is not define (Are some functions disabled in roll20?

1495059844
Giger
Pro
API Scripter
I can't for the life of me get the math.erf function to work (as documented to be a function available in javascript  1 )? Is it disabled/prohibited or am i doing something incorrectly?
1495062435

Edited 1495062519
Giger
Pro
API Scripter
Here's the solution: function erf(y) { // save the sign of y var sign = (y >= 0) ? 1 : -1; y = Math.abs(y); var a1 = 0.254829592; var a2 = -0.284496736; var a3 = 1.421413741; var a4 = -1.453152027; var a5 = 1.061405429; var p = 0.3275911; var t = 1.0/(1.0 + p*y); var z = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * Math.exp(-y * y); return sign * z; }
1495074552
The Aaron
Pro
API Scripter
math.js is a library for JavaScript, not a part of the language. Glad you found a solution. 
1495082304
Lithl
Pro
Sheet Author
API Scripter
For the actual built-in Math functions, see&nbsp;<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math</a>