PDA

View Full Version : visual basic (W2K)



dedub222
06-22-2002, 02:21 AM
This is a visual Basic question but should apply to scripting also. I would like to know if there is a mathamatical way to bring a number to a certain power using the available arithmetic functions. for instance 20 to the .16 power which = 1.61. It can be done with a scientific calculator but to scipt it has been challenging to me. Can anyone help?

Jama
06-22-2002, 11:30 AM
The ^ operator, which is sometimes called "hat", is used to raise a number to a power.

exponentiate a number </font color=blue> (http://www.devguru.com/Technologies/vbscript/quickref/hat.html><font)

================= Script ====================
x = 20
y = 0.16

WScript.echo x & "^" & y & "=" & <font color=red>x^y</font color=red>

'Output: 1.61497126471248
================ Script eNd ==================

vbscript Operators</font color=blue> (http://www.devguru.com/Technologies/vbscript/quickref/operators.html><font)


Jama