码迷,mamicode.com
首页 > 其他好文 > 详细

Essence of assignment about base calculation

时间:2020-09-18 02:18:40      阅读:22      评论:0      收藏:0      [点我收藏+]

标签:ati   ica   ase   and   for   base   res   ima   form   

>>> F0-D5-BF-8B-3E-40 > 11110000-11010101-10111111-10001011-00111110-01000000


>>> 192.168.0.102 = 128. 128. 0. 64
                                   + 64. 32. 0. 32
                                       + 0. 8. 0. 8
                                     = 11000000.10101000.00000000.01101000

convert base-6 to base-10

formula: np*(b^(m-p-1))...+n3*(b^(m-p3-1))+n2*(b^(m-p2-1))+n1*(b^(m-p1-1)) (p=high position, m=position count, n1~nm=position‘s number, b=base)

12345 > 
  1*(6^4)=1296
+2*(6^3)=432
+3*(6^2)=108
+4*(6^1)=24
+5*(6^0)=5
              =1865

convert base-10 to base-8

formula: n/(b^0)%b*(10^0) + n/(b^1)%b*(10^1) + n/(b^2)%b*(10^2)...n/(b^m)%b*(10^m) (n=number, b=base, m=stop at b^m>n)

   6026 > 
   6026/(8^0)%8*(10^0)=2
+6026/(8^1)%8*(10^1)=10
+6026/(8^2)%8*(10^2)=600
+6026/(8^3)%8*(10^3)=3000
+6026/(8^4)%8*(10^4)=10000
+6026/(8^5)%8*(10^5)=0
                                    =13612

 

    for addition:

         The principle is in binary calculation, 1 plus 1 results 10 and 1 plus 10 results 11, similar as decimal calculation:

                  10100010000

                 +   11110001

                 =11000000001

                 =1537

 

    for multiplication:

         The principle is in binary calculation, 10 multiply 100 results 10000, similar as decimal calculation:

                    10100010000*11110001

                    10100010000

          +10100010000

          =101011000010000

        +10100010000

        =1111100000010000

      +10100010000

     =100011110000010000

     +10100010000

   =1001100010000010000

   =312336

 

Essence of assignment about base calculation

标签:ati   ica   ase   and   for   base   res   ima   form   

原文地址:https://www.cnblogs.com/prospector/p/13674568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!