十六进制数字是负数吗? [英] Are hexadecimal numbers ever negative?

查看:843
本文介绍了十六进制数字是负数吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

十六进制数字是负数吗?如果是,那么怎么做?

对于二进制文件,您将有 signed unsigned
如何用Hex表示它们?我需要这个来完成我即将开始的十六进制程序。

Are hexadecimal numbers ever negative? If yes then how?
For binary you would have signed and unsigned.
How would one represent them in Hex? I need this for a hex routine I am about to embark upon.

推荐答案

是的。例如,您可以使用带符号的32位二进制和十六进制表示形式:

Yes. For example you'd have the following representations in signed 32-bit binary and hex:

Decimal: 1
 Binary: 00000000 00000000 00000000 00000001
    Hex: 00 00 00 01

Decimal: -1
 Binary: 11111111 11111111 11111111 11111111
    Hex: FF FF FF FF

Decimal: -2
 Binary: 11111111 11111111 11111111 11111110
    Hex: FF FF FF FE

正如您所看到的,负数的十六进制表示与二进制表示直接相关。

As you can see, the Hex representation of negative numbers is directly related to the binary representation.

这篇关于十六进制数字是负数吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆