[Next] [Up] [Previous]

Quasilogarithmic Floating-Point

On the previous page, a scheme was shown that modified decimal floating-point so that the distribution of representable points is similar to that of a mixed-radix system with the radices 2, 2.5, and 2 alternating in a cycle of three. The same basic principle of encoding the leading digits of the mantissa, together with a set of digits to be appended to the end of the mantissa, the steps between which vary depending on the portion of the mantissa range the number is in, can be used to obtain other distributions of representable points.

To more closely approximate the type of uniform distribution of representable points that a logarithmic representation of numbers would provide, a scheme is outlined here by which radices of 1.25 and 1.28 are used, approximating steps of one-third of a bit.

Range of   Increment of  Increment as    Number of
first two  last six      fraction of     codes
digits     digits        range of last
                         six digits

80 - 99    010000        1/100              20,000
63 - 79    008000        1/125              21,250
50 - 62    006250        1/160              19,200
40 - 49    005000        1/200              20,000
32 - 39    004000        1/250              20,000
25 - 31    003125        1/320              22,400
20 - 25    002500        1/400              20,000
16 - 19    002000        1/500              20,000
13 - 15    001600        1/625              18,750
10 - 12    001250        1/800              24,000
                                           -------
                                Total      205,600

Only for the increment in the range from 25 to 31 is the last digit used, but an increment of 003200 would not be an even fraction, so the extra digit is unavoidable.

A total of 205,600 codes, occupying an 18-bit field, is required to represent both the first two digits of the number, and precision appended to the end of the number equivalent to anywhere from two additional digits to just under three additional digits (or about 9 2/3 bits).

This format is primarily described here to illustrate a point. The format of my own described on the preceding page, where a four-bit field is used for the first digit and the last digit is intended for a practical purpose, to allow a normalized decimal floating-point format to have numerical properties matching those of binary floating-point.

Having a special field that is eighteen bits long, which would likely have to be an index into a table, and requiring arithmetic to be done with three more decimal digits of precision than are actually retained, is much less practical. This does not mean that this format is entirely devoid of practical benefit. By, in effect, moving the exponent in steps of one-third of a bit at a time, this ensures that the precision of numbers represented in this format does not vary by more than a third of a bit, and so almost none of the mantissa field is ever "wasted" in representing precision that will not be maintained in numbers in a different portion of the mantissa range.

A Practical But Irregular Scheme

If it isn't necessary to have the successive representable points spaced uniformly over large stretches: i.e., in a decimal floating-point representation, it was tolerable to have a series of representable numbers like:

1.00560
1.00563
1.00567
1.00570
1.00573
1.00577
1.00580

where dividing the range from one value of the fourth decimal place to the next into three parts approximately, at 3/10 and 7/10 is acceptable, then one could move the exponent in steps of half a bit (or, for that matter, in other, even smaller steps as well, but it is steps of half a bit that will be illustrated here) even for binary floating point where one no longer has the flexibilty offered by multiple prime factors in a small degree for decimal floating point and in a greater degree, as will be illustrated below, for sexagesimal floating point.

Thus, one could have codes for the following combinations of the leading two digits of, and an appended four digits to, the mantissa of a binary floating-point number:

10 0000
10 0101
10 1011
11 0000
11 1000

Since there are five such codes, combining them with three possibilities for the first two digits of the exponent to produce a four-bit combination field, after the fashion of the DFP standard above, would be needed for an efficient coding.

The last bit of the main portion of the mantissa would now be split into a somewhat uneven three parts, or into two parts, so that the distance between representable points would change by ratios of 3:2 and 4:3 instead of one large step of 2:1.

Here, at least, the table required has five or fifteen entries, unlike the table required for the decimal version with 1/3-bit steps requiring a table with an eighteen-bit index, so at least this form of quasilogarithmic floating-point could be considered feasible to implement.

A Wholly Impractical Scheme

The first format discussed above for decimal floating-point, impractical as it may be already, does not represent the limit of possible approximations to the distribution of representable numbers given by a logarithmic representation of numbers.

Once again, we will return to having the spacing of points in each of the subranges of the mantissa be fully regular, so instead of having just the factors of 2 and 5 available, we will also have the factor 3 available by resorting to sexagesimal floating point. The base of 60 is, of course, 2 * 2 * 3 * 5.

If sexagesimal floating-point were used, having a factor of 3 available in addition to the prime factors 2 and 5 makes it relatively easy to come up with a continuous series of numbers that differ from one another by factors such as 81/80, 531441/524288, (the syntonic and Pythagorean commas, respectively), 2048/2025, 3125/3072, or 20000/19683 as can be seen in this page in its discussion of approximations to just intonation.

Instead of dividing the range of mantissas into ten pieces, represented by the lines of the table above, however, a table with 313 lines would be required to illustrate such a scheme.

Since the first digit of a sexagesimal number ranges from 1 to 60, and we need to use about one part in 81 to distinguish one range from another, the first three sexagesimal digits of the number will have to be combined with the code for the appended part of the number; and that will likely be more than the five sexagesimal digits I initially estimated.

A factor of 2 represents 53 commas; a factor of 3/2 represents 31 commas; a factor of 5/4 represents 17 commas. Another way of looking at this is to look at the effects of the five kinds of comma listed above on the numerator and denominator of the fractions representing a value:

                             2  3  5    2  3  5
        81/80 1.0125            4    /  4     1
    2048/2025 1.0113580247  11       /     4  2
    3125/3072 1.0172526042         5 / 10  1
  20000/19683 1.0161052685   5     4 /     9
531441/524288 1.0136432648     12    / 19

The various ratios used through the sequence would be those obtained by alternating between the various types of commas so as to keep the size of both the numerator and denominator within bounds.

And the ratios corresponding to the musical notes at just intonation would, as particularly small ratios, mark pivot points in the sequence to ensure good ratios are chosen. Since 60 is 2 * 2 * 3 * 5, a factor of 2 is only half as bad as a factor of 3 or 5 in terms of how many sexagesimal places it demands to be represented exactly.

A simple BASIC program obtained the following sequence of ratios:

  81/80      81/40      81/20     81/10     81/5     162/5
 128/125    256/125    512/125  1024/125  2048/125  4096/125
  25/24      25/12      25/6      25/3      50/3     100/3
 135/128    135/64     135/32    135/16    135/8     135/4
  16/15      32/15      64/15    128/15    256/15    512/15
  27/25      54/25     108/25    216/25    432/25  * 625/18
1125/1024  1125/512   1125/256  1125/128  1125/64   1125/32
  10/9       20/9       40/9      80/9     160/9     320/9
   9/8        9/4        9/2       9        18        36
 256/225    512/225   1024/225 * 729/80    729/40    729/20
 144/125 *  125/54     125/27    250/27    500/27   1000/27
  75/64      75/32      75/16     75/8      75/4      75/2
  32/27      64/27     128/27    256/27    512/27   1024/27
   6/5       12/5       24/5      48/5      96/5     192/5
 243/200    243/100    243/50    243/25  * 625/32    625/16
 100/81     200/81     400/81    800/81   1600/81   3200/81
   5/4        5/2        5        10        20        40
  81/64      81/32      81/16     81/8      81/4      81/2
  32/25      64/25     128/25    256/25    512/25   1024/25
 125/96     125/48     125/24    125/12    125/6     125/3
 320/243    675/256    675/128   675/64    675/32    675/16
   4/3        8/3       16/3      32/3      64/3     128/3
  27/20      27/10      27/5      54/5     108/5     216/5
 512/375   1024/375   2048/375  4096/375 *2187/100  2187/50
  25/18      25/9       50/9     100/9     200/9     400/9
  45/32      45/16      45/8      45/4      45/2      45
  64/45     128/45     256/45    512/45   1024/45  * 729/16
  36/25      72/25     144/25    288/25    576/25   1152/25
 375/256    375/128    375/64    375/32    375/16    375/8
  40/27      80/27     160/27    320/27    640/27   1280/27
   3/2        3          6        12        24        48
 243/160    243/80     243/40    243/20    243/10    243/5
 192/125    384/125    768/125  1536/125  3072/125  6144/125
  25/16      25/8       25/4      25/2      25        50
 128/81     256/81  *  405/64    405/32    405/16    405/8
   8/5       16/5       32/5      64/5     128/5     256/5
  81/50      81/25     162/25    324/25  * 625/24    625/12
1024/625   2048/625   4096/625 *3375/256  3375/128  3375/64
   5/3       10/3       20/3      40/3      80/3     160/3
  27/16      27/8       27/4      27/2      27        54
 128/75     256/75     512/75   1024/75   2048/75   4096/75
 125/72     125/36     125/18    125/9     250/9     500/9
 225/128    225/64     225/32    225/16    225/8     225/4
  16/9       32/9       64/9     128/9     256/9     512/9
   9/5       18/5       36/5      72/5     144/5     288/5
 729/400    729/200    729/100   729/50    729/25   1875/32
  50/27     100/27     200/27    400/27    800/27   1600/27
  15/8       15/4       15/2      15        30        60
 256/135 *  243/64     243/32    243/16    243/8
  48/25      96/25     192/25    384/25    768/25
 125/64     125/32     125/16    125/8     125/4
 160/81     320/81     640/81   1280/81  *2025/64
   2          4          8        16        32

Asterisks mark changeovers from one ratio to another in successive octaves within the 60:1 range of a single hexadecimal digit.

In addition to the table having 313 lines, the coding requires a compound field which represents the three most significant sexagesimal digits of the mantissa, as previously noted, and nine appended sexagesimal digits, having an effective precision of four to five sexagesimal digits.

Or perhaps even more sexagesimal digits are required; limiting the number of factors of 2, 3, and 5 in the numerator and denominator of the fractions above is intended to minimize the power of 60 by which all the fractions above need to be multiplied to produce only integers, and to also minimize the even larger power of 60 into which all those integers would divide evenly without a remainder, just as, in the decimal scheme above, 1,250, 1,600, 2,000, 2,500, 3,125, 4,000, 5,000, 6,250, 8,000, and 10,000 all go evenly into 1,000,000 without a remainder as well as all being integers, that series of integers being originally derived from the series of ratios or fractions 5/4, 8/5, 2, 5/2, 16/5, 4, 5, 32/5, 8 and 10, which span the space from 1 to 10 in steps of either 1.25 (5/4) or 1.28 (32/25).

Thus, the scheme is only possible for higher precisions, and is wildly impractical for any precision (the compound field, presumably implemented by a ROM table, would be on the order of thirty bits in length).

The description above, written on March 29, 2007, might be considered to have been completed some three days early, given the total impracticality of this scheme of quasilogarithmic sexagesimal floating-point.

However, the fractions in the first column of the table above, being the frequency ratios from the fundamental of an octave for a just intonation scale with 53 notes, resemble the series used by the experimental musician Ben Johnston.


[Next] [Up] [Previous]