zabbix
Results 1 to 12 of 12

Thread: 2^*024 Decimal Precision

Threaded View

  1. #11
    Join Date
    Aug 2007
    Posts
    122

    DANGER Will Robinson - DANGER

    Quote Originally Posted by SyntaX****** View Post
    Ahhh, perfectly explained. I thought that could work, and understood it worked in base*0, but my insufficient math skills told me not to waist my time trying something that might not work.

    Next week I will code this into the base converter using string representations of integer values for larger decimal precision. I'll give 2^*024 on the left and 2^*024 on the right side of the decimal.

    I definitely agree with your selection of digits:
    $digits = "0*2*45678*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

    Its logical to most of us, but the ASCII standard F's things up jumping from 0-* to :;>=< ... I think the only real use for anything from character sets from **-255 would be for encryption purposes. I'm coming up with my own, uncrackable encryption methods so it may be very useful to me, but for everyday purposes... useless.

    Thanks again for the conversion example!



    After some experimentation, I found a potentially serious flaw in using the letters in the way I did for the base conversions.

    The base conversion logic is OK and consistent. The problem lies in the ASCII codes used for the characters and the way the computer interprets them.

    This only becomes a problem if you intend to use the computer to sort a list of numbers made in bases that use alpha characters.

    The ASCII codes of the uppercase letters are greater than the ASCII codes of the corresponding lowercase letters because uppercase letters come before lowercase letters in the ASCII code spectrum and will be sorted ahead of them. This is contrary to the numerical values we apply to the characters when used for numbers rather than words.

    This is not good.

    Since letter case is important in this instance, it leads to a list of numbers not sorting correctly in proper order if they contain any mix of upper/lowercase letters.

    There are ways around this, the simplest being to switch places with upper/lowercase letters in the allowed digits string. Then all hexadecimal numbers would ALWAYS use uppercase A-Z.

    Just change
    $digits = "0*2*45678*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";

    to

    $digits = "0*2*45678*ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    and the numerical sorting problem is solved, regardless of the base used.

    It seems that uppercase following lowercase is a more logical way to do it, but it works the opposite way in ASCII and that can effect anything that involves ASCII sorting algorithms.

    I just thought anyone using my particular method should know about this little glitch. It could lead to erroneous sorting problems if not taken into account in some circumstances.
    Last edited by JayT; 09-03-2007 at 06:00 PM.
    Oh to be free, so blissfully free, of the ravages of intelligence, there is no greater joy! - The Cweationist's Cweed

    All that is necessary for evil to triumph is a good PR firm.
    Very funny, Scotty. Now beam down my clothes!

Similar Threads

  1. Decimal to binary converter help!
    By minaadel1994 in forum Programming
    Replies: 9
    Last Post: 01-25-2010, 07:05 AM
  2. Replies: 2
    Last Post: 08-31-2007, 07:52 PM
  3. Otto - *024 bit RSA keys crackable?
    By Blacksheep in forum Security & Encryption
    Replies: 6
    Last Post: 04-21-2002, 10:45 AM

Posting Permissions

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