Timeline for How do I convert an integer to binary in JavaScript?
Current License: CC BY-SA 3.0
Post Revisions
42 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 4, 2025 at 7:30 | answer | added | Devesh Choudhary | timeline score: -2 | |
| Mar 10, 2023 at 0:12 | history | wiki removed | Makyen♦ | ||
| Mar 9, 2023 at 23:59 | history | made wiki | Post Made Community Wiki by Makyen♦ | ||
| Jul 6, 2022 at 10:06 | answer | added | Teocci | timeline score: 3 | |
| May 12, 2022 at 17:07 | answer | added | Yadab Sutradhar | timeline score: 5 | |
| Mar 12, 2022 at 5:35 | answer | added | Diriector_Doc | timeline score: -1 | |
| Jul 21, 2021 at 11:10 | answer | added | Lars Flieger | timeline score: 3 | |
| Mar 11, 2021 at 21:44 | comment | added | barlop | @JoePythonKing What do you mean " It can only be in 1s complement?" You are from the UK so maybe you can write better in English. You can look up -1 in 1s complement or -1 in 2s complement. Computers tend to use 2s complement over 1s complement but it's no mystery to go from one to the other. There are some other representations out there. As for how many 1s when it comes to negative numbers, in eg 2s complement , it doesn't matter and probably wouldn't matter for 1s complement either. It depends how many bits you have to store the number! | |
| Feb 4, 2021 at 20:05 | comment | added | JoePythonKing | What actually is negative zero in binary in javascript? It can only be in 1s complement? It is usually represented as all binary 1s. - > 111111111.... not sure how many. This reference has 32bit number binary representation of -0 as 1 followed by 31 zeros. - en.wikipedia.org/wiki/Signed_zero | |
| Jan 12, 2021 at 2:30 | comment | added | barlop | Let us continue this discussion in chat. | |
| Jan 11, 2021 at 23:28 | comment | added | dingalapadum | I wrote „-1011“ not „1011“. negative numbers seem to be your whole issue with the ‚wrong‘ answers, right? Anyway. IMO it is a very poor quality question as it stands and it would be really simple to improve. I was just trying to explain why I think so. The ‚wrong‘ answers and your own comments support this. OTOH You still have not argued why it is better not to mention 2s complement in the title or body of the question. Asking for ‚how to convert to binary‘ but actually requiring 2s complement as an answer is (in your own words) ambiguous. Why not just make the question precise then? | |
| Jan 11, 2021 at 21:53 | comment | added | barlop | @dingalapadum You are just spewing further red herrings, for example, you write , as some kind of argument to me, that "1011 can be understood as binary number " (As if that is meant to be news or that I suggested otherwise). | |
| Jan 11, 2021 at 21:17 | comment | added | dingalapadum | When we talk about representation of numbers in „x-ary“, we mean that we use x digits to represent the magnitude of the number. The sign of the number is not a digit and is not used for the magnitude. The sign also does not change the magnitude of the number. What you are asking about, has to do with how to encode numbers in a binary string. In the comment you are already saying you care about 2s complement. So, why not put it in the title or in the question itself, to avoid misleading people, avoiding this discussion, make the question clearer and of higher quality overall? | |
| Jan 11, 2021 at 20:09 | comment | added | barlop | @dingalapadum Well consider this. How many different ways (in practise), do computers represent positive and negative integers? There's the sign magnitude method, there's 1s complement, and 2s complement. And there's "some custom method". If somebody is going to show a way, then they should state the name of the representation. If somebody writes "-1101" that's not binary is it. 'cos a minus sign is not a binary digit. If somebody is going to say that 1 is "1" and -1 is "11111" well, what's the mechanical way you are distinguishing these. What's the name of that system. | |
| Jan 11, 2021 at 16:22 | comment | added | dingalapadum | This question is incredibly misleading. "Maybe a bit ambiguous" is put too mildly. Why is 2s complement not appearing in the title nor in the body of the question, if that is the thing you actually want? Neither is a more or less equivalent expression like 'internal bit-string-representation'. From your answer and your comments on other answers I conclude you don't care about binary but rather about 2s complement. The questions you criticize look to me as if they answered exactly your question... It's not those answers that are bad - your question is. | |
| Aug 26, 2020 at 8:27 | answer | added | ganesh phirke | timeline score: 3 | |
| Aug 9, 2020 at 19:25 | answer | added | gildniy | timeline score: 6 | |
| Apr 26, 2020 at 18:39 | answer | added | Ivan Proskuryakov | timeline score: 1 | |
| Nov 1, 2019 at 15:42 | vote | accept | barlop | ||
| Jul 21, 2019 at 16:51 | answer | added | braks | timeline score: -1 | |
| Jun 5, 2019 at 9:37 | comment | added | barlop | And when I said "in binary", that may be a bit ambiguous. I mean the internal bit string representation, which is 2s complement, so positive numbers would be in base 2, and with a leading 0, (and negative numbers wouldn't be written with a minus symbol or with sign magnitude representation, but as a function of their positive eqivalent) | |
| Jan 3, 2019 at 4:05 | history | protected | Josh Crozier | ||
| Jun 12, 2018 at 7:59 | answer | added | Brian | timeline score: -3 | |
| Nov 7, 2017 at 12:04 | answer | added | Vincent William Rodriguez | timeline score: -2 | |
| Aug 31, 2017 at 7:32 | history | edited | Sebastian Simon | CC BY-SA 3.0 |
Spelling.
|
| Jul 25, 2017 at 3:06 | vote | accept | barlop | ||
| Nov 1, 2019 at 15:42 | |||||
| Jul 24, 2017 at 21:41 | vote | accept | barlop | ||
| Jul 25, 2017 at 3:06 | |||||
| Jul 24, 2017 at 20:49 | answer | added | Patrick Roberts | timeline score: 36 | |
| May 23, 2017 at 10:31 | history | edited | URL Rewriter Bot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
| Nov 2, 2016 at 22:36 | answer | added | supritshah1289 | timeline score: 11 | |
| Nov 17, 2015 at 14:01 | answer | added | barlop | timeline score: 35 | |
| Apr 10, 2015 at 10:34 | vote | accept | barlop | ||
| Jul 24, 2017 at 21:41 | |||||
| Jan 22, 2015 at 19:14 | history | edited | barlop | CC BY-SA 3.0 |
deleted 68 characters in body
|
| Jun 11, 2014 at 1:19 | answer | added | AnnanFay | timeline score: 62 | |
| Jan 28, 2014 at 5:31 | vote | accept | barlop | ||
| Apr 10, 2015 at 10:34 | |||||
| Aug 15, 2013 at 21:40 | answer | added | ad rees | timeline score: 96 | |
| Apr 22, 2013 at 19:43 | answer | added | fernandosavio | timeline score: 846 | |
| Jan 21, 2013 at 21:52 | comment | added | Anderson Green | It's also possible to convert from binary to decimal: stackoverflow.com/questions/11103487/… | |
| Mar 30, 2012 at 9:06 | history | edited | barlop | CC BY-SA 3.0 |
added 68 characters in body
|
| Mar 30, 2012 at 9:01 | comment | added | barlop | the a.toString(2) examples don't seem to work for -1 | |
| Mar 30, 2012 at 8:53 | answer | added | Manatok | timeline score: 324 | |
| Mar 30, 2012 at 8:50 | history | asked | barlop | CC BY-SA 3.0 |