Wednesday 15 April 2009

Math.Log in VBScript

Today I was working on an old Classic ASP project, and I was converting some JavaScript code to ASP.

Part of the code used the JavaScript Math.Pow function, e.g. Math.Pow(4,3), and I needed to do this in classic ASP.

I found that the ^ operator in VBScript does this, but it wasn't easy to transpose into my code, so I just added the following function to the page:

FUNCTION Pow(val, val2)
Pow = val ^ val2
END FUNCTION

Added called it as needed, e.g. Pow(4,3)