In *Graphics Gems* [1], Paeth proposes a fast (but quite approximate) method for the rapid computation of hypotenuse,

.

The goal here is to get rid of the big bad because it is deemed “too expensive”—I wonder if that’s still actually true. First, he transforms the above equation:

.

This leaves us with the special case $\sqrt{1+u^2}, for which we can find the Taylor series

The numerators are given by A002596 and the denominators by A046161. So we can rewrite the whole thing as

.

*

* *

We’ll now try to get away with only a few terms of the series, and hope the precision isn’t too damaged. say we keep only the first two terms, how does it compare to other methods?

Let’s break down the graph:

- Blue: Circle of radius 10, the real hypotenuse;
- Green: True radius, 10;
- Dotted purple: Archytas, 3 iterations;
- Purple: Bakhshali’s method;
- Red: Paeth’s method.

Since Paeth’s method works well if , we may tweak it a bit. Letting

,

then letting

The imprecision is maximal when , or when the hypotenuse is at an angle of about 45 degrees.

*

* *

Originally, this hack was for considered for fast collisions/proximity testing. If you absolutely need a circular (or spherical) region, you need a square root, but that’s not the only option:

- metric, which is just the sum of absolute values ;
- metric, the usual euclidean distance;
- metric, which is .

The metric requires the square root, but the others are (if branches are cheap), rather inexpensive to compute—but they have counter-intuitive behavior. They might be useful for a first faster check, followed by Paeth’s method, followed by a full test.

[1] lan W. Paeth — *VIII.5 A Fast Approximation to the Hypotenuse* — in : Andrew Glassnet, ed., *Graphics Gems*, Morgan Kaufmann (1993), p. 427– 431