Express Numbers as Any Number Base System

Idea created by eric on May 28, 2018
    Active
    Score11

    Without adding any new field types,

    simply allow numbers to be expressed as any number base system,

    since binary, hexadecimals, and all other "types" are really just numbers.

    This starts with more flexible layout Data Formatting.

    Number Base System Data Formatting.png

    Thus data could be entered and displayed as

    • base 2 (binary)
    • 8 (octal)
    • 10 (decimal, though unnecessary, since that's the default)
    • 16 (hexadecimal)
    • 64 (base64)
    • or any number system in between

     

    This layout Data Formatting option should probably be accompanied by native functions that assist with expressing  all those possible base systems in calculations. Perhaps, just adding an optional base to GetAsNumber so you can have

    GetAsNumber ( text ; base )

    to simply recognize the number of any base you want to specify in a calculation.

    E.g. GetAsNumber ( "10" ; 2 ) = 3

     

    I'm not sure if we want the reverse of that in something like

    GetAsText ( data ; base )

    to force output into the number system you want to see. Maybe that at least should be a separate function like GetAsBase ( data ; base )

    E.g. GetAsText or GetAsBase ( 255 ; 16 ) = "FF"

    These conversions, however, should not be necessary or even used to populate fields and variables. You mostly need a function to express data in the number system you want, and then for the layout to do the same.

     

    We could then represent the new 24-byte Get(UUIDNumber)

    3351455178917488228606469712264530601969081773070792730006

    as some other base, e.g. base 62:

    1TQgnW6Fjfdk0UyUQGgDGhExbbcGHCqXO

    Base 24:

    8F97CCGME7M296M6J25369I1MFHHDCLB1ACCMFAB8M

    Base 16:

    88AED32131D1005826029D5F7C964BF38BB8593385EF2596

     

    Since it takes the same storage to represent a number value regardless of the number base system, it's not for storage purposes, but primarily for display.

    I would mostly use it to represent long ID numbers more concisely, and yet still use a number, which is more efficient than text:

    http://filemakerstandards.org/display/bp/Key+values?focusedCommentId=557919#comment-557919

    Compared to a 58-numeral decimal ID, 33 characters of base-62 are much easier to view, read, and differentiate visually; and take less iPhone layout real estate.

    For the programmer or people who are familiar with other notations to represent color or other values, it would be even more important.

    Web colors - Wikipedia

    Number Bases Conversion Tool & Bases 2 - base 64 Converter

     

    TobiasLiebhartKoschierSE and others want to do bitwise operations, and the operation results are easier to read in binary, octal, or hexadecimal.

    https://community.filemaker.com/ideas/3109#comment-35441

    https://en.wikipedia.org/wiki/Bitwise_operation#Applications

    Binary is also frequently used to concisely represent a series of on/off flags.