33

知多一点二进制中的负数

 5 years ago
source link: https://juejin.im/post/5c530559f265da2d9617e1af
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
hello~亲爱的看官老爷们新年好~相信不少同学知道,如果要将一个数字转换为它的相反数,在 Javascript 中,除了在它前面加个-号之外,还可以对该数字进行取反,之后再加 1。前者(本质是 0 减去对应的数字)可以得到相反数,完全符合我们的直觉,但为何取

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK