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 7693579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:07:19+00:00 2026-05-31T21:07:19+00:00

I looked at the documentation and even peeked at the C source, and I

  • 0

I looked at the documentation and even peeked at the C source, and I can’t see why they limited the accepted radixes to 2..36. Anybody know?

  • 1 1 Answer
  • 0 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-31T21:07:20+00:00Added an answer on May 31, 2026 at 9:07 pm

    As others have pointed out, radix < 2 is troublesome to render. and there’s no conventional agreement on what characters to use for radixes larger than [‘0’..’9′] + [‘a’..’z’], which is why the standard method doesn’t support radix outside those limits.

    If you really want a custom radix representation, you would need to define the alphabet of symbols to use for the digits. Here’s a little module that will give you the capability.

    module CustomRadix
      # generate string representation of integer, using digits from custom alphabet
      # [val] a value which can be cast to integer
      # [digits] a string or array of strings representing the custom digits
      def self.custom_radix val, digits
    
        digits = digits.to_a unless digits.respond_to? :[]
        radix = digits.length
        raise ArgumentError, "radix must have at least two digits" if radix < 2
    
        i = val.to_i
        out = []
        begin
          rem = i % radix
          i /= radix
          out << digits[rem..rem]
        end until i == 0
    
        out.reverse.join
      end
    
      # can be used as mixin, eg class Integer; include CustomRadix; end
      # 32.custom_radix('abcd') => "caa" (200 base 4) equiv to 32.to_s(4).tr('0123','abcd')
      def custom_radix digits
        CustomRadix.custom_radix self, digits
      end
    end
    

    example use:

    $ irb
    >> require '~/custom_radix'
    => true
    >> CustomRadix.custom_radix(12345,'0'..'9')
    => "12345"
    >> CustomRadix.custom_radix(12345,'.-')
    => "--......---..-"
    >> funny_hex_digits = ('0'..'9').to_a + ('u'..'z').to_a
    => ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "u", "v", "w", "x", "y", "z"]
    >> CustomRadix.custom_radix(255, funny_hex_digits)
    => "zz"
    >> class Integer; include CustomRadix; end
    => Integer
    >> (2**63).custom_radix(funny_hex_digits)
    => "8000000000000000"
    >> (2**64+2**63+2**62).custom_radix(funny_hex_digits)
    => "1w000000000000000"
    >> base64_digits = ('A'..'Z').to_a + ('a'..'z').to_a + ('0'..'9').to_a << '+' << '/'
    => ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "/"]
    >> 123456.custom_radix(base64_digits)
    => "eJA"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know how (and if) you can change the password used to sign
I have looked up Google and Spring documentation but can not find any thing
I have looked at the documentation on MSDN about these 2 functions. However, I
I have looked at the documentation here: http://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.SubElement The parent and tag argument seems
I've downloaded the Windows Media Center SDK and have looked through the documentation, but
Composer is a PHP package manager. I have looked through the documentation here: http://getcomposer.org/
I have looked in the official documentation for python, but i cannot seem to
I ve looked at the JSoup Selector Overview documentation but I'm still having problems.
I've looked at the relevant section of the Piston documentation , but it only
I have looked through several sites for any useful documentation and have come up

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.