100-31 does not mean 100 dollars and 31 cents, or 100-127 makes little sense at all, since there is only 100 cents in a single dollar, not 1000, and there is no need to reserve three signs for the fractional part after comma.100-31 in decimal form is 100.97265625 , and 100-127 corresponds to 100.40234375 .32nd . For visual convenience and a clear difference from the decimal form, a small dash is used as a separator instead of a dot. And the number itself has the following general format:AAA.XXYAAA is the integer part of the number, which has the same meaning as in the decimal system. XX is the number of 1/32 of the fractional part, and Y is the number of eighties ( 1/8 ) in the last 1/32 fraction. Despite the vague description, the formula for converting the number AAA.XXY in 32nd format to decimal format is quite simple:D = AAA + (XX + Y * 1/8) * 1/32D = AAA + XX * (1/32) + Y * (1/256)100-127 AAA = 100, XX = 12, Y = 7, therefore:D = 100 + 12/32 + 7/256 = 100.40234375XX can take values only from "00" to "31" , and Y from "0" to "7" . Also, when writing Y number 4 can be replaced by + , and the "0" by a space. That is, 100-31 in the complete record form is 100-310 , and 100-12+ equivalent to 100-124 .100-12+ is written, then this is 100.39062500 in the decimal system.32nd format is not much more complicated. Let D decimal number:A = TRUNC(D)XX = TRUNC((D - A) * 32)Y = ((D - A) * 32 - XX) * 8TRUNC is the function of taking the whole part.Y is 0, then you can not write this bit, and if 4, you can replace with + .Y should turn out necessarily integer. Otherwise, the presence of the fractional part of Y is a sign that the original decimal number D has no mapping to 32nd format (only 256 fractional part values out of all 1000 possible can have a match in 32nd format).Source: https://habr.com/ru/post/83967/
All Articles