Page 1 of 1
Mathematical operation in vb scripts
Posted: Thu 17. Jul 2014, 09:18
by PMJ
Hello.
Is it possible in VBS macro modulo operation, hex to dec and dec to hex????
Re: Mathematical operation in vb scripts
Posted: Thu 17. Jul 2014, 16:06
by K.Wolf
Yes, all that is possible.
Modulo:
The result is 1.
hex -> dec conversion:
The result is FF.
dec -> hex conversion:
Code: Select all
Dim h
h = "&HFF"
MsgBox CInt(h)
h = &HFF
MsgBox h
The result is in both cases 255.
Re: Mathematical operation in vb scripts
Posted: Fri 18. Jul 2014, 09:13
by PMJ
Hello,
thanks it's works.
I have second problem. I need write to ex. x=2 200 000 000. In this moment i have comunicate x overflow.
In my opinion the best solution is a change x to double but i don't how.
Re: Mathematical operation in vb scripts
Posted: Fri 18. Jul 2014, 11:58
by K.Wolf
You can assign large values to VBS variables without errors and calculate something with it, the VBS scripting engine then internally works with floating point numbers (double). But many functions in VBS are limited to signed 32-bit integer values, the highest value of which is 2147483647.