This implementation assumes a Spherical Earth.  The (commented) code

has been included for the ellipsoidal forward transform, but derivation of the ellispoidal inverse transform is beyond me.  Note that most of the Proj4JS implementations do NOT currently support ellipsoidal figures.  Therefore this is not seen as a problem - especially this lack of support is explicitly stated here.

ALGORITHM REFERENCES

1.  “Cartographic Projection Procedures for the UNIX Environment - A User’s Manual” by Gerald I.  Evenden, USGS Open File Report 90-284 and Release 4 Interim Reports (2003)

2.  Snyder, John P., “Flattening the EarthTwo Thousand Years of Map Projections”, Univ.  Chicago Press, 1993