Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Dec To Hex To Dec

Options
  • 27-11-2004 9:12am
    #1
    Registered Users Posts: 3,969 ✭✭✭


    Is it possibly while doing this conversion, that the values change? I'm doing something in VB, and when I convert like that, the numbers don't match the first ones


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    Change in what way?

    You would see something like 10 Hex = 16 Dec. But the value wouldn't change to random values.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,687 Mod ✭✭✭✭Capt'n Midnight


    you could convert dec to hex , then hex to dec and see which values are different (0-9 should be the same of course) as with all programming you should at the very least test the boundry conditions..

    in excel/openoffice functions are =dec2hex(a1) and =hex2dec(b2) if you need test values.

    don't forget that -1 wraps around


  • Registered Users Posts: 3,969 ✭✭✭mp3guy


    could it be a character number problem? Because I'm allocating 6 character spaces for each hex value, and the hex values only go up to 16777216


  • Registered Users Posts: 205 ✭✭Stugots


    mp3guy wrote:
    could it be a character number problem? Because I'm allocating 6 character spaces for each hex value, and the hex values only go up to 16777216

    Possibly - 16777216 requires 7 characters in hex - 1000000

    Can you give an example (where you suspect an error) of what decimal value you are starting with adn what hex value it translates to?


  • Registered Users Posts: 3,969 ✭✭✭mp3guy


    it's ok, it got around the problem


  • Advertisement
  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    mp3guy wrote:
    it's ok, it got around the problem

    It is common courtesy to post your solution just in case someone else has the same problem later.


  • Registered Users Posts: 3,969 ✭✭✭mp3guy


    oh sorry, i found out that the numbers did match, it was just a value length problem


  • Closed Accounts Posts: 31 bobsyouruncle


    hey mp3guy wat u doin


  • Registered Users Posts: 3,969 ✭✭✭mp3guy


    hey mp3guy wat u doin

    this isn't how you use a forum. When you reply to a topic, you have to say something in relation to the title/first post. If you want to talk to a single person, PM them.


Advertisement