本文共 3893 字,大约阅读时间需要 12 分钟。
十六进制190的2进制数
Hexadecimal numbers, often shortened to “hex numbers” or “hex”, are numbers represented in base 16 as opposed to base 10 that we use for everyday arithmetic and counting.
十六进制数字(通常缩写为“十六进制数字”或“十六进制”)是以16为底的数字,而不是我们用于日常算术和计数的以10为底的数字。
In practical terms, this means that each column of a number written in hexadecimal can represent up to 16 values.
实际上,这意味着用十六进制写的数字的每一列最多可以表示16个值。
Digits in hexadecimal use the standard symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 to represent the corresponding value, and use the first six letters of the alphabet to represent the values 10 through 15 (E.G: A, B, C, D, E, F).
十六进制数字使用标准符号0、1、2、3、4、5、6、7、8和9表示相应的值,并使用字母的前六个字母表示值10到15( EG:A,B,C,D,E,F)。
In programming, we prefix hexadecimal constants with 0x
, with some exceptions.
在编程中,我们将十六进制常量加0x
前缀,但有一些例外。
0x1 == 10xF == 150xFF == 2550xFFF == 40950x1000 == 4096
In the standard base 10 system, each column represents increasing powers of 10, while in base 16 each column represents increasing powers of 16.
在标准base 10系统中,每列代表幂的增加10,而在base 16中,每列代表幂的增加16。
As seen in the table example above, with one hex digit we can represent numbers up to and including 15. Add another column and we can represent numbers up to 255, 4095 with another column, and so on.
从上面的表格示例中可以看出,用一个十六进制数字可以代表不超过15的数字(包括15)。添加另一列,可以代表不超过255的数字,用另一列代表4095,以此类推。
Hexadecimal first found its use in Computer Science as a convenience feature.
十六进制最初在计算机科学中被发现是一种便利功能。
Data in our computers has a lowest common storage unit, the Byte. Each byte contains 8 bits, and is able to store a number between 0 and 255 inclusive.
我们计算机中的数据具有最低的公用存储单元Byte。 每个字节包含8位,并且能够存储0到255之间的数字。
Hexadecimal has the advantage of being terse and having well defined boundaries.
十六进制的优点是简洁明了且边界清晰。
A single byte is always represented by two hexadecimal digits from 0x00 to 0xFF, the latter being the largest per-byte value of 255.
单个字节始终由两个0x00到0xFF的十六进制数字表示,后者是每字节最大的255。
The terseness and byte-aligned nature of hexadecimal numbers make them a popular choice for software engineers working on low-level code-bases or embedded software.
十六进制数字的简洁性和字节对齐性质使它们成为从事底层代码库或嵌入式软件的软件工程师的普遍选择。
JavaScript supports the use of hexadecimal notation in place of any integer, but not decimals.
JavaScript支持使用十六进制表示法代替任何整数,但不支持十进制。
As an example, the number 2514 in hex is 0x9D2, but there is no language-supported way of representing 25.14 as a hex number.
例如,十六进制数2514为0x9D2,但是没有语言支持的方式将25.14表示为十六进制数。
Using hexadecimal in your code is a personal and stylistic choice, and has no effect on the underlying logic your code implements.
在您的代码中使用十六进制是个人的风格选择,并且对您代码所实现的基础逻辑没有影响。
CSS has for a long time used hexadecimal notation to represent color values. Consider the following selector:
CSS长期以来一直使用十六进制表示法来表示颜色值。 考虑以下选择器:
.my-container { background-color: #112233; color: #FFFFFF;}
The background-color
’s value is in fact three hex bytes.
实际上, background-color
的值为三个十六进制字节。
The CSS processor treats these as three individual bytes, representing Red, Green, and Blue.
CSS处理器将它们视为三个独立的字节,分别表示红色,绿色和蓝色。
In our example, 11 corresponds to the Red color component, 22 corresponds to the Green color component, and 33 to the Blue color component.
在我们的示例中,11对应于红色分量,22对应于绿色分量,33对应于蓝色分量。
There is currently no way as of CSS3 to define a color with an alpha component using hex. The proposed CSS4 Draft1 includes a proposal to allow for an extra byte to specify alpha values.
从CSS3开始,目前尚无使用十六进制的Alpha分量定义颜色的方法。 拟议CSS4草案1包含一项建议,允许增加一个字节来指定alpha值。
For now, use of the standard rgba()
function is the recommended way to add an alpha value to your colors.
目前,建议使用标准rgba()
函数为颜色添加Alpha值。
翻译自:
十六进制190的2进制数
转载地址:http://kfuzd.baihongyu.com/