32nd format (thirty seconds)

    In working with trading systems, I came across an unusual format for representing numbers representing securities quotes, in particular for US government bonds. For example, the price presented 100-31does not mean 100 dollars and 31 cents, or 100-127does not make much sense at all, since there is only 100 cents in one dollar, not 1000, and there is no need to reserve three decimal places for the fractional part.

    The trick here is that this is not a familiar decimal notation. For example, 100-31in decimal it is equal to 100.97265625, but 100-127matches 100.40234375.

    So, this format for writing fractional numbers is called "thirty seconds" or 32nd. For visual convenience and a clear difference from the decimal form, a small dash is used as a separator instead of a dot. But the number itself in general has the following format:

    AAA.XXY

    where AAAis the integer part of the number that has the same meaning as in the decimal system. XX- this is the number of 1/32shares from the fractional part, and Yis the number of eights ( 1/8) in the last 1/32fraction. Despite the vague description, the transfer formula for the number AAA.XXYformat 32ndto decimal format is quite simple:

    D = AAA + (XX + Y * 1/8) * 1/32

    or

    D = AAA + XX * (1/32) + Y * (1/256)

    that is, for the number 100-127AAA = 100, XX = 12, Y = 7, therefore:

    D = 100 + 12/32 + 7/256 = 100.40234375

    In order for the formula to be correct, it XXcan take values ​​only from "00"to "31", and Yfrom "0"to "7". Also, when writing, the Ynumber 4can be replaced by +, and "0"by a space. That is, 100-31in full form, it is equal 100-310, but 100-12+equivalent 100-124.

    It can be seen that in three fractional digits, not 1000 parts are encoded, as in the decimal system, but only 256 (32 * 8).

    So again: if it is written 100-12+, then it is 100.39062500in decimal system.

    The reverse translation formula from decimal to format is 32ndnot much more complicated. Let beDdecimal::

    A = TRUNC(D)
    XX = TRUNC((D - A) * 32)
    Y = ((D - A) * 32 - XX) * 8

    TRUNCis the function of taking the integer part.

    If Yequal to 0, then you can not write this digit, and if 4, then you can replace it with +.

    The component Ymust be integer. Otherwise, the presence of the fractional part of y Yis a sign that the original decimal number Ddoes not have a format mapping 32nd(only 256 values ​​of the fractional part out of all 1000 possible can have a correspondence in the format 32nd).

    No matter how bizarre this method of recording cash amounts looks, it is traders who use it (not to be confused with raiders), for example, when trading in US government bonds. I can assume that this is just a legacy of the times when not everyone knew fractional decimal numbers, and writing parts of the whole in the form of natural fractions is much closer to human nature. Divide the pile into two, three, etc. parts can even be a child untrained in decimal fractions.

    The format is strange, but you have to know it.

    Also popular now: