# Talk:Binary to unary conversion

Jump to navigation
Jump to search

## Unary to binary (arbitrary precision) conversion

It will be interesting to add the reverse operation (Unary to Binary) to this page for the sake of completeness.

I can't think of a better way to do this (for the general, arbitrary precision case) than to implement a binary adder.

**Has anyone worked out a Unary to Binary conversion algorithm in /// or any other string replacement esolang?**

I've been able to put together a silly Unary to Binary encoder in /// for numbers up to 255:

/ // /**/10/ /1010/100/ /100100/1000/ /10001000/10000/ /1000010000/100000/ /100000100000/1000000/ /10000001000000/10000000/ /\*/1/ /00000001000000/!000000/ /000000100000/!00000/ /0000010000/!0000/ /00001000/!000/ /000100/!00/ /0010/!0/ /01/!/ /!/1/ **********************************

--CarlosLuna (talk) 15:55, 5 September 2019 (UTC)

And here it is a candidate /// algorithm for unbounded unary to binary conversion:

/ // /*/>@/ /@>/@/ /@/01/ /10/01/ /011/1\0/ /01/#1/ /#// />0/>/ />// **********************************

**Could anyone verify its correctness? Can it be simplified?**

--CarlosLuna (talk) 15:46, 6 September 2019 (UTC)