Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • your first sentence says ".toString(2) is probably your best bet.". -- Now try reading the first comment to the question. You see it says it only works for positive numbers. And try reading all the other answers that mention that issue with .toString(2). As for your function, it's interesting, you should state whether it works for positive numbers only, or for positive and negative numbers. Commented Mar 12, 2022 at 10:51