The second defect arises in the transformation of the flawed theory into an algorithm. To understand this problem, consider first the problem of one parameter L1 fitting. In this case, what one wants is the median of the set. But if the size of the set is even, anywhere between the two media is an equally good solution. The algorithm in NR, however, considers only solutions that interpolate one or two data points. (In general, L1 fitting to N parameters will interpolate N data points). The result is that MEDFIT is always computing a derivative at a place where it doesn't exist. It turns out that what MEDFIT really needs is just a sign, and there's a 50-50 chance of getting that right, even if the derivative doesn't exist. But when there's just a little bit of data, and MEDFIT gets close to the solution, it will get alternating positive and negative derivatives, and just rattle back and forth between two points, one probably being a solution (but at which MEDFIT can't decide to quit).

The third kind of defect arises in the transformation of the flawed algorithm into code. Others have already pointed out these defects, which can be spotted even if one has no idea what the code is intended to do.

Incidentally, the Fortran and C versions could frequently have different behavior because the tests used in the C version in place of the Fortran SIGN function do not do the same as what the Fortran-77 standard says the SIGN function does.