I have a matrix, for example $M = \begin{bmatrix}300&100\\20&5\end{bmatrix}$, and I want to use $e^{-M}$ as a distance function. Computationally, numbers such as $e^{-300}$ are rounded to zero, so I want to transform $M$ into $M'$ with all its elements in $[0,1]$ and the property that the ratio of the negative exponential for any two elements is the same in $M$ and $M'$. For example,$\frac{e^{-300}}{e^{-5}} = \frac{e^{-f(300)}}{e^{-f(5)}}$ where $f \mapsto [0,1]$.
I have tried setting this problem up as finding $f$ s.t. $\frac{e^{-x}}{e^{-y}} = \frac{e^{-f(x)}}{e^{-f(y)}}$ which transforms into $f(x) - x = f(y) - y$. However, I am unsure how to proceed from here.