BASE Documentation

(Nov. 2011, updated May 2015, revised Dec. 2021) 🅭🅯🄎 4.0 Daniel Woodworth

This is the documentation for the web version of BASE, a base conversion utility.

History

The first version of BASE was an iOS app created about 10 years ago and named after a TI-84 calculator program. The app's interface was too clunky for mobile users for it to be published, so I translated the core logic to JavaScript and uploaded it to the precursor to this website instead. Aside from an interface re-work 6 years ago, the current version of BASE is still basically the same utility.

Theory

BASE handles “numbers” which are strings of digits in arbitrary bases. The digits can be the drawn from standard numeric digits ('0'-'9', 'a'-'z', 'A'-'Z'), from “ASCII” (technically ISO-8859-1), or from any custom set of characters. Because of this, BASE is very versatile and can handle base conversion, certain kinds of string encoding/decoding, certain basic ciphers, and even some more esoteric things like RNA translation.

Internals

The core logic of BASE is in BigNumber.js, an ancient and not particularly well-written JavaScript implementation of an arbitrary-precision type supporting the bare minimum set of operations to do integer base conversions. It doesn't support any division-like operations, which means that anything after the decimal point ('.' as long as that character is not a digit) will be ignored. This limitation might be fixed some time in the future.

Interface

The interface consists of a convert button and two of the boxes shown in Figure 1:



Figure 1: A BASE input/output box.

Each box has three sections:

  1. An input/output section where the number to convert can be entered (for the input box) or where the conversion result will show up (for the output box).
  2. A base selection section with a drop-down to choose an input/output digit set and a numeric input to set the input/output base.
  3. A digit set section showing the set of digits that will be used. This will show a generic numeric digit set for the "numeric" setting, ISO-8859-1 characters for the "ASCII" setting, or an arbitrary editable digit set for the "custom" setting. For a base-b input/output, only the first b of these digits will be used.

Once the input number is entered and the bases/digit sets are chosen for the input and output, pressing the convert button performs the base conversion and puts the result in the output box.

Performance Notes

The word ”JavaScript” is composed of two words: “Java,” meaning “slow,” and “Script,” also meaning “slow.” Despite that and the ancient code, the performance of this tool isn't too bad. It will sometimes take a while to convert larger inputs; though it should always terminate, it is usually also safe to let the browser kill it.