The formulas for the "Legacy ellipsoidal form" don't match the maths in the code.
For the foward case, the N and R in the doc is not used anywhere. The 1./ sqrt (1. - P->es sinphi sinphi) term of the .cpp file isn't found in the formulas. The y formula fails to take into account k0 as a multiplicative factor for M(phi), and also doesn't take into account M(phi0). And perhaps other things I've missed...
(controversial opinion: doc always lie, the code never :-))
The formulas for the "Legacy ellipsoidal form" don't match the maths in the code. For the foward case, the N and R in the doc is not used anywhere. The 1./ sqrt (1. - P->es sinphi sinphi) term of the .cpp file isn't found in the formulas. The y formula fails to take into account k0 as a multiplicative factor for M(phi), and also doesn't take into account M(phi0). And perhaps other things I've missed...
(controversial opinion: doc always lie, the code never :-))