Results 1 to 3 of 3

Thread: [RESOLVED] Different Number Bases

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Resolved [RESOLVED] Different Number Bases

    I know that I can convert from decimal to octal using the Oct() function and from decimal to hexadecimal using the Hex() function...
    But how do I convert from Octal to Decimal, Hexadecimal to Decimal, Binary to Decimal and from decimal to binary???
    Also... how do I switch the number mode to hexadecimal if I wish to perform calculations in hexadecimal... or binary... or octal...
    Any help would be appreciated...
    Thanks in advance
    Hey... If you found this post helpful please rate it.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Different Number Bases

    To convert from Hex to Dec you can use the Val function, eg:
    Code:
    decvariable = val("&H" & hexvariable)
    To convert from Octal, change the &H to &O

    As to performing calculations in hex etc, that is irrelevant - the answers will be the same no matter what base you are using, eg:
    Decimal
    2 * 10 = 20

    Hex
    &H2 * &HA = &H14
    (&H2 = decimal 2, &HA = 10, &H14 = 20)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2005
    Location
    Toronto, Canada
    Posts
    357

    Re: Different Number Bases

    Thanx a lot si... you make perfect sense...
    Hey... If you found this post helpful please rate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width