二進制文件簽名_二進制數的簽名表示

二進制文件簽名

Prerequisite: Number systems

先決條件: 數字系統

Until now, we have only talked about positive numbers and have already discussed their mathematical operations. But there also exists negative numbers in the number system, in this article we are going to learn about how to represent negative numbers in the binary format?

到目前為止,我們僅討論正數,并且已經討論了它們的數學運算。 但是數字系統中也存在負數,在本文中,我們將學習如何用二進制格式表示負數?

簽名號碼 (Signed Numbers)

In decimal number system, we have (+) sign to represent the positive number and (-) sign to represent a negative number. But in digital logic, we have two symbols 0 and 1, so we use these symbols to represent the sign of the number.

在十進制數字系統中,我們用( + )號代表正數,用( - )號代表負數。 但是在數字邏輯中,我們有兩個符號01 ,因此我們使用這些符號來表示數字的符號

There are two ways of representing signed numbers,

有兩種表示帶符號的數字的方式

  1. Signed Magnitude Form

    簽名幅度表

  2. Complement Form

    補表

1)簽署幅度表 (1) Signed Magnitude Form)

In signed magnitude form, an additional bit is placed to the extreme left (MSB) of the number to represent the sign; thus, it is known as the sign bit.

在帶符號的幅度形式中,在數字的最左端(MSB)處放置一個附加位來表示符號。 因此,它被稱為符號位。

We use 0 to represent the positive numbers and 1 to represent the negative numbers. The extra bit is isolated from the magnitude of binary numbers using a comma.

我們用0代表正數,用1代表負數。 使用逗號將多余的位與二進制數的大小隔離。

Under the signed-magnitude system, a great amount of manipulation is required to add a positive number to a negative number. Thus, representation is possible but still, it is impractical in nature.

在有符號幅度系統下,需要大量的操作才能將正數添加到負數。 因此,表示是可能的,但在本質上仍然是不切實際的。

Example1: Represent 13 and -13 in signed magnitude form

示例1:以帶符號的幅度形式表示13和-13

Solution:

解:

     (13)10 = (0,1101)2   sign-bit 0 is used to represent the positive number
(-13)10 = (1,1101)2  sign-bit 1 is used to represent the negative number

Complement Form: Since performing arithmetic operations using a signed magnitude form is very complex. Digital computers use the complement form to perform these calculations.

補碼形式:由于使用帶符號的幅度形式執行算術運算非常復雜。 數字計算機使用補碼形式來執行這些計算。

There are two complement forms - 1's complement form and 2's complement form.

有兩種補碼形式-1的補碼形式和2的補碼形式。

If the number is positive then, the magnitude is represented in its true binary form and a sign bit 0 is added to the LHS of the MSB. For a positive number, the representation is the same in signed magnitude, 1's and 2's complement form.

如果該數字為正,則以其真正的二進制形式表示幅度,并將符號位0添加到MSB的LHS。 對于正數,表示形式在帶符號的幅度,1和2的補碼形式上相同。

The advantage of using a complement form to perform arithmetic operations is the reduction in the hardware. Instead, of having separate hardware for addition and subtraction only additional adders are needed.

使用補碼形式執行算術運算的優點是減少了硬件。 取而代之的是,沒有用于加法和減法的單獨硬件,僅需要附加的加法器。

1的補碼表示 (1's Complement Representation)

The 1's complement of a number can be obtained by replacing each "0 bit with 1 bit" and "1 bit with 0 bit" in the binary number.

可以通過將二進制數中的每個“ 0位加1位”“ 1位加0位”替換來獲得數字的1的補碼。

Example: Represent (-15)10 in its 1's complement form

示例:以其1的補碼形式表示(-15) 10

Solution:

解:

(15)10 in binary form can be represented as (1111)2.

(15) 10的二進制形式可以表示為(1111) 2

Now, to represent its negative sign, we will add a sign bit 1.

現在,為了表示它的負號,我們將添加一個符號位1。

Thus, (-15)10 = (1,1111)2. To represent it in 1's complement form, we will replace each 1 with 0 (excluding the sign bit, because if we replace sign bit then its sign will be changed to positive which is not correct). Therefore,

因此,(-15) 10 =(1,1111) 2 。 為了用1的補碼形式表示它,我們將每個1替換為0(不包括符號位,因為如果替換符號位,則其符號將變為正數,這是不正確的)。 因此,

signed representation of binary numbers Example 1

2的補碼表示 (2's Complement Representation)

We can get the 2's complement of a number by finding the 1's complement of number and adding 1 to the LSB of the respective 1's complement.

我們可以通過找到數字的1的補碼并將1加到相應的1的補碼的LSB上來獲得數字的2的補碼。

Example: Represent (-15)10 in its 2's complement form.

示例:以2的補碼形式表示(-15) 10

Solution:

解:

As we have discussed above, the 1's complement representation of (-15)10 is given as 10000. Now, we have to add a bit 1 to the LSB in the above 1's complement form i.e., we will get,

如上所述,(-15) 10的1的補碼表示為10000 。 現在,我們必須以上述1的補碼形式在LSB上加一位,即,

signed representation of binary numbers Example 2

Which is the required 2's complement representation of (-15)10.

這是(-15) 10的必填2的補碼表示形式。

Example: Represent (-51)10 in its signed magnitude, 1's complement and 2's complement form.

示例:以(-51) 10的有符號幅度,1的補碼和2的補碼形式表示。

Solution:

解:

signed representation of binary numbers Example 3

翻譯自: https://www.includehelp.com/basics/signed-representation-of-binary-numbers.aspx

二進制文件簽名

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378444.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378444.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378444.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【智能車Code review】——坡道圖像與控制處理

博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。 系列文章 【智能車Code review】—曲率計算、最小二乘法擬合 【智能車Code review】——坡道圖像與控制處理 【智能車Code re…

六、解釋紅外線紡織品的保健、保暖作用?

解釋紅外線紡織品的保健、保暖作用? 收集資料階段 人體既是遠紅外的輻射源又能吸收遠紅外輻射。由于人體60%~70%為水?故人體對紅外輻射吸收近似于水,人體組織所擁有的特定振動頻率和回轉周波數與人體組織中的O&…

linux yum命令作用,YUM命令使用示例

YUM或Yellowdog Updater Modified是管理rpm包的前端工具。 它用于通過命令行界面或使用圖形模式來安裝,刪除,更新和收集有關rpm軟件包的信息。 使用YUM的主要優點是,它解決了rpm包的所有依賴關系,并將它們與包一起安裝。下面讓我們…

PySide開發MySql遠程備份工具

MySql數據庫安裝在機房,而工作人員日常辦公的地方距離機房有段距離,且不在同一樓層。出入機房不是很方便。就想著能否給這些人員開發一個圖形化的備份MySql數據庫的小工具?使用組件如下:(1)Python(2)PySide(3)mysqldump其實mysql已…

HadoopSourceAnalyse --- Nodemanager Container request handler

Overview Container 是Hadoop中運行任務的地方,當Resourcemanager收到一任務請求后,會向nodemanager 請求一個Container 來運行ApplicationMaster, ApplicationMaster運行起來之后,會繼續向Resourcemanager請求新的container來運行…

數據結構 二叉樹的存儲結構_線程二叉樹| 數據結構

數據結構 二叉樹的存儲結構線程二叉樹 (Threaded Binary Tree ) A binary tree can be represented by using array representation or linked list representation. When a binary tree is represented using linked list representation. If any node is not having a child …

七、有機硅柔軟劑在不同發展階段分子結構特征及主要解決的問題?

有機硅柔軟劑在不同發展階段分子結構特征及主要解決的問題? 收集資料階段 聚有機硅氧烷具有低表面能、優良的潤滑性、熱穩定性和疏水性。從分子層面分析,經聚有機硅氧烷處理的織物,其柔軟性來自硅氧烷骨架中 Si—O—Si鍵的 360自由旋轉及甲基之間的低相互作用。因此,聚有機…

【智能車Code review】——拐點的尋找

博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。 系列文章 【智能車Code review】—曲率計算、最小二乘法擬合 【智能車Code review】——坡道圖像與控制處理 【智能車Code re…

linux 單例模式改密碼,Java 利用枚舉實現單例模式

引言單例模式比較常見的實現方法有懶漢模式,DCL模式公有靜態成員等,從Java 1.5版本起,單元素枚舉實現單例模式成為最佳的方法。Java枚舉基本用法枚舉的用法比較多,本文主要旨在介紹利用枚舉實現單例模式的原理,所以這里…

編碼簡介

編碼簡介最近被字符集搞得頭大,基于為自己掃盲的目的,索性收集資料研究一下,現將各方資料歸納成本文。這里并不想把復雜的規則說明一大通。如有需要,請參照其他資料或本文給出的參考資料。 如有錯誤,歡迎指正。…

2013年5月7日---JS中的正則

/*(1)RegExp對象的test方法------------------C#中的isMatchvar num1d23; //一個字符串var regnew RegExp(^\\d$); //準備正則alert(reg.test(num)); //開始匹配并彈出--false*//*(2)ReExp對象的test方法var num123;var regnew RegExp(/^\d$/);ale…

八、關于防水透濕整理

1,防水透濕整理加工技術的類型? 收集資料階段 按照加工方式分類 防水透濕織物按照加工方式可分為高密織物、涂層織物和層壓織物。不同加工方式所對應的織物各有特色。高密織物產生于 20 世紀 80 年代,它的密度可達到普通織物的 20 倍。在晴朗天氣時,紗線孔隙大約為 10 μm…

linux qt 音頻文件怎么打開,Qt:獲取Linux中可用音頻設備的列表

我想要獲取我的Linux系統上可用的所有音頻設備的列表。然后我會將這個列表顯示在一個組合框中,用戶將從中選擇用于錄制/播放的設備。根據用戶的選擇,我將構建QAudioInput和QAudioOutput進行錄制/播放。Qt:獲取Linux中可用音頻設備的列表根據Q…

c# uri.host_C#| Uri.GetLeftPart()方法與示例

c# uri.hostUri.GetLeftPart()方法 (Uri.GetLeftPart() Method) Uri.GetLeftPart() method is an instance method that is used to get a specified part from the given URI based on passed UriPartial enum. Uri.GetLeftPart()方法是一個實例方法,用于基于傳遞的…

求質數算法的N種境界 (N 10) zz

★引子 前天,俺在《俺的招聘經驗[4]:通過筆試答題能看出啥?》一文,以"求質數"作為例子,介紹了一些考察應聘者的經驗。由于本文沒有政治敏感內容,順便就轉貼到俺在CSDN的鏡像博客。   昨天&…

【智能車Code review】——小S與中S道路判斷

博主聯系方式: QQ:1540984562 QQ交流群:892023501 群里會有往屆的smarters和電賽選手,群里也會不時分享一些有用的資料,有問題可以在群里多問問。 系列文章 【智能車Code review】—曲率計算、最小二乘法擬合 【智能車Code review】——坡道圖像與控制處理 【智能車Code re…

Python匿名函數---排序

一、列表的排序 nums [1,2,3,5,4,7,87,4,9,56,44,7,5] nums.sort()#默認從小到大排序 nums#結果為:[1, 2, 3, 4, 4, 5, 5, 7, 7, 9, 44, 56, 87]nums [1,2,3,5,4,7,87,4,9,56,44,7,5] nums.sort(reverseTrue)#從大到小排序 nums#結果為:[87, 56, 44, …

linux 內核編譯需要多大空間,編譯2.6.28內核出錯。。。。空間不足。而/tmp/還有好幾G...

編譯2.6.28內核出錯。。。。空間不足。而/tmp/還有好幾G發布時間:2009-01-02 16:56:47來源:紅聯作者:weixq316今天閑來無事,就去下載了最新的內核--2.6.28來編譯安裝。。。:0)1放在/usr/src/2.6.28/中編譯。。。。。我的/usr還有1G多的空間。…

如何用vi 復制第5行到第10行并粘貼到第12行之后

方法一: 光標放到第五行,輸入:y6y光標放到第12行,輸入:p方法二:命令行模式下輸入:5,10 co 12方法三:延伸一下, 有時候不想費勁看多少行或復制大量行時,可以使用標簽來替代光標移到起…

go zap去除程序名稱_適用于Zip,Zap和Zoom游戲的Python程序

go zap去除程序名稱Write a python program that displays a message as follows for a given number: 編寫一個python程序,顯示給定數字的消息如下: If it is a multiple of three, display "Zip". 如果是三的倍數,則顯示“ Zip…