※ 引述《kindaichitom (飯吃到下巴脫臼)》之銘言:
: 10110111(2進位)是下列哪個數字的2's補數?
: A. 73 B. 81 C. -73 D. -81
: 答案: C.
: 可是我認為是選項A耶...
: 73的二進制 01001001
: 轉成1的補數 10110110
: 轉成2的補數 10110111
: 所以是73
: 是不是我觀念有錯還是誤解題意呢??
: Thanks!!
今天終於在英文的 wikipedia上看到當初我
發這篇文章的疑惑點,算是ambiguity吧!?
http://en.wikipedia.org/wiki/Two's_complement
這文篇的下面段落在討論
Potential ambiguities in usage
One should be cautious when using the term two's complement,
as it can mean either a number format or a mathematical operator.
For example 0111 represents 7 in two's-complement notation,
but 1001 is the two's complement of 7, which is the two's complement
representation of –7.
In code notation or conversation the statement
"convert x to two's complement" may be ambiguous,
as it could describe either the change in
representation of x to two's-complement notation from some other format,
or else (if the writer really meant "convert x to its two's complement")
the calculation of the negated value of x.
^^^^^^^
應該是negative?
看了這段討論我在想這個ambiguity有關係到原先我發問的題目
所以我原來的答案其實也不能算是錯的?
thanks!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.105.119
※ kindaichitom:轉錄至看板 ask 03/14 04:02
※ 編輯: kindaichitom 來自: 61.228.105.119 (03/14 04:06)