Talk:Signed number representations/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Archive 1

Redirects

I had a hard time finding this page for information about ones complement. Maybe the "ones complement" and "one's complement" pages could redirect to this page, since those were the ones I tried. I ended up going through a few complement redirect pages to find this.

Well, "one's complement" already redirects here, as does "ones' complement". I suppose adding one more wouldn't hurt, and could help people find information more easily, so I added "ones complement". --Rick Sidwell 00:49, 14 September 2005 (UTC)

end-around carry

The process of "adding back the carry", as it is termed in this article about ones' complement arithmetic, was always referred to as an "end-around" carry.

Well - not important. By the time I read down to the section concerning two's complement, I see that the proper term for this ones' complement operation is introduced at that point in the article. So it's there!

Mea 01:55, 23 September 2007 (UTC) mea

Ones complement went the way of Betamax

This is quite true, you won't find ones' complement. IBM pushed this through. In the early years, Mathematicians dominated the field. In the ones' complement setup, a negative zero can result. "BUT THERE IS NO SUCH THING !!" the mathematicians exclaim. That always tickled me. They go along with all kinds of obscure and arcane advances, like "imaginary" numbers. But this they couldn't swallow.
It doesn't do much practical damage: We lose one number out of a very large set of integers we can represent. Nowadays nobody looks at numerical dumps. Back in the old days when you did, it was easy to read ones complement numbers. 000000001 was a positive one, and 111111110 was a negative one. (Try adding a one to that negative one, and you get that horrible beast the mathematicians fear!)
The larger negative numbers in twos complement become unrecognizable - you can't simply flip the bits and find the number. This because the subtraction used to compute negative numbers can flip some bits and not others. But now that is not really a factor, because you would browse a dump with a UI... Mea (talk) 06:02, 8 February 2009 (UTC)

Base -2

What is the point of discussing Base -2? Does anybody use this or is it just a curiosity? Note that there are an unlimited number of potential base systems (e.g. you can assign a different base to each digit) that don't belong in this discussion. —Preceding unsigned comment added by 17.209.4.116 (talk) 19:26, 14 May 2010 (UTC)


How the heck do you do arithmetic on base -2 ? Ordinary addition doesn't seem to work: 1+2=3, 2+2=-4, 3+2=-3 ... —Preceding unsigned comment added by 212.71.114.220 (talk) 09:19, 14 September 2010 (UTC)

ZigZag encoding

Is it worth mentioning the ZigZag encoding used by google protocol buffers for their variable length signed integer types? You can find details here: http://code.google.com/apis/protocolbuffers/docs/encoding.html

219.90.197.140 (talk) 04:17, 7 January 2011 (UTC)

Detailed Discussion

For historical purposes, 1's complement needs a thorough discussion. The technology may be all but dead, but the mathematics endures. There is a simplicity to 1's complement not seen in 2's complement, and some very subtle issues with the mathematics that need to be fully documented.

I'll gladly write the first draft. — Preceding unsigned comment added by KentOlsen (talkcontribs) 16:49, 24 January 2011 (UTC)

Thank you for creating the ones' complement article. --DavidCary (talk) 18:28, 3 September 2011 (UTC)

Merge proposal for signedness

The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section. A summary of the conclusions reached follows.
The result was do not merge. Incnis Mrsi (talk) 16:54, 30 January 2012 (UTC)

I have recommended Signedness be merged into Signed number representations. Signedness is small and seems to discuss SNR at the stub scale. It seems better to redirect signedness to SNR. Thoughts? Cliff (talk) 18:18, 24 August 2011 (UTC)

Merging from signedness sounds good to me. --DavidCary (talk) 18:28, 3 September 2011 (UTC)
Oppose. Signedness is about various semantics: in computing, a numerical type may either start from 0 or have both signs. This involves not only representation as a bit string, but also the choice of signedness during compilation, some problems with arithmetic overflow, etc. The merging proposed would result is a redirect from a general term to a narrower topic, which is incorrect. On the other hand, "Signed number representations" is a notable topic itself which worth a separate article. Incnis Mrsi (talk) 11:07, 4 September 2011 (UTC)

I think signedness should remain separate. It is an attribute of meaning, whereas this article is about representations. Both articles benefit by remaining separate. -R. S. Shaw (talk) 04:59, 18 September 2011 (UTC)

The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Ones' complement

I suggest moving the "history" section of the ones' complement article into a "history" section of the signed number representations article. --DavidCary (talk) 18:28, 3 September 2011 (UTC)

I don't think burying ones' complement in a history section would help the reader. This is about the reasonable possible representations, not the currently predominant ones. -R. S. Shaw (talk) 04:59, 18 September 2011 (UTC)
I don't think that was what DavidCary was suggesting. He wasn't suggesting moving the entire ones' complement article here, he was just suggesting moving the History section here; as the History section discusses more than ones' complement, it seems more appropriate to put it here than leave it there. Nothing would be moved to a history section from another section; a history section would be moved from one article to another. Guy Harris (talk) 19:56, 8 August 2013 (UTC)
As a reader I would prefer not to have history and technical facts mixed and as the history of the different representations will (at least eventually) overlap, I suggest to have just one additional history page for the representations in addition to the existing shorter technical overview signed number representations like now. This would mean to merge ones' complement into a new history of signed number representations and even maybe move some more historical notes from here to the new history page. --maye (talk) 23:32, 5 January 2012 (UTC)
It is very common in Wikipedia to have a "History" section at the beginning, and that is okay and appropriate, even though some people may want to skip it and jump to the technical details. I object to having separate a "History of XXX" article for every topic XXX, unless the history has enough length and significance to deserve a separate article. Musiphil (talk) 23:47, 10 February 2012 (UTC)
I agree to DavidCary; the History section contains material that is relevant to all of two's complement, ones' complement and sign-and-magnitude, and I also find it weird to see it buried under the title of ones' complement. Musiphil (talk) 23:47, 10 February 2012 (UTC)

It seems like the consensus is no. Removing the tag, it's been a while since there was any discussion anyway. --128.187.97.18 (talk) 01:59, 26 June 2013 (UTC)

It needed to be removed from the "History" section of the ones' complement page as well; I did that. However, I'm not sure that the history of signed number representations belongs in a page for one of those representations; I tend to think it belongs here rather than in a separate "History of signed number representations", as per Musiphil's comment. Guy Harris (talk) 19:18, 6 August 2013 (UTC)
I've moved it. Guy Harris (talk) 09:28, 15 August 2013 (UTC)

Processors using ones' or two's complement

I read in J¨org Arndt's book on "Algorithms for programmers" that "twos complement arithmetic (that is: on likely every computer you’ll ever touch)" indicates that ones' complement processors are now rare. Is this true?

I worked on a few ones' complement computers such as CDC 32xx/64xx mainframes that were ones' complement. Are ones' complement processors still being produced? I once heard that on a Sun v480 that a minus-zero was used as a NULL value indicator in Informix. Never confirmed though.

Just thinking that if the majority of CPU's are two's complement, (like IBM's mainframes) that the ones' complement "short-list" would be a nice to-know element of the main article. — Preceding unsigned comment added by 206.174.82.201 (talkcontribs) 20:57, 21 August 2008 (UTC)

The Sun v480 was SPARC-based; SPARC processors are two's complement, so, if Informix used -0 as a null value indicator, either that's a floating-point -0 (SPARC uses IEEE floating point format, which is sign-magnitude) or they're using some number representation other than the native two's complement for integers. Guy Harris (talk) 22:26, 15 August 2013 (UTC)

twos complement arithmetic used for calculations is not the same thing as using two's complement for indicating a numbers sign. That is, a machine can use two's complement arithmetic AND still use a sign bit for sign representation. In fact that is what is done with the x86 machines which realistically the typical modern computer archiecture in almost every possible measurement. As a result,I am also removing the innacurate assertion which says two's complement is the standard signing notation in a typical modern computer. --B105xor (talk) 05:45, 11 April 2010 (UTC)

I'm not sure what you mean by "use a sign bit for sign representation". In ones' complement, twos' complement, and sign-magnitude representations, the high-order bit of a positive number is clear and the high-order bit of a negative number is set, so, in that sense, the high-order bit is a sign bit in all three of those representations. x86 processors use twos'-complement notation (see section 4.2.1 of the Intel® 64 and IA-32 Architectures Software Developer’s Manual), as do the IBM System/360 and its successors, SPARC, MIPS, ARM, Itanium, and a ton of other current and former instruction set architectures. Guy Harris (talk) 19:10, 6 August 2013 (UTC)

Anchor for "Signed magnitude representation" section

I think I caught all the cases where redirect pages pointed to "Signed number representations#Sign-and-magnitude method" and changed them to point to "Signed number representations#Signed magnitude representation" after the section name was changed; should the anchor be for "Sign-and-magnitude method" or for "Signed magnitude representation", did I miss a redirect page, or is the intent to handle other references to that section? Guy Harris (talk) 17:26, 8 August 2013 (UTC)

For some reason I missed these redirects in my watchlist and did not expect them to be fixed by a third person after [1]. Feel free to remove my anchor. Incnis Mrsi (talk) 19:44, 8 August 2013 (UTC)
I moved the anchor before the heading for cosmetic reasons.
Also - I added that there are different names for this: "sign-magnitude", "signed magnitude", and "sign-and-magnitude" are all in use in the world. In fact, they are variously and inconsistently used in this article. Could use cleanup. — Preceding unsigned comment added by 152.17.129.116 (talk) 22:36, 3 February 2014 (UTC)

One's versus ones' complement

According to the Bible, one's complement should be properly called ones' complement:

Detail-oriented readers and copy editors should notice the position of the apostrophe in terms like "two's complement" and "ones' complement": A two's complement number is complemented with respect to a single power of 2; while a ones' complement is complemented with respect to a long sequence of 1s. (TAOCP, Volume 2: Seminumerical Algorithms, chapter 4.1)

Although Google seems to imply that "one's complement" is used often (but it is hard to compare, as AFAIK you cannot force Google to consider punctuation), Knuth's view seems logical at the very least. -- Mormegil 19:56, 29 Jul 2004 (UTC)

OK, no reaction, so I have changed it in the article. --Mormegil 15:59, 3 Oct 2004 (UTC)
I'm not sure it's so obvious, despite what Knuth says in the bible. Google can distinguish "one's complement" versus ("ones' complement" or "ones complement"). The first gets 35,700 hits versus 13,500 for the others. (Also, judging from the first page of excerpts, "ones" predominates over "ones' "). For comparison, "two's" gives 69,700 versus 28,600 for twos'/twos. The tens and nines complements are fairly evenly split (and few). -R. S. Shaw 19:40, 21 July 2005 (UTC)
All the computer engineering textbooks and computer/CPU manuals in my not-so-modest collection use either "ones/twos complement" (i.e., no apostrophes at all) or "one's/two's complement" (i.e., "common" non-Knuth). M. Morris Mano's book Digital Design (1984) generally refers to "'s complement", being the radix. --Wernher 20:55, 8 October 2005 (UTC)

r's complement is not the same concept as ones' complement because the latter is not derived conceptually from "one" being the radix of a base. --Matt Westwood 07:59, 5 November 2011 (UTC)

Based on the idea that an encyclopedia should be correct, I've changed all instances of "one's complement [sic]" to "ones' complement" again. --Quuxplusone 02:01, 30 September 2006 (UTC)
I came to this talk page pondering about the grammar issue. Interesting. –– Constafrequent (talk page) 15:32, 23 November 2006 (UTC)
from Talk:Two's complement: Detail-oriented readers and copy editors should notice the position of the apostrophe in terms like two's complement and ones' complement: A two's complement number is complemented with respect to a single power of 2, while a ones' complement number is complemented with respect to a long sequence of 1s. (Volume 2, p. 203, according to [2]) 129.31.72.52 13:35, 15 June 2007 (UTC)

I always thought about it thusly: "the complement of the ones" and "the complement of the twos", which give "ones' complement" and "twos' complement". If the latter is written "two's complement", then that would mean "the complement of a two" probably, which seems a bit odd ( is, after all, lots of 2s -- just as much as the string of 1s is lots of 1s -- when it's expanded). If that makes sense. —Sam Wilson (Australia) 00:33, 29 October 2007 (UTC)

Changed the article to use the ones' / two's convention as per Knuth. According to "Principles and Applications of Electrical Engineering" by Giorgio Rizzoni, there are no apostrophes at all, but I'm more inclined to follow the Bible. Feel free to change it, but at least the whole article is consistent now. LancerSix (talk) 02:14, 28 February 2008 (UTC)

Wow. I came here for the same reason. "Ones'" with "two's" rather than "twos'" doesn't really make sense, but I'll leave it alone. Perhaps Knuth knows more about math than language, but the convention he settled on is illogical, and I'm sure he understands logic! Alanlarue (talk) 20:51, 28 February 2008 (UTC)

I'm here for the same detail. I was reading the article, found an apparent error, saw that the error was very consistent, and so, checked out the talk page. Fortunately, what I was looking for was right at the top of the talk page. Perhaps this is important enough to mention in the article itself. Maybe find a way to somehow gracefully acknowledge the apparent grammatical inconsistency on first use of ones' and two's, and add a paragraph explaining the grammar somewhere toward the bottom of the article. I'm just passing through, and found the answer I was looking for here in the talk page, but if a significant number of people are spotting an error that's not actually an error, maybe it's time to somehow include an explanation right in the article. --Loqi T. (talk) 01:06, 4 April 2008 (UTC)

After all this discussion there still remains an inconsistency! In the penultimate paragraph of the Ones' Complement section, the various Internet protocols are said to use the same "16-bit 1's complement checksum algorithm." Shouldn't that be 1s' or, preferably, ones'? 83.104.249.240 (talk) 19:43, 20 March 2009 (UTC)

Nobody commented so I've changed it. 83.104.249.240 (talk) 22:38, 10 April 2009 (UTC)
Thank you Wernher for pointing out that reliable sources don't all agree on the proper spelling.
My understanding of WP:YESPOV is that when reliable sources don't agree, Wikipedia articles should mention the alternatives.
I think Knuth's spelling is notable enough to mention, and added it to the "History" section. How many other spellings should this article mention? Is there a better section than "History" to discuss the various opinions on spelling? --DavidCary (talk) 17:35, 27 August 2014 (UTC)
Wtshymanski and I agree that reliable sources don't agree on the proper spelling for "ones complement".
But a recent revert[3] removed all mention of this disagreement and the supporting references.
Wikipedia policy WP:YESPOV still says "Wikipedia aims to describe disputes, ... strive in good faith to provide complete information", right? --DavidCary (talk) 02:08, 29 August 2014 (UTC)

Sign-magnitude as degenerate polar

Is it worth mentioning that sign-magnitude representation is a degenerate case of the polar coordinate system (or log-polar coordinates in the case of floating point)? It extends from being able to represent angles of only 0° for unsigned types to representing 0° and 180°, and follows the same modular arithmetic rules for multiplication and division. --sh1 (talk) 17:57, 2 October 2014 (UTC)

Advantages of signed magnitude representation

Signed magnitude representation would be great for numerical code. As for -0 that would make a nice NaN. There are a lot of place where floating point code could be replace with fixed point integer code if signed magnitude was used. All the cases 2's complement introduces makes fixed point integer code more difficult. Sean O'Connor — Preceding unsigned comment added by 113.190.204.87 (talk) 04:00, 28 November 2013 (UTC)

An "integer" is a member of the set of integers, so it does not include anything with a fractional component, so presumably in the cases where floating-point code could be replaced by fixed-point code, you would choose a scale factor such that all values being used are multiples of 1 (for example, with a scale factor of 2, a value of 0.5 would be represented as 1), correct? Guy Harris (talk) 05:15, 28 November 2013 (UTC)
Correct. Guy Harris, yes, that's exactly how fixed-point arithmetic works. (You may be interested in the Wikibooks that the "fixed-point arithmetic" article links to). --DavidCary (talk) 20:23, 21 December 2014 (UTC)
Either the -0 for sign-magnitude or ones' complement could be used. The most negative two's complement value could also be used, though sometimes people want to use it as a numeric value. (More often as a bit pattern.) The ALU has to be designed not to generate -0 for normal operations. (The usual trick is to build a ones' complement subtractor and subtract the complement to add.) Gah4 (talk) 01:18, 25 August 2015 (UTC)

Digit complement and Radix complement

This article seems to only describe the binary forms, but not the general case of digit complement (subtract each digit from one less than the radix) or radix complement (subtract from radix to the Nth power, where N is the number of digits, not including signs). It seems that nines' complement and ten's complement (using the Knuth position for the apostrophes) are somewhat described in Method of complements, but there could be a general, radix independent, article. Gah4 (talk) 21:02, 24 August 2015 (UTC)

In computing, signed number representations are required to encode negative numbers in binary number systems.

There needs to be a sign encoding for any radix, not just binary. This article seems to be pretty much only about binary representations,though. Gah4 (talk) 00:03, 27 August 2015 (UTC)

Excess-K a generalization of two's-complement?

In the Excess-K section there's this claim:

"This can be seen as a slight modification and generalization of the aforementioned two's-complement, which is virtually the excess-(2N−1 − 1) representation with negated most significant bit."

I believe this should have been:

"[…] which is virtually the excess-(2N−1) representation […]".

A quick check to prove that the existing claim is wrong: A number and its two's-complement are either both even or both odd, and this would be violated if 1 were subtracted from 2N−1. In any case, I wonder what the significance is of mentioning this particular and somewhat obscure relationship between two's-complement and excess-K, as the inversion of the most significant bit kind of makes excess-K NOT a generalization of two's-complement. Wouldn't it be equally (or more) valid to point out that two's-complement is excess-(2N) with bit N thrown away? --Yawe (talk) 10:59, 2 September 2016 (UTC)

As there have been no comments to this, I've made the change from excess-(2N−1 − 1) to excess-(2N−1). Yawe (talk) 10:39, 21 January 2017 (UTC)
Yes it is excess-(2N−1) with inverted MSB. It is not commonly used for integer representation, as zero doesn't have all bits zero. Note, for example, that C allows for sign magnitude, ones complement, and twos complement, but not excess K for any K. For floating point exponents, in formats not using a hidden 1, having the smallest exponent with all zero bits is an advantage. Gah4 (talk) 11:05, 21 January 2017 (UTC)