Git Product home page Git Product logo

binarynumber--hanker's Introduction

binaryNumber--hanker

二进制

  1. 转化
base 2  -> base 10

  11    -> 1 x 2^0 
           1 x 2^1 =3


  110   -> 0 x 2^0 
           1 x 2^1 
           1 x 2^2 =6
         
2从0开始的次方
二进制从尾部开始转换



 base 10 -> base 2 
    
   34    -> 2|34 -  0 -> 100010
            2|17 - 1
            2|8 - 0
            2|4 - 0
            2|2 - 0
            2|1 - 1
            
   除以2, 记余数,除数往下继续。最后余数倒过来。
   一般余数只有0 或 1
   
   常见:进制对着表
        二进制	十进制	十六进制
          0000	0 	0
          0001	1	  1
          0010	2	  2
          0011	3	  3
          0100	4	  4
          0101	5	  5
          0110	6	  6
          0111	7	  7
          1000	8	  8
          1001	9	  9
          1010	10	A
          1011	11	B
          1100	12	C
          1101	13	D
          1110	14	E
          1111	15	F
  
  2. 运算
  
        因为进制,所以二进制中 1+ 1 = 10 进位
        6+7 =
         0110
        +0111
         1101 =13
         
         
  3. 负数。
        
        Byte 一般8 bits。不到8位, 前面用0补位
        先变成相反数,然后+1
        12 = 1100 = 00001100
        -12       = 11110011
                           1 +
                  = 11110100
                  
        负数转正数也是一样的,先反正数字再+1

binarynumber--hanker's People

Contributors

vinafu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.