Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:09:46+00:00 2026-05-31T00:09:46+00:00

I have a strange result coming from some big math & have no clue

  • 0

I have a strange result coming from some big math & have no clue as to why I’m getting a different answer from vb.net vs python.

Here are the quick snippets & results:

VB.NET
Dim MSB As UInt32 = 3067297518
Dim LSB As UInt32 = 1439785590
Dim sqln As UInt64 = MSB * (2 ^ 32) + LSB 

Python:
sqln = msb * (2 ** 32) + lsb

Python Result: 13173942528351756918
VB RESULT:     13173942528351756288

Note: I also tries declaring sqln as a ULong and a Double (same answer)
The MSB and LSB are a match in both debuggers – !! ??

Any Ideas? =+ My thanks

Outstanding Jon – very eloquent & it works!
One little follow up could you suggest a fix for the final piece? I believe the same sort of thing is happening even though you got my sqln straightened out 🙂

python says: = bdntyxtax2smq
vb.net says: = bfpuzytbx3s00

VB.NET
Dim sqlid As String = ""
Dim alphabet As String = "0123456789abcdfghjkmnpqrstuvwxyz"
For iCount = 0 To 12
    sqlid = alphabet((sqln / (32 ^ iCount)) Mod 32) + sqlid
Next

Python:
for i in range(0, 13):
    sqlid = alphabet[(sqln / (32 ** i)) % 32] + sqlid
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:09:47+00:00Added an answer on May 31, 2026 at 12:09 am

    I’ve decompiled your VB code as C#, and it looks like this:

    uint MSB = 0xb6d33eee;
    uint LSB = 0x55d16276;
    ulong sqln = (ulong) Math.Round((double) ((num2 * 4294967296) + num));
    

    This is because the power operator in VB always returns a Double:

    The result is number raised to the power of exponent, always as a Double value.

    I would suggest using the shift operator, and making all your variables UInt64, so that the shifting is done to a 64-bit integer:

    Dim MSB As UInt64 = 3067297518
    Dim LSB As UInt64 = 1439785590
    Dim sqln As UInt64 = (MSB << 32) + LSB 
    

    That gives the right answer. (You don’t actually need LSB to be a UInt64, but you might as well do everything with 64-bit integers.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a procedure in asp.net web site that gives strange result sometimes, I’m
i'm getting a very strange result from my database query, i was hoping someone
Possible Duplicate: Is JavaScript's Math broken? Strange result with floating point addition Some simple
I have a strange problem with my script. I am getting a JSON result
i have strange problem doing reporting: i have numerous clients with different issued invoices.
I have strange behaviour in Python/PyMongo. dbh = self.__connection__['test'] first = dbh['test_1'] second =
I have strange problem with receiving data from socket. On client im using air
I have a strange problem while trying to start JBoss from Eclipse. After starting,
I have a strange requirement to ship an application without bundling .Net framework (to
I have a string coming from server. I am identifying a particular substring and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.