【转载】负数的二进制

https://jingyan.baidu.com/article/29697b9106eb52ab21de3c7a.html

将十进制的负数变成二进制数的过程:

1.写出绝对值的二进制码(原码)

2.取反(反码)

3.+1,(补码)

 

同理,将二进制的负数换成十进制的负数的过程

1.-1

2.取反

3.求出十进制数

4.加负号

 

为什么要使用补码:https://blog.csdn.net/fenzang/article/details/53500852?utm_source=itdadao&utm_medium=referral

8位二进制数的表示范围[-128,127]

负数比正数多表示一个的原因:利用补码规则,1000 0000和0000 0000都表示原码中的0000 0000,所以将1000 0000拿出来表示-128.

“在计算机中数据用补码表示,利用补码统一了符号位与数值位的运算,同时解决了 + 0、-0 问题,将空出来的二进制原码 1000 0000 表示为 - 128,这也符合自身逻辑意义的完整性。”

转载于:https://www.cnblogs.com/jiading/p/10322072.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278403.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

保存网络文章以供以后使用Instapaper阅读

Have you ever come across a bunch of great articles that you want to read online, but just don’t have the time? Today we take a look at an online service that allows you to read your articles later, either online, or on an iPhone, or eReader. 您是否曾经遇…

谷歌chrome xp_将非Google任务列表添加到Chrome

谷歌chrome xpMost people rely on a task list to help them remember what they need to do but not everyone wants one that is tied to a Google account. If you have been wanting an independent tasks list then join us as we look at the Tasks extension for Googl…

学习笔记 - MarkDown 语法

学习参考网址:https://www.appinn.com/markdown/index.html # **gitskill**## 标题 ># 这是 H1 >## 这是 H2 >###### 这是 H6## 区块引用 Blockquotes > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipisci…

[BZOJ4671]异或图

description BZOJ 定义两个结点数相同的图\(G1\)与图\(G2\)的异或为一个新的图\(G\), 其中如果\((u,v)\)在\(G1\)与\(G2\)中的出现次数之和为\(1\), 那么边\((u,v)\)在\(G\)中, 否则这条边不在\(G\)中. 现在给定\(s\)个结点数相同的图\(G1...s\),设\(S{G1,G2,...,Gs},\) 问\(S\…

我们生活在最好的时代

2019独角兽企业重金招聘Python工程师标准>>> 没规划的人生叫拼图,有规划的人生叫蓝图; 没目标的人生叫流浪,有目标的人生叫航行! 我们生活在最好的时代:在认知和学习机会上,人人平等&#xff0c…

MapReduce详解和WordCount模拟

最早接触大数据,常萦绕耳边的一个词「MapReduce」。它到底是什么,能做什么,原理又是什么?且听下文讲解。 是什么 MapReduce 即是一个编程模型,又是一个计算框架,它充分采用了分治的思想,将数据处…

无法创建系统映像_如何创建USB驱动器的映像

无法创建系统映像You can back up your USB drive by creating a saved image. You can then take that saved image and clone multiple USB sticks. This guide shows you how to create an image of your USB drive using Windows 10. 您可以通过创建保存的图像来备份USB驱动…

UGUI事件之Drag拖拽事件

UI事件之Drag拖拽事件2.UGUI 事件命名空间   当我们需要使用 UGUI 中的事件的时候,需要在脚本内引入专有命名空间:   using UnityEngine.EventSystems;----------------------------------2.拖拽相关事件接口----------------------------------1.三…

java 通过cookie判断是否登陆

protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {// 判断cookie是否有登录信息Cookie[] cookies req.getCookies();boolean isLogin false;for(Cookie c : cookies){if("loginInfo".equals(c.getNa…

使用高级管理控制台获得对Windows Home Server的扩展访问

Windows Home Server is easy to setup and use so anyone with basic computer knowledge can operate their own server. But what if you’re an advanced user and want more control over various administrative functions? The Advanced Admin Console Addin gives you…

变动性算法源代码分析与使用示例(copy_backward、 transform、 replace_copy_if 等)

首先回顾前面的文章,我们把for_each 归类为非变动性算法,实际上它也可以算是变动性算法,取决于传入的第三个参数,即函数 指针。如果在函数内对容器元素做了修改,那么就属于变动性算法。 变动性算法源代码分析与使用示例…

[转]QDir类及其用法总结

直接给出原文链接:QDir类及其用法总结 转载于:https://www.cnblogs.com/rainbow70626/p/10330643.html

如何在Outlook中的电子邮件上显示快速操作按钮

There are probably actions you regularly perform in Outlook, such as deleting, archiving, and marking things as read. Here’s how to use Quick Action buttons to add one-click options that appear over every email to perform each action. 您可能会在Outlook中定…

c++读取和写入TXT文件的整理

c读取和写入TXT文件的整理 #include "stdafx.h" #include <iostream> //无论读写都要包含<fstream>头文件 #include <fstream> #include <iomanip> using namespace std;int main() {//ifstream从文件流向内存的ifstream表示文件输入流…

使用RestTemplate时报错java.lang.IllegalStateException: No instances available for 127.0.0.1

我在RestTemplate的配置类里使用了 LoadBalancedComponentpublic class RestTemplateConfig { Bean LoadBalanced public RestTemplate restTemplate(){ return new RestTemplate(); }}或者 再调用Autowiredprivate RestTemplate restTemplate;必须使用应用名作为代替ip:端口&a…

sh变量特性(3)默认特性

变量说明$0当前脚本的文件名$n传递给脚本或函数的参数&#xff0c;n是数字&#xff0c;第n个参数$#传递给脚本或函数的参数个数$*传递给脚本或函数的所有参数$传递给脚本或函数的所有参数。被””包含时&#xff0c;与$*稍有不同$?上个命令的退出状态&#xff0c;或函数返回值…

zune linux_更新您的Zune Player软件

zune linuxKeeping your computer and software up to date is very important in keeping everything running smooth and secure. It’s also important to keep your geeky gadgets updated as well. Here we take a look at updating a Zune HD. 保持计算机和软件的最新状态…

继承的几种方式

1.借助构造函数实现继承 function Parent() { this.name parent } Parent.prototype.say function () { // 不能被继承 this.say function() { console.log(hello this.name) } } function Child() { Parent.call(this) this.type child } console.log(new Child) // 没有参…

写一个简单的 django_post demo

1.新建一个django工程&#xff0c;其路由为下图 2.要做的是一个 简单的登录请求&#xff0c;以表单形式提交&#xff0c;html 部分代码如下 这里注意action指向的是路由的地址&#xff0c;index1后的views.login部分代码如下 这段代码指的是&#xff0c;如果login接收到的请求是…

日志收集

2019独角兽企业重金招聘Python工程师标准>>> ELK (ElasticSearch、Logstash、Kibana)&#xff1a; https://my.oschina.net/itblog/blog/547250 转载于:https://my.oschina.net/zfscofield/blog/1625703