Numerically stable way to compute sqrt((b²*c²) / (1-c²)) for c in [-1, 1]
The most interesting part of this stability-wise is the denominator, sqrt(1 – c*c). For that, all you need to do is expand it as sqrt(1 – c) * sqrt(1 + c). I don’t think this really qualifies as a “clever trick”, but it’s all that’s needed. For a typical binary floating-point format (for example IEEE … Read more