Different Representations of Numbers in Subsets of $\mathbb R$ I think I've mentioned sometime before about logarithmic number system. In this system, a real number $r$ is represented by $(\text{sgn}(r), \log|r|) \in \{-1, 0, 1\} \times \mathbb R$. If $\mathbb R$ is represented in computer by a floating point number system, this logarithmic number system would be able to capture a lot more numbers near $0$. Of course, its capability diminishes faster than regular floating point as the number gets larger, but it is much better when dealing with numbers very close to 0, like probabilities.
One good thing about this logarithmic number system is that multiplication and division are super easy, while addition and subtraction get a bit more complicated. It's still doable though.
But as I mentioned the use in representing probabilities, the logarithmic number system does not use the whole range of the underlying floating point system to represent numbers in [0, 1]. Can I make a system that makes better use of the underlying real representation to represent numbers in [0, 1]? Of course there are infinitely many surjections $\mathbb R \to [0, 1]$, but basic operations don't seem to carry out as nicely.
For example, if I use the logistic function as a mapping, I can represent $A \in (0, 1)$ as
$$
A = \frac 1{1 + e^{-a}}
$$
where $a \in \mathbb R$. Addition is more complicated but doable:
$$
A + B = \frac 1{1 + e^{-a}} + \frac 1{1 + e^{-b}} = \frac 1{1 + e^{-c}}
$$
where
$$
c = -\log(e^{-(a + b)} - 1) + \log((1 + e^{-a}) + (1 + e^{-b})).
$$
(If my math is correct.) So if there's an efficient way to compute $\log(e^{-x} - 1)$ and $\log(2 + e^{-x} + e^{-y})$, we can implement addition for this "logistic number system". Multiplication seems simple too:
$$
AB = \frac{1}{(1 + e^{-a})(1 + e^{-b})} = \frac 1{1 + e^{-c}}
$$
where
$$
c = a + b - \log(1 + e^a + e^b)
$$
(Again, if my math is correct.) I have not worked out other operations, but I assume they're not too terrible. One nice property we get from this logistic number system is that complement $B = 1 - A$ is easy to compute. Just set $b = -a$.
Ok, I admit that was a pretty long example. Here comes my question. Do you think there are other interesting number systems that might be of practical use? I am not talking about bignum arbitrary precision because that's like an overkill. I'm more interested in more efficient ways to represent numbers for specific applications. The domain is the important thing.
What's available:
$\mathbb R \to \mathbb R$: $x \mapsto x$
$\mathbb R \to (0, \infty)$: $x \mapsto e^x$
What I think may be interesting to explore:
$\mathbb R \to (0, 1)$: $x \mapsto \frac{1}{1 + e^{-x}}$
$\mathbb R \to (-1, 1)$: $x \mapsto \tanh x$
I would really appreciate if you help me work out the details or provide me with information on existing systems or suggest other interesting choices or provide me with reasons not to pursue this any further.
 A: I think I've used $\tanh$ in this sort of way before! The reason wasn't because of general principle, but because for the specific thing I was computing, storing $\tanh x$ instead of $x$ made the individual calculations easier. (I can't give the details because I don't remember them anymore!)
Have you seen Zech logarithms before? It doesn't have anything to do with real numbers: it's a way to do calculation in finite fields. But it's a pretty neat one. There's a real number analog of it which has apparently had applications. I don't remember the details, but I think it was slightly different than yours.
A: One obvious choice would be to use the logarithm of the odds:
$$\mathrm{rep}(p) = \ln\frac{p}{1-p}$$
Since $p\in [0,1]$, $\frac{p}{1-p}\in[0,\infty]$ and thus $\ln\frac{p}{1-p}\in[-\infty,\infty]$. Note that IEEE floating point numbers contain representations of $\pm\infty$, so probabilities of $0$ and $1$ are no problem.
One nice property of this representation is that it is symmetric: $\mathrm{rep}(1-p) = -\mathrm{rep}(p)$. However, it certainly doesn't simplify calculations.
On the other hand, very small probabilities are generally not significant anyway, therefore I'd say the best representation for probabilities is fixed point arithmetics, where an integer $k\in\{0,\dots,n\}$ represents the value $p = k/n$. This is trivial to add, very simple to multiply, and has the added bonus that most programming languages already offer unsigned integer types (with $n=2^k-1$ where typically $k=2^m$ with $m\ge 3$).
