0

I need to make some big multiplications for cryptographic reasons in vb.net and overflow the variable as C,C++ and C# does. I have disabled the check of overflow at the vb.net project but when i an doing those multiplications i get as a result 1.#INF

ex. in c:

z^y= 0xFFFFFFFF ^ 0x000003FC= 0xFFFFFC03

in vb.net:

z^y= 0xFFFFFFFF ^ 0x000003FC= 1.#INF

is it possible to be done?

2
  • 1
    That's not legal VB.Net code. VB uses &H prefix for hex numbers Commented Mar 19, 2012 at 14:21
  • Do it in C#. You are just going to be lured into traps by doing it in VB.net. Too many operators/functions that look alike, but really arent ... (if, IIF etc ...) Commented Mar 19, 2012 at 14:21

1 Answer 1

6

^ in C is Xor in VB and should never be able to overflow.

On the other hand, if you write ^ in VB then this is assumed to be the “power” operation.

Dim z = &HFFFFFFFF
Dim y = &H000003FC
Dim x = z Xor y
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.