Search This Blog

Tuesday, February 28, 2012

How to Convert Decimal 4-byte AS to AS-DOT+

- Representation is based upon the existing 2-byte AS representation
- The full binary 4-byte AS number is split two words of 16 bits each
<higher 2 bytes in decimal>.<lower 2 bytes in decimal>
For example: AS 65546 is represented as “1.10”
- Easy to read, however hard for regular expressions

Note: If the higher order 16 bits represent the value of a decimal zero, then the 4-byte AS can be represented in as the traditionally well known 2-Byte AS format

In order to convert decimal number into AS-DOT+ notation follow these steps:
1. Take the decimal number and divide it by 65536
2. Write down the number in the left side of the dot
3. Multiple 65536 in the result in section 2  
4. Subtract the decimal number by the result in section 3
5. The AS-DOT+ notation will be x.y where x is the result in section 2 and y is the result in section 4.

Let’s take AS 65539:
65539/65536=1.0000457763671875 (so x=1)
65539-(65536*1)=3 (so y=3)
AS number 65539 in AS-DOT+ notation is 1.3

Another example:
Let’s take AS 157600:
157600/65536=2.40478515625 (so x=2)
157600-(65536*2)=26528 (so y=26528)
AS number 157600 in AS-DOT+ notation is 2.26528

a calculator is available in the following link:

1 comment: