Add two rational numbers... esoterically
Objective
Build a binary operator \$\star : \mathbb{Z} \times \mathbb{Z} \to \mathbb{Z}\$ such that, there exists a bijection \$i : \mathbb{Z} \to \mathbb{Q}\$ such that, for every integer \$M\$ and \$N\$, \$M \star N = i^{-1}(i(M) + i(N))\$ holds.
Or in mathematical terms, build a binary operator \$\star\$ that admits a group isomorphism from \$(\mathbb{Z}, \star)\$ to \$(\mathbb{Q}, +)\$.
I/O Format
Flexible. Standard loopholes apply.
Scoring
This is a fastest-algorithm challenge. The submission whose the asymptotic worst-case time complexity of \$\star\$ is the fastest wins.
The parameter \$n\$ for the time complexity is \$s(M) + s(N)\$, where \$s\$ is defined as follows:
- \$s(0) = s(-1) = 0\$.
- For every integer \$D > 0\$, \$s(D) = \lfloor \log_2 D \rfloor + 1\$.
- For every integer \$D < -1\$, \$s(D) = \lfloor \log_2 (-D-1) \rfloor + 1\$.
The shortness of your code is a tiebreaker. ThatNote that only worst-case time complexity is considered; as such, this challengefor example, \$O(n)\$ is secondarily code-golfnot considered faster than \$\Theta(n)\$.
In case that multiple submissions are tied, the earliest submission wins.
Notes and Rules
Note that each bijection \$i\$ induces \$\star\$ uniquely. As such, your submission must specify your choice of \$i\$.