Re: String of digits, certain radix, perform division

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Coos Haak

    Re: String of digits, certain radix, perform division

    Op Sat, 25 Oct 2008 01:11:28 -0700 (PDT) schreef Tomás Ó hÉilidhe:
    I have a radix, and I have a string of digits representing a number:
    >
    unsigned digits[] = {1,5,12,7,9,10, 4,8};
    >
    The radix is 13. The most significant digit is on the left. So the
    actual value of this number is calculable as:
    >
    1*(13^0) + 5*(13^1) + 12*(13^2) + 7*(13^3) + 9*(13^4) + 10*(13^5) +
    4*(13^6) + 8(13^7)
    That formula is when the most significant digit is on the right.
    Try
    1*(13^7) + 5*(13^6) + 12*(13^5) + 7*(13^4) + 9*(13^3) + 10*(13^2) +
    4*(13^1) + 8(13^0)

    And don't forget that in C, ^ is no exponentiation.

    --
    Coos
Working...