[Ellint Pi] Reorganize which reduction occurs in which order, and fix numerical stability issues identified by Rocco Romeo.
[Ellint Pi] Add some more special case handling, plus tests.