I have a function $f$, which have two cases:
$$ f(x) = \begin{cases} \frac{ \sin(a + bx) - \sin(a) }{b} &\mbox{if } b \neq 0\\ x \cos(a) &\mbox{if } b = 0 \end{cases} $$
The first part has a discontinuity at $b=0$ because the denominator, that is why the second case is needed.
Is it possible to rearrange the equation in a way, that we do not need cases, only one closed formula? I would like to avoid dividing by near to zero values, because of floating point arithmetic.
What I've tried:
$$ \frac{ \sin(a + bx) - \sin(a) }{b} = \frac{ \sin(a) \cos(bx) + \cos(a) \sin(bx) - \sin(a) }{b} $$
I have no idea how to progress any further
$\newcommand{mysinc}{\mathop{\rm sinc}}$ You can use the $\mysinc$ function. It is already implemented in some languages, for example see the numpy version.
$$\begin{align}\frac{\sin a \cos bx+\cos a \sin bx-\sin a}{b}&=\sin a\frac{\cos bx -1}{b}+\cos a\frac{\sin bx}{b}\\&=\sin a\frac{-2\sin^2\frac{bx}{2}}{b}+x\cos a\mysinc bx\\&=-x\sin a \sin\frac{bx}{2} \mysinc\frac{bx}{2}+x\cos a\mysinc bx \end{align}\\$$
When $b=0$ the first term vanishes because of the $\sin$, and the second becomes $x\cos a$ since $\mysinc 0=1$.