When the Find the inverse of a number 1/x
challenge has been posted, the author posted a bounty for the shortest Retina submission. After that, there was a bounty for sed, another text/string-based language. Since the challenge requires I/O with floating-point numbers, this brings forth a question: how will floating-point numbers be represented in unary?
In unary an integer, say 5
, would be represented with that many zeroes, in this case, 00000
. What about decimal places? One suggestion was to do the same thing for decimal places as well, for example 4.3
would be 0000.000
... BUT what about 4.03
? It will share its representation with 4.3
, so clearly this way of using unary to show decimal numbers (as in decimal places and not base-10 numbers) would not be valid.
How do we represent floating-point numbers in unary?
-000
and---
to represent-3
). As for floating point numbers, the most sensible solution would be scientific notation:4.03
could then be represented as403
in unary, following0
in unary.123.456
would be123456
in unary, followed by2
in unary. But we should first discuss whether unary representations for floating point numbers should even be allowed. \$\endgroup\$4.03
will be403
in unary followed by2
in unary instead? \$\endgroup\$4.03
is4.03e0
.4.03e2
would be403
. Your idea of encoding the position of the decimal point in the presented number would also work though. \$\endgroup\$n
contains the symboln
in common usage, (binary has no2
), it makes sense that base1
doesn't include1
. \$\endgroup\$