gpt4 book ai didi

SQL按位不(~)

转载 作者:行者123 更新时间:2023-12-05 08:19:17 25 4
gpt4 key购买 nike

谁能解释一下原因

select ~1

给出结果

-2

也许我对数字类型的实际位有很多了解。你会推荐什么资源?

最佳答案

问:有人可以解释为什么选择 ~1 给出结果 -2 吗?

A:出于同样的原因,~0 会给出 -1 :)

这是一篇关于“二进制补码”算法的好文章:

大多数 CPU 架构都是二进制补码(相对于一个的补码)。来自同一篇文章:

Two's complement is the easiest to implement in hardware, which may be the ultimate reason for its widespread popularity[citation needed]. Processors on the early mainframes often consisted of thousands of transistors – eliminating a significant number of transistors was a significant cost savings. The architects of the early integrated circuit-based CPUs (Intel 8080, etc.) chose to use two's complement math. As IC technology advanced, virtually all adopted two's complement technology. Intel, AMD, and Power Architecture chips are all two's complement.

关于SQL按位不(~),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16286519/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com