0.1 + 0.2 == 0.3 吗?

Java83

为什么负数要用补码表示?

负数用补码表示的原因主要是为了统一正数的加法和减法运算。毕竟,数字的加法和减法是一种非常常见的运算。不要搞专业化,试着统一运作。

[En]

The reason why negative numbers are represented by complements is mainly to unify the addition and subtraction operations of positive numbers. After all, the addition and subtraction of numbers is a very common operation. Don't make specialization, and try to operate in a unified way.

十进制小数怎么转成二进制?

十进制整数转二进制使用的是「除 2 取余法」,十进制小数使用的是「乘 2 取整法」。

计算机是怎么存小数的?

计算机是以浮点数的形式存储小数的,大多数计算机都是 IEEE 754 标准定义的浮点数格式,包含三个部分:

符号位:表示数字是正数还是负数,为 0 表示正数,为 1 表示负数;

指数位数:指定数据中小数点的位置。指数可以是负数,也可以是正数。指数数字的长度越长,表示值的范围越宽;

[En]

Exponential Digit: specifies the position of the decimal point in the data. Exponential numbers can be either negative or positive. The longer the length of the exponential digit, the wider the range of expression of the value;

尾数位:小数点右侧的数字,也就是小数部分,比如二进制 1.0011 x 2^(-2),尾数部分就是 0011,而且尾数的长度决定了这个数的精度,因此如果要表示精度更高的小数,则就要提高尾数位的长度;

用 32 位来表示的浮点数,则称为单精度浮点数,也就是我们编程语言中的 float 变量,而用 64 位来表示的浮点数,称为双精度浮点数,也就是 double 变量。

输入验证码查看隐藏内容

扫描二维码关注本站微信公众号 Johngo学长
或者在微信里搜索 Johngo学长
回复 svip 获取验证码
wechat Johngo学长