Apologies if this is better asked on StackOverflow, but I thought the community here would be more likely to have an answer, even though it's related to coding.
I'm coding up a little library for experimenting with the inversive geometry of the sphere. A point on the sphere is represented by $(x, y, z)$ where $\sqrt{x^2 + y^2 + z^2} = 1$. I want to apply Möbius transformations to sets of points on the sphere. Obviously, I could accomplish this by first applying a stereographic projection of each point $(x, y, z)$ to a point $z$ in the complex plane, applying a Möbius transformation $z \mapsto \frac{az + b}{cz + d}$ to each point, and then projecting back onto the sphere.
The problem with this approach, is that because I'm using double precision floating point numbers for the coordinates, points that are near the South pole of the sphere will have large precision errors on projection (since they are "near" infinity), whereas points near the equator will experience a lot less of a precision issue.
So I'm wondering if there is a more natural method for applying Möbius transformations directly to the points $(x, y, z)$ rather than composing with stereographic projections?
I write the stereographic projection $\sigma:\ S^2\to\bar{\mathbb C}$ in the form $$\sigma:\quad (x,y,z)\mapsto\zeta:={x+iy\over 1-z}={1+z\over x-iy}\ .\tag{1}$$ At each of the poles $N$ and $S$ one of the expressions on the right hand side is ${0\over0}$, hence undefined.
In order to facilitate matters we introduce homogeneous coordinates $(\zeta_1,\zeta_2)$ in $\bar{\mathbb C}$, whereby $\zeta={\zeta_1\over\zeta_2}$. The map $\sigma$ then appears as $$\sigma:\quad(x,y,z)\mapsto(\zeta_1,\zeta_2):=\left\{\eqalign{&\ (x+iy,\ 1-z)\qquad(z<1)\cr &\ (1+z,\ x-iy)\qquad(z>-1)\cr}\right.\quad.\tag{2}$$ This means that away from $N$ you may use the upper formula, and away from $S$ you may use the lower formula.
In terms of homogeneous coordinates the Moebius transformation $T(\zeta):={a\zeta+b\over c\zeta+d}$ appears as linear map $$T:\quad(\zeta_1,\zeta_2)\mapsto\left\{\eqalign{\zeta_1'&:=a\zeta_1+b\zeta_2 \cr \zeta_2'&:=c\zeta_1+d\zeta_2 \cr}\right.\quad.$$ The inverse of $(1)$ is given by $$\sigma^{-1}:\quad\zeta\mapsto\left\{\eqalign{&x:={\zeta+\bar\zeta\over|\zeta^2|+1}\cr &y:={\zeta-\bar\zeta\over i(|\zeta|^2+1)}\cr &z:={|\zeta|^2-1\over|\zeta|^2+1}\cr}\right.\quad.$$ In terms of the homogeneous coordinates $(\zeta_1,\zeta_2)$ this becomes $$\sigma^{-1}:\quad\zeta\mapsto\left\{\eqalign{ &x:={\zeta_1\bar\zeta_2+\bar\zeta_1\zeta_2\over|\zeta_1|^2+|\zeta_2|^2}\cr &y:={\zeta_1\bar\zeta_2-\bar\zeta_1\zeta_2\over i(|\zeta_1|^2+|\zeta_2|^2)}\cr &z:= {|\zeta_1|^2-|\zeta_2|^2\over|\zeta_1|^2+|\zeta_2|^2}\cr}\right.\quad,$$ whereby it plays no rôle which of the formulas $(2)$ you have used in the first step.
Apart from the alternative in $(2)$ no extra measures have to be taken. As long as $a$, $b$, $c$, $d$ are constant there will be no problems of small denominators.