[geographiclib] 01/11: Imported Upstream version 1.47

Bas Couwenberg sebastic at debian.org
Wed Feb 15 18:44:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository geographiclib.

commit 1a43acc30c36b3cec9df3d30ba492d7dc350deb5
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Feb 15 18:56:35 2017 +0100

    Imported Upstream version 1.47
---
 CMakeLists.txt                                     |   72 +-
 Makefile.am                                        |    4 +
 Makefile.in                                        |   79 +-
 NEWS                                               |   51 +-
 aclocal.m4                                         |  276 ++
 cmake/CMakeLists.txt                               |   25 +-
 cmake/FindGeographicLib.cmake                      |   20 +-
 cmake/Makefile.in                                  |   10 +-
 cmake/project-config.cmake.in                      |   10 +
 cmake/project.pc.in                                |   14 +
 configure                                          |  184 +-
 configure.ac                                       |   14 +-
 doc/GeographicLib.dox.in                           |  662 +++-
 doc/Makefile.in                                    |    4 +
 doc/NETGeographicLib.dox                           |    4 +-
 doc/geodesic-c.dox                                 |   21 +-
 doc/geodesic-for.dox                               |   19 +-
 doc/geodseries30.html                              |    6 +-
 doc/tmseries30.html                                |    8 +-
 dotnet/NETGeographicLib/Accumulator.h              |    2 +-
 dotnet/NETGeographicLib/EllipticFunction.h         |    4 +-
 dotnet/NETGeographicLib/Geocentric.h               |    6 +-
 dotnet/NETGeographicLib/Geodesic.h                 |    6 +-
 dotnet/NETGeographicLib/GeodesicLine.h             |    6 +-
 dotnet/NETGeographicLib/Gnomonic.h                 |    4 +-
 dotnet/NETGeographicLib/NormalGravity.cpp          |    4 +-
 dotnet/NETGeographicLib/NormalGravity.h            |   38 +-
 dotnet/NETGeographicLib/PolygonArea.h              |    4 +-
 dotnet/NETGeographicLib/TransverseMercator.h       |    8 +-
 dotnet/NETGeographicLib/TransverseMercatorExact.h  |   10 +-
 dotnet/examples/ManagedCPP/CMakeLists.txt          |    3 +-
 examples/CMakeLists.txt                            |    9 +
 examples/GeoidToGTX.cpp                            |    5 +-
 examples/JacobiConformal.cpp                       |   54 +-
 examples/JacobiConformal.hpp                       |   46 +-
 examples/Makefile.am                               |    1 +
 examples/Makefile.in                               |    5 +
 examples/example-Accumulator.cpp                   |    1 -
 examples/example-AlbersEqualArea.cpp               |    1 -
 examples/example-AzimuthalEquidistant.cpp          |    1 -
 examples/example-CassiniSoldner.cpp                |    1 -
 examples/example-CircularEngine.cpp                |    1 -
 examples/example-Constants.cpp                     |    1 -
 examples/example-DMS.cpp                           |    1 -
 examples/example-Ellipsoid.cpp                     |    1 -
 examples/example-EllipticFunction.cpp              |    8 +-
 examples/example-GARS.cpp                          |    1 -
 examples/example-GeoCoords.cpp                     |    1 -
 examples/example-Geocentric.cpp                    |    1 -
 examples/example-Geodesic-small.cpp                |    1 -
 examples/example-Geodesic.cpp                      |    1 -
 examples/example-GeodesicExact.cpp                 |    1 -
 examples/example-GeodesicLine.cpp                  |    1 -
 examples/example-GeodesicLineExact.cpp             |    1 -
 examples/example-GeographicErr.cpp                 |    1 -
 examples/example-Geohash.cpp                       |    1 -
 examples/example-Geoid.cpp                         |    1 -
 examples/example-Georef.cpp                        |    1 -
 examples/example-Gnomonic.cpp                      |    1 -
 examples/example-GravityCircle.cpp                 |    1 -
 examples/example-GravityModel.cpp                  |    1 -
 examples/example-LambertConformalConic.cpp         |    1 -
 examples/example-LocalCartesian.cpp                |    1 -
 examples/example-MGRS.cpp                          |    1 -
 examples/example-MagneticCircle.cpp                |    1 -
 examples/example-MagneticModel.cpp                 |    1 -
 examples/example-Math.cpp                          |    1 -
 examples/example-NearestNeighbor.cpp               |  141 +
 examples/example-NormalGravity.cpp                 |    3 +-
 examples/example-OSGB.cpp                          |    1 -
 examples/example-PolarStereographic.cpp            |    1 -
 examples/example-PolygonArea.cpp                   |    1 -
 examples/example-Rhumb.cpp                         |    1 -
 examples/example-RhumbLine.cpp                     |    1 -
 examples/example-SphericalEngine.cpp               |    1 -
 examples/example-SphericalHarmonic.cpp             |    1 -
 examples/example-SphericalHarmonic1.cpp            |    1 -
 examples/example-SphericalHarmonic2.cpp            |    1 -
 examples/example-TransverseMercator.cpp            |    1 -
 examples/example-TransverseMercatorExact.cpp       |    1 -
 examples/example-UTMUPS.cpp                        |    1 -
 examples/example-Utility.cpp                       |    1 -
 examples/make-egmcof.cpp                           |    1 -
 include/GeographicLib/Accumulator.hpp              |    2 +-
 include/GeographicLib/AlbersEqualArea.hpp          |    6 +-
 include/GeographicLib/AzimuthalEquidistant.hpp     |    4 +-
 include/GeographicLib/Config.h                     |    4 +-
 include/GeographicLib/Config.h.in                  |    4 +-
 include/GeographicLib/Constants.hpp                |   17 +-
 include/GeographicLib/DMS.hpp                      |    8 +-
 include/GeographicLib/EllipticFunction.hpp         |  163 +-
 include/GeographicLib/GeoCoords.hpp                |    7 +-
 include/GeographicLib/Geocentric.hpp               |   12 +-
 include/GeographicLib/Geodesic.hpp                 |   18 +-
 include/GeographicLib/GeodesicExact.hpp            |   14 +-
 include/GeographicLib/GeodesicLine.hpp             |   12 +-
 include/GeographicLib/GeodesicLineExact.hpp        |    6 +-
 include/GeographicLib/Gnomonic.hpp                 |   10 +-
 include/GeographicLib/GravityCircle.hpp            |    8 +-
 include/GeographicLib/GravityModel.hpp             |   16 +-
 include/GeographicLib/LambertConformalConic.hpp    |    6 +-
 include/GeographicLib/LocalCartesian.hpp           |    4 +-
 include/GeographicLib/Math.hpp                     |   76 +-
 include/GeographicLib/NearestNeighbor.hpp          |  748 ++++
 include/GeographicLib/NormalGravity.hpp            |  127 +-
 include/GeographicLib/OSGB.hpp                     |    6 +-
 include/GeographicLib/PolarStereographic.hpp       |    4 +-
 include/GeographicLib/PolygonArea.hpp              |   12 +-
 include/GeographicLib/Rhumb.hpp                    |   14 +-
 include/GeographicLib/SphericalHarmonic.hpp        |    4 +-
 include/GeographicLib/TransverseMercator.hpp       |   12 +-
 include/GeographicLib/TransverseMercatorExact.hpp  |   16 +-
 include/GeographicLib/Utility.hpp                  |  128 +-
 include/Makefile.am                                |    1 +
 include/Makefile.in                                |    5 +
 include/Makefile.mk                                |    1 +
 java/README.txt                                    |    7 +-
 java/direct/pom.xml                                |    4 +-
 java/inverse/pom.xml                               |    4 +-
 java/planimeter/pom.xml                            |    4 +-
 java/pom.xml                                       |    3 +-
 .../java/net/sf/geographiclib/Accumulator.java     |    2 +-
 .../main/java/net/sf/geographiclib/GeoMath.java    |    6 +-
 .../main/java/net/sf/geographiclib/Geodesic.java   |   54 +-
 .../java/net/sf/geographiclib/GeodesicLine.java    |    4 +-
 .../main/java/net/sf/geographiclib/Gnomonic.java   |    4 +-
 .../java/net/sf/geographiclib/PolygonArea.java     |    2 +-
 .../java/net/sf/geographiclib/package-info.java    |   34 +-
 .../java/net/sf/geographiclib/GeodesicTest.java    |   17 +
 js/GeographicLib.md                                |    6 +-
 js/HEADER.js                                       |    2 +-
 js/Makefile.in                                     |    4 +
 js/README.md                                       |    2 +-
 js/doc/1-geodesics.md                              |   10 +-
 js/doc/2-interface.md                              |    2 +-
 js/package.json                                    |    2 +-
 js/samples/geod-calc.html                          |   36 +-
 js/samples/geod-google-instructions.html           |   16 +-
 js/samples/geod-google.html                        |   59 +-
 js/src/DMS.js                                      |    2 +-
 js/src/Geodesic.js                                 |   86 +-
 js/src/GeodesicLine.js                             |   10 +-
 js/src/Math.js                                     |   20 +-
 js/src/PolygonArea.js                              |    2 +-
 js/test/geodesictest.js                            |   15 +
 legacy/C/00README.txt                              |    2 +-
 legacy/C/CMakeLists.txt                            |    2 +-
 legacy/C/geodesic.c                                |   44 +-
 legacy/C/geodesic.h                                |    8 +-
 legacy/C/geodtest.c                                |   23 +-
 legacy/Fortran/00README.txt                        |    2 +-
 legacy/Fortran/geodesic.for                        |   47 +-
 legacy/Fortran/geodtest.for                        |   44 +-
 man/CartConvert.1                                  |   26 +-
 man/CartConvert.1.html                             |    2 +-
 man/CartConvert.pod                                |    2 +-
 man/CartConvert.usage                              |    4 +-
 man/ConicProj.1                                    |   24 +-
 man/ConicProj.usage                                |    2 +-
 man/GeoConvert.1                                   |   57 +-
 man/GeoConvert.1.html                              |    4 +-
 man/GeoConvert.pod                                 |   27 +-
 man/GeoConvert.usage                               |   27 +-
 man/GeodSolve.1                                    |   32 +-
 man/GeodSolve.1.html                               |    4 +-
 man/GeodSolve.pod                                  |    4 +-
 man/GeodSolve.usage                                |    9 +-
 man/GeodesicProj.1                                 |   28 +-
 man/GeodesicProj.1.html                            |    2 +-
 man/GeodesicProj.pod                               |    2 +-
 man/GeodesicProj.usage                             |    4 +-
 man/GeoidEval.1                                    |   26 +-
 man/GeoidEval.usage                                |    2 +-
 man/Gravity.1                                      |   24 +-
 man/Gravity.usage                                  |    2 +-
 man/MagneticField.1                                |   24 +-
 man/MagneticField.usage                            |    2 +-
 man/Makefile.in                                    |    4 +
 man/Planimeter.1                                   |   26 +-
 man/Planimeter.1.html                              |    2 +-
 man/Planimeter.pod                                 |    2 +-
 man/Planimeter.usage                               |    4 +-
 man/RhumbSolve.1                                   |   48 +-
 man/RhumbSolve.1.html                              |   22 +-
 man/RhumbSolve.pod                                 |   22 +-
 man/RhumbSolve.usage                               |   24 +-
 man/TransverseMercatorProj.1                       |   30 +-
 man/TransverseMercatorProj.1.html                  |    2 +-
 man/TransverseMercatorProj.pod                     |    4 +-
 man/TransverseMercatorProj.usage                   |    6 +-
 matlab/Makefile.in                                 |    4 +
 matlab/geographiclib-legacy/geocentricforward.m    |    6 +-
 matlab/geographiclib-legacy/geocentricreverse.m    |    4 +-
 matlab/geographiclib-legacy/geodesicdirect.m       |    4 +-
 matlab/geographiclib-legacy/geodesicinverse.m      |    4 +-
 matlab/geographiclib-legacy/geodesicline.m         |    4 +-
 .../geographiclib-legacy/localcartesianforward.m   |    4 +-
 .../geographiclib-legacy/localcartesianreverse.m   |    4 +-
 matlab/geographiclib-legacy/polygonarea.m          |    4 +-
 matlab/geographiclib/Contents.m                    |    4 +-
 matlab/geographiclib/defaultellipsoid.m            |   12 +-
 matlab/geographiclib/eqdazim_fwd.m                 |    2 +-
 matlab/geographiclib/eqdazim_inv.m                 |    2 +-
 matlab/geographiclib/gedoc.m                       |    4 +-
 matlab/geographiclib/geodarea.m                    |    2 +-
 matlab/geographiclib/geoddistance.m                |   21 +-
 matlab/geographiclib/geoddoc.m                     |    8 +-
 matlab/geographiclib/geodreckon.m                  |    2 +-
 matlab/geographiclib/geographiclib_test.m          |   17 +
 matlab/geographiclib/gnomonic_fwd.m                |    2 +-
 matlab/geographiclib/gnomonic_inv.m                |    2 +-
 matlab/geographiclib/private/copysignx.m           |    4 +-
 matlab/geographiclib/projdoc.m                     |    2 +-
 maxima/geod.mac                                    |    2 +-
 maxima/geodesic.mac                                |   45 +-
 maxima/tm.mac                                      |   18 +-
 maxima/tmseries.mac                                |    2 +-
 python/MANIFEST.in                                 |    2 +-
 python/Makefile.in                                 |    4 +
 python/README.rst                                  |    4 +-
 python/doc/conf.py                                 |    3 +-
 python/doc/geodesics.rst                           |   10 +-
 python/doc/index.rst                               |   10 +-
 python/doc/interface.rst                           |    6 +-
 python/geographiclib/__init__.py                   |    4 +-
 python/geographiclib/geodesic.py                   |   50 +-
 python/geographiclib/geodesicline.py               |    2 +-
 python/geographiclib/polygonarea.py                |    2 +-
 python/geographiclib/test/test_geodesic.py         |   14 +
 python/setup.py                                    |    2 +-
 src/AlbersEqualArea.cpp                            |   14 +-
 src/CMakeLists.txt                                 |   34 +-
 src/EllipticFunction.cpp                           |  179 +-
 src/GeoCoords.cpp                                  |    4 +-
 src/Geocentric.cpp                                 |    6 +-
 src/Geodesic.cpp                                   |   34 +-
 src/GeodesicExact.cpp                              |   38 +-
 src/GeodesicExactC4.cpp                            | 3836 ++++++++++----------
 src/GravityModel.cpp                               |   19 +-
 src/LambertConformalConic.cpp                      |   14 +-
 src/MagneticModel.cpp                              |   22 +-
 src/Makefile.am                                    |    1 +
 src/Makefile.in                                    |    5 +
 src/Makefile.mk                                    |    1 +
 src/NormalGravity.cpp                              |  302 +-
 src/PolarStereographic.cpp                         |    6 +-
 src/TransverseMercator.cpp                         |    6 +-
 src/TransverseMercatorExact.cpp                    |    9 +-
 src/UTMUPS.cpp                                     |    4 +-
 tools/CMakeLists.txt                               |    3 +-
 tools/CartConvert.cpp                              |   18 +-
 tools/ConicProj.cpp                                |   14 +-
 tools/GeoConvert.cpp                               |    6 +-
 tools/GeodSolve.cpp                                |   10 +-
 tools/GeodesicProj.cpp                             |   12 +-
 tools/GeoidEval.cpp                                |    8 +-
 tools/Gravity.cpp                                  |    8 +-
 tools/MagneticField.cpp                            |   12 +-
 tools/Makefile.in                                  |    4 +
 tools/Planimeter.cpp                               |    8 +-
 tools/RhumbSolve.cpp                               |    8 +-
 tools/TransverseMercatorProj.cpp                   |   14 +-
 tools/tests.cmake                                  |   71 +-
 wrapper/00README.txt                               |   23 +
 264 files changed, 5974 insertions(+), 3576 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f48625..e79923b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,7 +2,7 @@ project (GeographicLib)
 
 # Version information
 set (PROJECT_VERSION_MAJOR 1)
-set (PROJECT_VERSION_MINOR 46)
+set (PROJECT_VERSION_MINOR 47)
 set (PROJECT_VERSION_PATCH 0)
 set (PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
 if (PROJECT_VERSION_PATCH GREATER 0)
@@ -43,7 +43,7 @@ endif ()
 # The library version tracks the numbering given by libtool in the
 # autoconf set up.
 set (LIBVERSION_API 17)
-set (LIBVERSION_BUILD 17.0.0)
+set (LIBVERSION_BUILD 17.1.0)
 string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
 string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
 
@@ -66,46 +66,7 @@ else ()
   option (COMMON_INSTALL_PATH "Use a common installation path for packages" ON)
 endif ()
 
-# The use of PACKAGE_PATH and INSTALL_PATH is now DEPRECATED.
-# (2) PACKAGE_PATH and INSTALL_PATH govern the find_package search
-# path and the installation directory.  (find_package is not used by
-# GeographicLib since it doesn't depend on other packages.  However
-# PACKAGE_PATH is used here for uniformity with other packages which
-# adopt the same conventions.)
-#
-# If PACKAGE_PATH is defined, it is prepended to CMAKE_PREFIX_PATH.
-#
-# If INSTALL_PATH is not specified but PACKAGE_PATH is, then
-# INSTALL_PATH is set to
-#   ${PACKAGE_PATH}, if COMMON_INSTALL_PATH is ON;
-#   ${PACKAGE_PATH}/${PROJECT_NAME}-${PROJECT_VERSION}, otherwise.
-#
-# If INSTALL_PATH is now defined, then set CMAKE_INSTALL_PREFIX to
-# INSTALL_PATH.
-#
-# Typically, only PACKAGE_PATH needs to be specified, e.g.,
-# cmake -D PACKAGE_PATH=/opt .. (on Linux)
-#   => CMAKE_PREFIX_PATH=/opt   CMAKE_INSTALL_PREFIX=/opt
-# cmake -D PACKAGE_PATH=C:/pkg .. (on Windows)
-#   => CMAKE_PREFIX_PATH=C:/pkg CMAKE_INSTALL_PREFIX=C:/pkg/GeographicLib-1.22
-
-if (PACKAGE_PATH)
-  set (CMAKE_PREFIX_PATH ${PACKAGE_PATH} ${CMAKE_PREFIX_PATH})
-  message (STATUS "CMAKE_PREFIX_PATH set to ${CMAKE_PREFIX_PATH}")
-endif ()
-
-if (NOT INSTALL_PATH AND PACKAGE_PATH)
-  if (COMMON_INSTALL_PATH)
-    set (INSTALL_PATH ${PACKAGE_PATH} CACHE PATH "Installation directory" FORCE)
-  else ()
-    set (INSTALL_PATH ${PACKAGE_PATH}/${PROJECT_NAME}-${PROJECT_VERSION}
-      CACHE PATH "Installation directory" FORCE)
-  endif ()
-endif ()
-if (INSTALL_PATH)
-  file (TO_CMAKE_PATH ${INSTALL_PATH} CMAKE_INSTALL_PREFIX)
-  message (STATUS "CMAKE_INSTALL_PREFIX set to ${CMAKE_INSTALL_PREFIX}")
-endif ()
+# (2) PACKAGE_PATH and INSTALL_PATH have now been removed
 
 # (3) Where to look for data files.  Various classes look in the geoids,
 # gravity, magnetic, subdirectories of ${GEOGRAPHICLIB_DATA}.
@@ -247,7 +208,11 @@ else ()
   # the client code is being compiled (and the GeographicLib headers
   # being included), work-alike substitutions are used.
   include (CheckCXXCompilerFlag)
-  foreach (_F 1z 14 1y 11 0x)
+  # The only "deprecated" flag included here is "0x" to activate C++11
+  # with old versions of g++.  We'll add "17" when it's available.
+  # Note: C++11 (actually gnu++14) support is turned on by default in
+  # g++ 6.1 and later.
+  foreach (_F 14 11 0x)
     set (CXX11_FLAG "-std=c++${_F}")
     set (_T CXX11TEST${_F})
     check_cxx_compiler_flag (${CXX11_FLAG} ${_T})
@@ -306,6 +271,7 @@ endif ()
 # first because that's where Config.h will be
 include_directories ("${PROJECT_BINARY_DIR}/include" include)
 
+set (HIGHPREC_LIBRARIES)
 if (GEOGRAPHICLIB_PRECISION EQUAL 1)
   message (WARNING "Compiling with floats which results in poor accuracy")
 elseif (GEOGRAPHICLIB_PRECISION EQUAL 2)
@@ -322,7 +288,7 @@ elseif (GEOGRAPHICLIB_PRECISION EQUAL 4)
     find_package (Boost 1.54)
     if (Boost_FOUND)
       include_directories ("${Boost_INCLUDE_DIRS}")
-      set (QUAD_LIBRARIES quadmath)
+      set (HIGHPREC_LIBRARIES quadmath)
       if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
         # Enable Q suffix for quad precision in g++ 4.8 and later
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals")
@@ -336,7 +302,7 @@ elseif (GEOGRAPHICLIB_PRECISION EQUAL 4)
       set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs")
     endif ()
   endif ()
-  if (NOT QUAD_LIBRARIES)
+  if (NOT HIGHPREC_LIBRARIES)
     message (WARNING "Cannot support quad precision, switching to double")
     set (GEOGRAPHICLIB_PRECISION 2)
   endif ()
@@ -371,7 +337,7 @@ elseif (GEOGRAPHICLIB_PRECISION EQUAL 5)
         # Studio (specifically version 12).
         link_directories (mpfr_mpir_x86_x64_msvc2010/mpfr/dll/${_ARCH}/Release
           mpfr_mpir_x86_x64_msvc2010/mpir/dll/${_ARCH}/Release)
-        set (MPFR_LIBRARIES mpfr mpir)
+        set (HIGHPREC_LIBRARIES mpfr mpir)
         # Suppress the myriad of "conditional expression is constant"
         # warnings
         set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4127")
@@ -384,11 +350,11 @@ elseif (GEOGRAPHICLIB_PRECISION EQUAL 5)
       # g++ before 4.5 doesn't work (no explicit cast operator)
       if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND
             CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.5))
-        set (MPFR_LIBRARIES mpfr gmp)
+        set (HIGHPREC_LIBRARIES mpfr gmp)
       endif ()
     endif ()
   endif ()
-  if (NOT MPFR_LIBRARIES)
+  if (NOT HIGHPREC_LIBRARIES)
     message (WARNING "Cannot support mpfr, switching to double")
     set (GEOGRAPHICLIB_PRECISION 2)
   endif ()
@@ -540,19 +506,19 @@ if (WIN32)
   set (CPACK_NSIS_URL_INFO_ABOUT "http://geographiclib.sourceforge.net")
   set (CPACK_NSIS_HELP_LINK "mailto:charles at karney.com")
   if (CMAKE_SIZEOF_VOID_P EQUAL 8)
-    # Hardcode the prefix for Visual Studio 12
+    # Hardcode the prefix for Visual Studio 12 2013
     set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc12-x64")
     set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win64")
     set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} x64 ${PROJECT_VERSION}")
     set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY
       "${PROJECT_NAME}-x64-${PROJECT_VERSION}")
   else ()
-    # Hardcode the prefix for Visual Studio 12
-    set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc12")
+    # Hardcode the prefix for Visual Studio 12 2013
+    set (CPACK_NSIS_INSTALL_ROOT "C:\\\\pkg-vc12-win32")
     set (CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}-win32")
-    set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} ${PROJECT_VERSION}")
+    set (CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME} win32 ${PROJECT_VERSION}")
     set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY
-      "${PROJECT_NAME}-${PROJECT_VERSION}")
+      "${PROJECT_NAME}-win32-${PROJECT_VERSION}")
   endif ()
   set (CPACK_NSIS_DISPLAY_NAME ${CPACK_NSIS_PACKAGE_NAME})
   set (CPACK_NSIS_MENU_LINKS
diff --git a/Makefile.am b/Makefile.am
index d7fb57f..f7a0f41 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,6 +13,10 @@ EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL README.md \
 	Makefile.mk CMakeLists.txt windows maxima doc legacy java js dotnet \
 	wrapper
 
+# Install the pkg-config file; the directory is set using
+# PKG_INSTALLDIR in configure.ac.
+pkgconfig_DATA = cmake/geographiclib.pc
+
 dist-hook:
 	rm -rf $(distdir)/doc/html $(distdir)/doc/manpages \
 		$(distdir)/doc/GeographicLib.dox
diff --git a/Makefile.in b/Makefile.in
index ff9de06..6565e9e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,6 +18,7 @@
 # Makefile.am
 #
 # Copyright (C) 2009, Francesco P. Lovergine <frankie at debian.org>
+
 VPATH = @srcdir@
 am__is_gnu_make = { \
   if test -z '$(MAKELEVEL)'; then \
@@ -136,6 +137,35 @@ am__can_run_installinfo = \
     n|no|NO) false;; \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(pkgconfigdir)"
+DATA = $(pkgconfig_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 am__recursive_targets = \
@@ -281,6 +311,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -331,6 +364,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -353,6 +387,10 @@ EXTRA_DIST = AUTHORS 00README.txt LICENSE.txt NEWS INSTALL README.md \
 	Makefile.mk CMakeLists.txt windows maxima doc legacy java js dotnet \
 	wrapper
 
+
+# Install the pkg-config file; the directory is set using
+# PKG_INSTALLDIR in configure.ac.
+pkgconfig_DATA = cmake/geographiclib.pc
 all: all-recursive
 
 .SUFFIXES:
@@ -413,6 +451,27 @@ clean-libtool:
 
 distclean-libtool:
 	-rm -f libtool config.lt
+install-pkgconfigDATA: $(pkgconfig_DATA)
+	@$(NORMAL_INSTALL)
+	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+	if test -n "$$list"; then \
+	  echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \
+	  $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \
+	fi; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+	  $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
+	done
+
+uninstall-pkgconfigDATA:
+	@$(NORMAL_UNINSTALL)
+	@list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run 'make' without going through this Makefile.
@@ -713,9 +772,12 @@ distcleancheck: distclean
 	       exit 1; } >&2
 check-am: all-am
 check: check-recursive
-all-am: Makefile all-local
+all-am: Makefile $(DATA) all-local
 installdirs: installdirs-recursive
 installdirs-am:
+	for dir in "$(DESTDIR)$(pkgconfigdir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
 install: install-recursive
 install-exec: install-exec-recursive
 install-data: install-data-recursive
@@ -768,7 +830,7 @@ info: info-recursive
 
 info-am:
 
-install-data-am: install-data-local
+install-data-am: install-data-local install-pkgconfigDATA
 
 install-dvi: install-dvi-recursive
 
@@ -814,7 +876,7 @@ ps: ps-recursive
 
 ps-am:
 
-uninstall-am:
+uninstall-am: uninstall-pkgconfigDATA
 
 .MAKE: $(am__recursive_targets) install-am install-strip
 
@@ -829,11 +891,12 @@ uninstall-am:
 	install-data install-data-am install-data-local install-dvi \
 	install-dvi-am install-exec install-exec-am install-html \
 	install-html-am install-info install-info-am install-man \
-	install-pdf install-pdf-am install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	installdirs-am maintainer-clean maintainer-clean-generic \
-	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
-	ps ps-am tags tags-am uninstall uninstall-am
+	install-pdf install-pdf-am install-pkgconfigDATA install-ps \
+	install-ps-am install-strip installcheck installcheck-am \
+	installdirs installdirs-am maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \
+	uninstall-am uninstall-pkgconfigDATA
 
 .PRECIOUS: Makefile
 
diff --git a/NEWS b/NEWS
index c29b951..25d7220 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,56 @@ For more information, see
 
     http://geographiclib.sourceforge.net/
 
-The current version of the library is 1.46.
+The current version of the library is 1.47.
+
+Changes between 1.47 (released 2017-02-15) and 1.46 versions:
+
+  * Add NearestNeighbor class.
+
+  * Improve accuracy of area calculation (fixing a flaw introduced in
+    version 1.46); fix applied in Geodesic, GeodesicExact, and the
+    implementations in C, Fortran, Java, JavaScript, Python, MATLAB, and
+    Maxima.
+
+  * Generalize NormalGravity to allow oblate and prolate ellipsoids.  As
+    a consequence a new form of constructor has been introduced and the
+    old form is now deprecated (and because the signatures of the two
+    constructors are similar, the compiler will warn about the use of
+    the old one).
+
+  * Changes in Math class:
+    + Math::sincosd, Math::sind, Math::cosd only return -0 for the case
+      sin(-0);
+    + Math::atan2d and Math::AngNormalize return results in (-180deg,
+      180deg]; this may affect the longitudes and azimuth returned by
+      several other functions.
+
+  * Add Utility::trim() and Utility::val<T>(); Utility::num<T>() is now
+    DEPRECATED.
+
+  * Changes in cmake support:
+    + remove support of PACKAGE_PATH and INSTALL_PATH in cmake
+      configuration;
+    + fix to FindGeographicLib.cmake to make it work on Debian systems;
+    + use $<TARGET_PDB_FILE:tgt> (cmake version >= 3.1);
+    + use NAMESPACE for exported targets;
+    + geographiclib-config.cmake exports GEOGRAPHICLIB_DATA,
+      GEOGRAPHICLIB_PRECISION, and GeographicLib_HIGHPREC_LIBRARIES.
+
+  * Add pkg-config support for cmake and autoconf builds.
+
+  * Minor fixes:
+    + fix the order of declarations in C library, incorporating the
+      patches in version 1.46.1;
+    + fix the packaging of the python library, incorporating the patches
+      in version 1.46.3;
+    + restrict junit dependency in the Java package to testing scope
+      (thanks to Mick Killianey);
+    + various behind-the-scenes fixes to EllipticFunction;
+    + fix documentation and default install location for Windows binary
+      installers;
+    + fix clang compiler warnings in GeodesicExactC4 and
+      TransverseMercator.
 
 Changes between 1.46 (released 2016-02-15) and 1.45 versions:
 
diff --git a/aclocal.m4 b/aclocal.m4
index 06268bb..a0f0614 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -95,6 +95,282 @@ AS_VAR_IF(CACHEVAR,yes,
 AS_VAR_POPDEF([CACHEVAR])dnl
 ])dnl AX_CHECK_COMPILE_FLAGS
 
+dnl pkg.m4 - Macros to locate and utilise pkg-config.   -*- Autoconf -*-
+dnl serial 11 (pkg-config-0.29)
+dnl
+dnl Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
+dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists at gmail.com>
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 2 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+dnl 02111-1307, USA.
+dnl
+dnl As a special exception to the GNU General Public License, if you
+dnl distribute this file as part of a program that contains a
+dnl configuration script generated by Autoconf, you may include it under
+dnl the same distribution terms that you use for the rest of that
+dnl program.
+
+dnl PKG_PREREQ(MIN-VERSION)
+dnl -----------------------
+dnl Since: 0.29
+dnl
+dnl Verify that the version of the pkg-config macros are at least
+dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
+dnl installed version of pkg-config, this checks the developer's version
+dnl of pkg.m4 when generating configure.
+dnl
+dnl To ensure that this macro is defined, also add:
+dnl m4_ifndef([PKG_PREREQ],
+dnl     [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
+dnl
+dnl See the "Since" comment for each macro you use to see what version
+dnl of the macros you require.
+m4_defun([PKG_PREREQ],
+[m4_define([PKG_MACROS_VERSION], [0.29])
+m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
+    [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
+])dnl PKG_PREREQ
+
+dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
+dnl ----------------------------------
+dnl Since: 0.16
+dnl
+dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
+dnl first found in the path. Checks that the version of pkg-config found
+dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
+dnl used since that's the first version where most current features of
+dnl pkg-config existed.
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=m4_default([$1], [0.9.0])
+	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		PKG_CONFIG=""
+	fi
+fi[]dnl
+])dnl PKG_PROG_PKG_CONFIG
+
+dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------------------------------
+dnl Since: 0.18
+dnl
+dnl Check to see whether a particular set of modules exists. Similar to
+dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
+dnl
+dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+dnl only at the first occurence in configure.ac, so if the first place
+dnl it's called might be skipped (such as if it is within an "if", you
+dnl have to call PKG_CHECK_EXISTS manually
+AC_DEFUN([PKG_CHECK_EXISTS],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+if test -n "$PKG_CONFIG" && \
+    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
+  m4_default([$2], [:])
+m4_ifvaln([$3], [else
+  $3])dnl
+fi])
+
+dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+dnl ---------------------------------------------
+dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
+dnl pkg_failed based on the result.
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes ],
+		     [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])dnl _PKG_CONFIG
+
+dnl _PKG_SHORT_ERRORS_SUPPORTED
+dnl ---------------------------
+dnl Internal check to see if pkg-config supports short errors.
+AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])dnl _PKG_SHORT_ERRORS_SUPPORTED
+
+
+dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl --------------------------------------------------------------
+dnl Since: 0.4.0
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
+dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
+AC_DEFUN([PKG_CHECK_MODULES],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
+AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
+
+pkg_failed=no
+AC_MSG_CHECKING([for $1])
+
+_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
+_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+
+m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
+and $1[]_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.])
+
+if test $pkg_failed = yes; then
+   	AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
+
+	m4_default([$4], [AC_MSG_ERROR(
+[Package requirements ($2) were not met:
+
+$$1_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+_PKG_TEXT])[]dnl
+        ])
+elif test $pkg_failed = untried; then
+     	AC_MSG_RESULT([no])
+	m4_default([$4], [AC_MSG_FAILURE(
+[The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+_PKG_TEXT
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+	$3
+fi[]dnl
+])dnl PKG_CHECK_MODULES
+
+
+dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+dnl   [ACTION-IF-NOT-FOUND])
+dnl ---------------------------------------------------------------------
+dnl Since: 0.29
+dnl
+dnl Checks for existence of MODULES and gathers its build flags with
+dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
+dnl and VARIABLE-PREFIX_LIBS from --libs.
+dnl
+dnl Note that if there is a possibility the first call to
+dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
+dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
+dnl configure.ac.
+AC_DEFUN([PKG_CHECK_MODULES_STATIC],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+_save_PKG_CONFIG=$PKG_CONFIG
+PKG_CONFIG="$PKG_CONFIG --static"
+PKG_CHECK_MODULES($@)
+PKG_CONFIG=$_save_PKG_CONFIG[]dnl
+])dnl PKG_CHECK_MODULES_STATIC
+
+
+dnl PKG_INSTALLDIR([DIRECTORY])
+dnl -------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable pkgconfigdir as the location where a module
+dnl should install pkg-config .pc files. By default the directory is
+dnl $libdir/pkgconfig, but the default can be changed by passing
+dnl DIRECTORY. The user can override through the --with-pkgconfigdir
+dnl parameter.
+AC_DEFUN([PKG_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([pkgconfigdir],
+    [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
+    [with_pkgconfigdir=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_INSTALLDIR
+
+
+dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
+dnl --------------------------------
+dnl Since: 0.27
+dnl
+dnl Substitutes the variable noarch_pkgconfigdir as the location where a
+dnl module should install arch-independent pkg-config .pc files. By
+dnl default the directory is $datadir/pkgconfig, but the default can be
+dnl changed by passing DIRECTORY. The user can override through the
+dnl --with-noarch-pkgconfigdir parameter.
+AC_DEFUN([PKG_NOARCH_INSTALLDIR],
+[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
+m4_pushdef([pkg_description],
+    [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
+AC_ARG_WITH([noarch-pkgconfigdir],
+    [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
+    [with_noarch_pkgconfigdir=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+])dnl PKG_NOARCH_INSTALLDIR
+
+
+dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+dnl -------------------------------------------
+dnl Since: 0.28
+dnl
+dnl Retrieves the value of the pkg-config variable for the given module.
+AC_DEFUN([PKG_CHECK_VAR],
+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
+AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
+
+_PKG_CONFIG([$1], [variable="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])dnl PKG_CHECK_VAR
+
 # Copyright (C) 2002-2014 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 3e57f37..0c8ad64 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -13,8 +13,13 @@ configure_file (project-config.cmake.in
   "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake" @ONLY)
 configure_file (project-config-version.cmake.in
   "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)
-export (TARGETS ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} ${TOOLS}
+export (TARGETS
+  ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} ${TOOLS}
   FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-targets.cmake")
+export (TARGETS
+  ${PROJECT_SHARED_LIBRARIES} ${PROJECT_STATIC_LIBRARIES} ${TOOLS}
+  NAMESPACE ${PROJECT_NAME}::
+  FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-namespace-targets.cmake")
 
 # geographiclib-config.cmake for the install tree.  It's installed in
 # ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
@@ -49,9 +54,27 @@ install (FILES
 install (EXPORT targets
   FILE ${PROJECT_NAME_LOWER}-targets.cmake
   DESTINATION "${INSTALL_CMAKE_DIR}")
+install (EXPORT targets
+  NAMESPACE ${PROJECT_NAME}::
+  FILE ${PROJECT_NAME_LOWER}-namespace-targets.cmake
+  DESTINATION "${INSTALL_CMAKE_DIR}")
 
 if (MSVC AND PACKAGE_DEBUG_LIBS)
   install (FILES
     "${PROJECT_BINARY_DIR}/cmake/CMakeFiles/Export/cmake/${PROJECT_NAME_LOWER}-targets-debug.cmake"
     DESTINATION "${INSTALL_CMAKE_DIR}" CONFIGURATIONS Release)
 endif ()
+
+# Support for pkgconfig/geographiclib.pc
+set (prefix ${CMAKE_INSTALL_PREFIX})
+set (exec_prefix "\${prefix}")
+set (libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
+set (includedir "\${prefix}/include")
+set (bindir "\${exec_prefix}/bin")
+set (PACKAGE_NAME "${PROJECT_NAME}")
+set (PACKAGE_VERSION "${PROJECT_VERSION}")
+
+configure_file (project.pc.in geographiclib.pc @ONLY)
+install (FILES
+  "${CMAKE_CURRENT_BINARY_DIR}/geographiclib.pc"
+  DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
diff --git a/cmake/FindGeographicLib.cmake b/cmake/FindGeographicLib.cmake
index 9c52b3e..44f50de 100644
--- a/cmake/FindGeographicLib.cmake
+++ b/cmake/FindGeographicLib.cmake
@@ -1,7 +1,7 @@
 # Look for GeographicLib
 #
 # Set
-#  GEOGRAPHICLIB_FOUND = TRUE
+#  GeographicLib_FOUND = GEOGRAPHICLIB_FOUND = TRUE
 #  GeographicLib_INCLUDE_DIRS = /usr/local/include
 #  GeographicLib_LIBRARIES = /usr/local/lib/libGeographic.so
 #  GeographicLib_LIBRARY_DIRS = /usr/local/lib
@@ -15,13 +15,21 @@ if (GeographicLib_LIBRARIES)
   get_filename_component (_ROOT_DIR "${GeographicLib_LIBRARY_DIRS}" PATH)
   set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include")
   set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin")
-  unset (_ROOT_DIR)
   if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h")
-    unset (GeographicLib_INCLUDE_DIRS)
-    unset (GeographicLib_LIBRARIES)
-    unset (GeographicLib_LIBRARY_DIRS)
-    unset (GeographicLib_BINARY_DIRS)
+    # On Debian systems the library is in e.g.,
+    #   /usr/lib/x86_64-linux-gnu/libGeographic.so
+    # so try stripping another element off _ROOT_DIR
+    get_filename_component (_ROOT_DIR "${_ROOT_DIR}" PATH)
+    set (GeographicLib_INCLUDE_DIRS "${_ROOT_DIR}/include")
+    set (GeographicLib_BINARY_DIRS "${_ROOT_DIR}/bin")
+    if (NOT EXISTS "${GeographicLib_INCLUDE_DIRS}/GeographicLib/Config.h")
+      unset (GeographicLib_INCLUDE_DIRS)
+      unset (GeographicLib_LIBRARIES)
+      unset (GeographicLib_LIBRARY_DIRS)
+      unset (GeographicLib_BINARY_DIRS)
+    endif ()
   endif ()
+  unset (_ROOT_DIR)
 endif ()
 
 include (FindPackageHandleStandardArgs)
diff --git a/cmake/Makefile.in b/cmake/Makefile.in
index eb7cb93..fb86a2c 100644
--- a/cmake/Makefile.in
+++ b/cmake/Makefile.in
@@ -104,7 +104,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/include/GeographicLib/Config-ac.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = geographiclib.pc
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_ at AM_V@)
 am__v_P_ = $(am__v_P_ at AM_DEFAULT_V@)
@@ -126,7 +126,7 @@ am__can_run_installinfo = \
     *) (install-info --version) >/dev/null 2>&1;; \
   esac
 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/project.pc.in
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -198,6 +198,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -248,6 +251,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -299,6 +303,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+geographiclib.pc: $(top_builddir)/config.status $(srcdir)/project.pc.in
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/cmake/project-config.cmake.in b/cmake/project-config.cmake.in
index 8041bb8..2120d9f 100644
--- a/cmake/project-config.cmake.in
+++ b/cmake/project-config.cmake.in
@@ -10,6 +10,7 @@
 #  @PROJECT_NAME at _LIBRARY_DIRS = /usr/local/lib
 #  @PROJECT_NAME at _BINARY_DIRS = /usr/local/bin
 #  @PROJECT_NAME at _VERSION = 1.34 (for example)
+#  @PROJECT_NAME_UPPER at _DATA = /usr/local/share/GeographicLib (for example)
 #  Depending on @PROJECT_NAME at _USE_STATIC_LIBS
 #    @PROJECT_NAME at _LIBRARIES = ${@PROJECT_NAME at _SHARED_LIBRARIES}, if OFF
 #    @PROJECT_NAME at _LIBRARIES = ${@PROJECT_NAME at _STATIC_LIBRARIES}, if ON
@@ -21,6 +22,11 @@
 # For cmake 2.8.11 or later, there's no need to include
 #   include_directories (${GeographicLib_INCLUDE_DIRS})
 #   add_definitions (${GeographicLib_DEFINITIONS})
+#
+# The following variables are only relevant if the library has been
+# compiled with a default precision different from double:
+#  @PROJECT_NAME_UPPER at _PRECISION = the precision of the library (usually 2)
+#  @PROJECT_NAME at _HIGHPREC_LIBRARIES = the libraries need for high precision
 
 message (STATUS "Reading ${CMAKE_CURRENT_LIST_FILE}")
 # @PROJECT_NAME at _VERSION is set by version file
@@ -43,6 +49,9 @@ else ()
   set (@PROJECT_NAME at _LIBRARY_DIRS "${_ROOT}/lib at LIB_SUFFIX@")
   set (@PROJECT_NAME at _BINARY_DIRS "${_ROOT}/bin")
 endif ()
+set (@PROJECT_NAME_UPPER at _DATA "@GEOGRAPHICLIB_DATA@")
+set (@PROJECT_NAME_UPPER at _PRECISION @GEOGRAPHICLIB_PRECISION@)
+set (@PROJECT_NAME at _HIGHPREC_LIBRARIES "@HIGHPREC_LIBRARIES@")
 
 set (@PROJECT_NAME at _SHARED_LIBRARIES @PROJECT_SHARED_LIBRARIES@)
 set (@PROJECT_NAME at _STATIC_LIBRARIES @PROJECT_STATIC_LIBRARIES@)
@@ -50,6 +59,7 @@ set (@PROJECT_NAME at _SHARED_DEFINITIONS @PROJECT_SHARED_DEFINITIONS@)
 set (@PROJECT_NAME at _STATIC_DEFINITIONS @PROJECT_STATIC_DEFINITIONS@)
 # Read in the exported definition of the library
 include ("${_DIR}/@PROJECT_NAME_LOWER at -targets.cmake")
+include ("${_DIR}/@PROJECT_NAME_LOWER at -namespace-targets.cmake")
 
 unset (_ROOT)
 unset (_DIR)
diff --git a/cmake/project.pc.in b/cmake/project.pc.in
new file mode 100644
index 0000000..5555905
--- /dev/null
+++ b/cmake/project.pc.in
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+bindir=@bindir@
+
+Name: @PACKAGE_NAME@
+Description: A library for geographic projections
+Version: @PACKAGE_VERSION@
+URL: http://geographiclib.sourceforge.net
+
+Requires:
+Libs: -L${libdir} -lGeographic
+Cflags: -I${includedir}
diff --git a/configure b/configure
index c2f7db3..4a61ac5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GeographicLib 1.46.
+# Generated by GNU Autoconf 2.69 for GeographicLib 1.47.
 #
 # Report bugs to <charles at karney.com>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='GeographicLib'
 PACKAGE_TARNAME='geographiclib'
-PACKAGE_VERSION='1.46'
-PACKAGE_STRING='GeographicLib 1.46'
+PACKAGE_VERSION='1.47'
+PACKAGE_STRING='GeographicLib 1.47'
 PACKAGE_BUGREPORT='charles at karney.com'
 PACKAGE_URL=''
 
@@ -636,6 +636,10 @@ ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
 LIBOBJS
+pkgconfigdir
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
 HAVE_PODPROGS_FALSE
 HAVE_PODPROGS_TRUE
 COL
@@ -791,6 +795,7 @@ with_aix_soname
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
+with_pkgconfigdir
 '
       ac_precious_vars='build_alias
 host_alias
@@ -805,7 +810,10 @@ CXX
 CXXFLAGS
 CCC
 LT_SYS_LIBRARY_PATH
-CXXCPP'
+CXXCPP
+PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR'
 
 
 # Initialize some variables set by options.
@@ -1346,7 +1354,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures GeographicLib 1.46 to adapt to many kinds of systems.
+\`configure' configures GeographicLib 1.47 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1417,7 +1425,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of GeographicLib 1.46:";;
+     short | recursive ) echo "Configuration of GeographicLib 1.47:";;
    esac
   cat <<\_ACEOF
 
@@ -1451,6 +1459,8 @@ Optional Packages:
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
                           compiler's sysroot if not specified).
+  --with-pkgconfigdir     pkg-config installation directory
+                          ['${libdir}/pkgconfig']
 
 Some influential environment variables:
   CC          C compiler command
@@ -1466,6 +1476,11 @@ Some influential environment variables:
   LT_SYS_LIBRARY_PATH
               User-defined run-time library search path.
   CXXCPP      C++ preprocessor
+  PKG_CONFIG  path to pkg-config utility
+  PKG_CONFIG_PATH
+              directories to add to pkg-config's search path
+  PKG_CONFIG_LIBDIR
+              path overriding pkg-config's built-in search path
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1533,7 +1548,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-GeographicLib configure 1.46
+GeographicLib configure 1.47
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1974,7 +1989,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by GeographicLib $as_me 1.46, which was
+It was created by GeographicLib $as_me 1.47, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2951,7 +2966,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='geographiclib'
- VERSION='1.46'
+ VERSION='1.47'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3046,7 +3061,7 @@ fi
 
 
 GEOGRAPHICLIB_VERSION_MAJOR=1
-GEOGRAPHICLIB_VERSION_MINOR=46
+GEOGRAPHICLIB_VERSION_MINOR=47
 GEOGRAPHICLIB_VERSION_PATCH=0
 
 cat >>confdefs.h <<_ACEOF
@@ -3094,9 +3109,9 @@ fi
 ac_config_headers="$ac_config_headers include/GeographicLib/Config-ac.h"
 
 
-LT_CURRENT=17
+LT_CURRENT=18
 LT_REVISION=0
-LT_AGE=0
+LT_AGE=1
 
 
 
@@ -16439,6 +16454,146 @@ fi
 
 ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile tools/Makefile doc/Makefile js/Makefile man/Makefile matlab/Makefile python/Makefile cmake/Makefile examples/Makefile"
 
+
+
+
+
+
+
+
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+	if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_PKG_CONFIG"; then
+  ac_pt_PKG_CONFIG=$PKG_CONFIG
+  # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_PKG_CONFIG" = x; then
+    PKG_CONFIG=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    PKG_CONFIG=$ac_pt_PKG_CONFIG
+  fi
+else
+  PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
+fi
+
+fi
+if test -n "$PKG_CONFIG"; then
+	_pkg_min_version=0.9.0
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+		PKG_CONFIG=""
+	fi
+fi
+
+
+
+# Check whether --with-pkgconfigdir was given.
+if test "${with_pkgconfigdir+set}" = set; then :
+  withval=$with_pkgconfigdir;
+else
+  with_pkgconfigdir='${libdir}/pkgconfig'
+fi
+
+pkgconfigdir=$with_pkgconfigdir
+
+
+
+
+
+ac_config_files="$ac_config_files cmake/geographiclib.pc:cmake/project.pc.in"
+
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -16986,7 +17141,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by GeographicLib $as_me 1.46, which was
+This file was extended by GeographicLib $as_me 1.47, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17052,7 +17207,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-GeographicLib config.status 1.46
+GeographicLib config.status 1.47
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -17576,6 +17731,7 @@ do
     "python/Makefile") CONFIG_FILES="$CONFIG_FILES python/Makefile" ;;
     "cmake/Makefile") CONFIG_FILES="$CONFIG_FILES cmake/Makefile" ;;
     "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+    "cmake/geographiclib.pc") CONFIG_FILES="$CONFIG_FILES cmake/geographiclib.pc:cmake/project.pc.in" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
diff --git a/configure.ac b/configure.ac
index fbbd49c..62f05dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 dnl
 dnl Copyright (C) 2009, Francesco P. Lovergine <frankie at debian.org>
 
-AC_INIT([GeographicLib],[1.46],[charles at karney.com])
+AC_INIT([GeographicLib],[1.47],[charles at karney.com])
 AC_CANONICAL_SYSTEM
 AC_PREREQ(2.61)
 AC_CONFIG_SRCDIR(src/Geodesic.cpp)
@@ -9,7 +9,7 @@ AC_CONFIG_MACRO_DIR(m4)
 AM_INIT_AUTOMAKE
 
 GEOGRAPHICLIB_VERSION_MAJOR=1
-GEOGRAPHICLIB_VERSION_MINOR=46
+GEOGRAPHICLIB_VERSION_MINOR=47
 GEOGRAPHICLIB_VERSION_PATCH=0
 AC_DEFINE_UNQUOTED([GEOGRAPHICLIB_VERSION_MAJOR],
         [$GEOGRAPHICLIB_VERSION_MAJOR],[major version number])
@@ -34,9 +34,9 @@ dnl Library code modified:              REVISION++
 dnl Interfaces changed/added/removed:   CURRENT++ REVISION=0
 dnl Interfaces added:                   AGE++
 dnl Interfaces removed:                 AGE=0
-LT_CURRENT=17
+LT_CURRENT=18
 LT_REVISION=0
-LT_AGE=0
+LT_AGE=1
 AC_SUBST(LT_CURRENT)
 AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
@@ -99,4 +99,10 @@ python/Makefile
 cmake/Makefile
 examples/Makefile
 ])
+
+PKG_PROG_PKG_CONFIG
+PKG_INSTALLDIR
+
+AC_CONFIG_FILES([cmake/geographiclib.pc:cmake/project.pc.in])
+
 AC_OUTPUT
diff --git a/doc/GeographicLib.dox.in b/doc/GeographicLib.dox.in
index 4e8a65b..ade011f 100644
--- a/doc/GeographicLib.dox.in
+++ b/doc/GeographicLib.dox.in
@@ -12,7 +12,7 @@ namespace GeographicLib {
 \mainpage GeographicLib library
 \author Charles F. F. Karney (charles at karney.com)
 \version @PROJECT_VERSION@
-\date 2016-02-15
+\date 2017-02-15
 
 The documentation for other versions is available at
 <tt>http://geographiclib.sourceforge.net/m.nn/</tt> for versions numbers
@@ -37,9 +37,10 @@ the geodesic capabilities in JavaScript, check out the
 the script for displaying
 <a href="../scripts/geod-google.html">geodesics in Google Maps</a>
 
-This library is <i>not</i> a general purpose projection library; use
-<a href="https://github.com/OSGeo/proj.4/wiki">proj.4</a> for that.  On
-the other hand, it does provide the core functionality offered by
+This library is <i>not</i> a general purpose projection library nor does
+it perform datum conversions; instead use
+<a href="https://github.com/OSGeo/proj.4/wiki">proj.4</a>.  On the other
+hand, it does provide the core functionality offered by
 <a href="http://earth-info.nima.mil/GandG/geotrans/">GEOTRANS</a>.
 
 \section download Download
@@ -138,9 +139,10 @@ The goals of GeographicLib are:
 
 Various \ref utilities are provided with the library.  These illustrate
 the use of the library and are useful in their own right.  This library
-and the utilities have been tested with g++ 4.4 under Linux, with g++
-4.2 under Mac OS X, and with MS Visual Studio 9 (2008), 10 (2010), 11
-(2012), and 12 (2013) compiled for 32 bit and 64 bit.
+and the utilities have been tested with g++ 5.3.1 under Linux, with
+Apple LLVM 7.0.2 under Mac OS X, and with MS Visual Studio 10 (2010), 11
+(2012), 12 (2013), and 14 (2015) compiled for 32 bit and 64 bit on
+Windows.
 
 MATLAB, JavaScript, and Python interfaces are provided to portions of
 GeographicLib; see \ref other.
@@ -184,10 +186,10 @@ Back to \ref intro.  Forward to \ref start.  Up to \ref contents.
 </center>
 
 GeographicLib has been developed under Linux with the g++ compiler
-(versions 4.0 and later) and under Windows with Visual Studio 2010,
-2012, and 2013.  Earlier versions were tested also under Visual Studio
-2005 and 2008 and under Darwin and Solaris.  It should compile on a wide
-range of other systems.  First download either
+(versions 4.0 and later), under Mac OS X with Xcode (version 8.2), and
+under Windows with Visual Studio 2010 and later.  Earlier versions were
+tested also under Visual Studio 2005 and 2008 and under Solaris.  It
+should compile on a wide range of other systems.  First download either
 <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-@PROJECT_VERSION@.tar.gz">
 GeographicLib- at PROJECT_VERSION@.tar.gz</a> or
 <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-@PROJECT_VERSION@.zip">
@@ -208,7 +210,8 @@ Then pick one of the first five options below:
   Visual Studio 2008 and 2010 under Windows.
 - \ref binaryinst.  Use this installation method if you only need to use
   the \ref utilities supplied with GeographicLib.  (This method also
-  installs the header files and the library for use by Visual Studio 10.)
+  installs the header files and the library for use by Visual Studio 12
+  2013.)
 - \ref qt.  How to compile GeographicLib so that it can be used by Qt
   programs.
 - \ref maintainer.  This describes addition tasks of interest only to
@@ -226,7 +229,7 @@ make software maintenance simpler
   directory for compiling the code.  In the description here the
   directories are called BUILD and are located in the top-level of the
   source tree.  You might want to use a suffix to denote the type of
-  build, e.g., BUILD-vc9 for Visual Studio 9, or BUILD-shared for a
+  build, e.g., BUILD-vc11 for Visual Studio 11, or BUILD-shared for a
   build which creates a shared library.  The advantages of out-of-source
   builds are:
   - You don't mess up the source tree, so it's easy to "clean up".
@@ -273,7 +276,7 @@ Here are the steps to compile and install GeographicLib:
 - Unpack the source, running one of \verbatim
   tar xfpz GeographicLib- at PROJECT_VERSION@.tar.gz
   unzip -q GeographicLib- at PROJECT_VERSION@.zip \endverbatim
-  then enter the directory created with one of \verbatim
+  then enter the directory created with \verbatim
   cd GeographicLib- at PROJECT_VERSION@ \endverbatim
 - Create a separate build directory and enter it, for example, \verbatim
   mkdir BUILD
@@ -281,10 +284,9 @@ Here are the steps to compile and install GeographicLib:
 - Run cmake, pointing it to the source directory (..).  On Linux, Unix,
   and MacOSX systems, the command is \verbatim
   cmake .. \endverbatim
-  For Windows, the command is typically one of \verbatim
-  cmake -G "Visual Studio 10" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/GeographicLib- at PROJECT_VERSION@ ..
-  cmake -G "Visual Studio 9 2008" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc9/GeographicLib- at PROJECT_VERSION@ ..
-\endverbatim
+  For Windows, the command is typically something like \verbatim
+  cmake -G "Visual Studio 11" -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10/GeographicLib- at PROJECT_VERSION@ ..
+  cmake -G "Visual Studio 12" -A x64 -D CMAKE_INSTALL_PREFIX=C:/pkg-vc11-x64/GeographicLib- at PROJECT_VERSION@ ..\endverbatim
   The definitions of CMAKE_INSTALL_PREFIX are optional (see below).  The
   settings given above are recommended to ensure that packages that use
   GeographicLib use the version compiled with the right compiler.
@@ -313,12 +315,8 @@ Here are the steps to compile and install GeographicLib:
     on non-Windows systems, <code>C:/Program Files/GeographicLib</code>
     on Windows systems) specifies where the library will be installed.
     For windows systems, it is recommended to use a prefix which
-    includes the compiler version, as shown above (and also, possibly,
-    whether this is a 64-bit build, e.g., <code>cmake
-    -G "Visual Studio 10 Win64"
-    -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10-x64/GeographicLib- at PROJECT_VERSION@
-    ..</code>).  If you just want to try the library to see if it suits
-    your needs, pick, for example,
+    includes the compiler version, as shown above.  If you just want to
+    try the library to see if it suits your needs, pick, for example,
     <code>CMAKE_INSTALL_PREFIX</code>=/tmp/geographic.
   - <code>GEOGRAPHICLIB_DATA</code> (default:
     /usr/local/share/GeographicLib for non-Windows systems,
@@ -371,7 +369,7 @@ Here are the steps to compile and install GeographicLib:
     double.
 - Build and install the software.  In non-IDE environments, run
   \verbatim
-  make         # compile the library and the examples
+  make         # compile the library and utilities
   make test    # run some tests
   make install # as root, if CMAKE_INSTALL_PREFIX is a system directory
 \endverbatim
@@ -470,14 +468,10 @@ Studio, use cmake to create the necessary solution file, see \ref cmake.
   Visual Studio Express 2010, replace -vc10 by -vc10x).
 - Pick the build type (e.g., Release), and select "Build Solution".
 - The library and the compiled examples are in the windows/Release.
-- Copy the library windows/Release/GeographicLib.lib and the
-  headers in include/GeographicLib somewhere convenient.  The
-  headers should remain in a directory named GeographicLib.  If you
-  expect to use the MATLAB/Octave interface, copy *.m from the matlab
-  directory to a directory in your matlab/octave path, see \ref matlab
-  for instructions on compiling the interface.  For documentation, open
-  <a href="index.html">doc/html/index.html</a> in a web
-  browser.
+- Copy the library windows/Release/GeographicLib.lib and the headers in
+  include/GeographicLib somewhere convenient.  The headers should remain
+  in a directory named GeographicLib.  For documentation, open
+  <a href="index.html">doc/html/index.html</a> in a web browser.
 
 The Visual Studio 10 solution also contains projects to build
 <a href="NET/index.html">NETGeographicLib</a> and the C# example project.
@@ -490,7 +484,7 @@ Binary installers are available for some platforms
 
 Use this method if you only need to use the GeographicLib utilities.
 The header files and static and shared versions of library are also
-provided; these can only be used by Visual Studio 11 2012 (in either
+provided; these can only be used by Visual Studio 12 2013 (in either
 release or debug mode).  However, if you plan to use the library, it may
 be advisable to build it with the compiler you are using for your own
 code using either \ref cmake or \ref windows.
@@ -503,8 +497,8 @@ GeographicLib- at PROJECT_VERSION@-win64.exe</a>:
  - read the MIT/X11 License agreement,
  - select whether you want your PATH modified,
  - select the installation folder, by default
-   C:\\pkg-vc10\\GeographicLib- at PROJECT_VERSION@ or
-   C:\\pkg-vc10-x64\\GeographicLib- at PROJECT_VERSION@,
+   C:\\pkg-vc12-win32\\GeographicLib- at PROJECT_VERSION@ or
+   C:\\pkg-vc12-x64\\GeographicLib- at PROJECT_VERSION@,
  - select the start menu folder,
  - and install.
  .
@@ -512,13 +506,11 @@ GeographicLib- at PROJECT_VERSION@-win64.exe</a>:
 given in \ref cmake.)  The start menu will now include links to the
 documentation for the library and for the utilities (and a link for
 uninstalling the library).  If you ask for your PATH to be modified, it
-will include C:/pkg-vc11/GeographicLib- at PROJECT_VERSION@/bin where the
-utilities are installed.  The headers and library are installed in the
-include/GeographicLib and lib folders.  The MATLAB interface is
-installed in the matlab folder.  Add this to your path in MATLAB to
-access this interface.  The libraries were built using using Visual
-Studio 11 2012 in release and debug modes.  The utilities were linked
-against the release-mode shared library.
+will include C:/pkg-vc12-{win32,x64}/GeographicLib- at PROJECT_VERSION@/bin
+where the utilities are installed.  The headers and library are
+installed in the include/GeographicLib and lib folders.  The libraries
+were built using using Visual Studio 12 2013 in release and debug modes.
+The utilities were linked against the release-mode shared library.
 
 <a href="NET/index.html">NETGeographicLib</a> library dlls (release and
 debug) are included with the binary installers; these are linked against
@@ -607,7 +599,7 @@ Release and Debug versions of the library and finally build PACKAGE in
 Release mode.  This will get the release and debug versions of the
 library included in the package.  For example, the 64-bit binary
 installer is created with \verbatim
-  cmake -G "Visual Studio 10 Win64" \
+  cmake -G "Visual Studio 12" -A x64 \
     -D GEOGRAPHICLIB_LIB_TYPE=BOTH \
     -D PACKAGE_DEBUG_LIBS=ON \
     -D BUILD_NETGEOGRAPHICLIB=ON \
@@ -664,13 +656,15 @@ In order to use GeographicLib from C++ code, you will need to
   - configure your package, e.g., with \verbatim
     mkdir BUILD
     cd BUILD
-    cmake -G "Visual Studio 10" \
-      -D CMAKE_PREFIX_PATH=C:/pkg-vc10 \
-      -D CMAKE_PREFIX_PATH=C:/pkg-vc10/testgeographic \
+    cmake -G "Visual Studio 12" -A x64 \
+      -D CMAKE_PREFIX_PATH=C:/pkg-vc10-x64 \
+      -D CMAKE_INSTALL_PREFIX=C:/pkg-vc10-x64/testgeographic \
       .. \endverbatim
     Note that you almost always want to configure and build your code
     somewhere other than the source directory (in this case, we use the
-    BUILD subdirectory).
+    BUILD subdirectory).  Also, on Windows, make sure that the version
+    of Visual Sudio (12 in the example above) architecture (x64 in the
+    example above) matches that used to build GeographicLib.
   - build your package.  On Linux and MacOS this usually involves just
     running make.  On Windows, you can load the solution file created by
     cmake into Visual Studio; alternatively, you can get cmake to run
@@ -710,6 +704,12 @@ In order to use GeographicLib from C++ code, you will need to
   find_package to work.  However, this method has not been thoroughly
   tested.)
 
+  If GeographicLib is not found, check the values of
+  <code>GeographicLib_CONSIDERED_CONFIGS</code> and
+  <code>GeographicLib_CONSIDERED_VERSIONS</code>; these list the
+  configuration files and corresponding versions which were considered
+  by find_package.
+
   If GeographicLib is found, then the following cmake variables are set:
   - <code>GeographicLib_FOUND</code> = 1
   - <code>GeographicLib_VERSION</code> = @PROJECT_VERSION@
@@ -722,6 +722,7 @@ In order to use GeographicLib from C++ code, you will need to
   - <code>GeographicLib_STATIC_DEFINITIONS</code> = -DGEOGRAPHICLIB_SHARED_LIB=0
   - <code>GeographicLib_LIBRARY_DIRS</code>
   - <code>GeographicLib_BINARY_DIRS</code>
+  - <code>GEOGRAPHICLIB_DATA</code> = value of this compile-time parameter
   .
   Either of <code>GeographicLib_SHARED_LIBRARIES</code> or
   <code>GeographicLib_STATIC_LIBRARIES</code> may be empty, if that version
@@ -752,7 +753,7 @@ In order to use GeographicLib from C++ code, you will need to
   - Tell the compiler where to find the header files.  With g++ and with
     /usr/local specified as the installation directory,
     this is accomplished with \verbatim
-    g++ -c -g -O3 -funroll-loops -I/usr/local/include testprogram.cpp
+    g++ -c -g -O3 -I/usr/local/include testprogram.cpp
     \endverbatim
     With Visual Studio, specify the include directory in the IDE via,
     e.g.,
@@ -796,6 +797,16 @@ In order to use GeographicLib from C++ code, you will need to
     that Geographic.dll or Geographic_d.dll is in the same directory as
     your executable or else include the directory containing the dll in
     your <code>PATH</code>.
+  - You can also use the pkg-config utility to specify compile and link
+    flags.  This requires that pkg-config be installed and that it's
+    configured to search, e.g., /usr/local/lib/pgkconfig; if not, define
+    the environment variable <code>PKG_CONFIG_PATH</code> to include
+    this directory.  The compile and link steps under Linux would
+    typically be
+    \verbatim
+    g++ -c -g -O3 `pkg-config --cflags geographiclib` testprogram.cpp
+    g++ -g -o testprogram testprogram.o `pkg-config --libs geographiclib`
+    \endverbatim
 
 Here is a very simple test code, which uses the Geodesic
 class:
@@ -1024,6 +1035,10 @@ elliptic integrals (computed by EllipticFunction).  These classes should
 be used if the absolute value of the flattening exceeds 0.02.  The -E
 option to <a href="GeodSolve.1.html">GeodSolve</a> uses these classes.
 
+NearestNeighbor is a header-only classes for finding the nearest
+neighbor of a collection of points where the distance function obeys the
+triangle inequality, such as the geodesic distance.
+
 Geocentric and LocalCartesian convert between
 geodetic and geocentric or a local cartesian system.  The constructor for
 specifies the ellipsoid and the forward and reverse projections are
@@ -1052,7 +1067,8 @@ GravityModel::Circle to return a GravityCircle object whose member
 functions performs the calculations efficiently.  (This is particularly
 important for high degree models such as EGM2008.)  These classes
 requires installation of data files for the various gravity models; see
-\ref gravityinst for details.
+\ref gravityinst for details.  NormalGravity computes the gravity of the
+so-called level ellipsoid.
 
 MagneticModel evaluates the earth's magnetic field using a particular
 magnetic model.  The field is provided by the operator() member
@@ -1918,7 +1934,20 @@ GravityCircle classes and with the
 <a href="Gravity.1.html">Gravity</a> utility.  These models expand the
 gravitational potential of the earth as sum of spherical harmonics.  The
 models also specify a reference ellipsoid, relative to which geoid
-heights and gravity disturbances are measured.
+heights and gravity disturbances are measured.  Underlying all these
+models is <i>normal gravity</i> which is the exact solution for an
+idealized rotating ellipsoidal body.  This is implemented with the
+NormalGravity class and some notes on are provided in section \ref
+normalgravity
+
+Go to
+ - \ref gravityinst
+ - \ref gravityformat
+ - \ref gravitynga
+ - \ref gravitygeoid
+ - \ref gravityatmos
+ - \ref gravityparallel
+ - \ref normalgravity
 
 The supported models are
  - <b>egm84</b>, the
@@ -1954,14 +1983,6 @@ implementation was the first I could easily understand and he and I
 together worked through some of the issues with overflow and underflow
 the occur while performing high-degree spherical harmonic sums.
 
-Go to
- - \ref gravityinst
- - \ref gravityformat
- - \ref gravitynga
- - \ref gravitygeoid
- - \ref gravityatmos
- - \ref gravityparallel
-
 \section gravityinst Installing the gravity models
 
 These gravity models are available for download:
@@ -2103,8 +2124,8 @@ keywords
  - keywords that affect the field calculation, namely:
    - <b>ModelRadius</b> (required), the normalizing radius for the model
      in meters.
-   - <b>ReferenceRadius</b> (required), the major radius \e a for the
-     reference ellipsoid meters.
+   - <b>ReferenceRadius</b> (required), the equatorial radius \e a for
+     the reference ellipsoid meters.
    - <b>ModelMass</b> (required), the mass constant \e GM for the model
      in meters<sup>3</sup>/seconds<sup>2</sup>.
    - <b>ReferenceMass</b> (required), the mass constant \e GM for the
@@ -2137,8 +2158,8 @@ keywords
    (because it can be measured precisely) is the same for the gravity
    model and the reference ellipsoid.  <b>ModelRadius</b> is merely a
    scaling parameter for the gravity model and there's no requirement
-   that it be close to the major radius of the earth (although that's
-   typically how it is chosen).  <b>ModelMass</b> and
+   that it be close to the equatorial radius of the earth (although
+   that's typically how it is chosen).  <b>ModelMass</b> and
    <b>ReferenceMass</b> need not be the same and, indeed, they are
    slightly difference for egm2008.  As a result the disturbing
    potential \e T has a 1/\e r dependence at large distances.
@@ -2412,6 +2433,345 @@ optimizations, the computation would have taken about 200 days!)
 cmake will add in support for OpenMP for
 <code>examples/GeoidToGTX.cpp</code>, if it is available.
 
+\section normalgravity Normal gravity
+
+The NormalGravity class computes "normal gravity" which refers to the
+exact (classical) solution of an idealised system consisting of an
+ellipsoid of revolution with the following properties:
+ - \e M the mass interior to the ellipsoid,
+ - \e a the equatorial radius,
+ - \e b the polar semi-axis,
+ - ω the rotation rate about the polar axis.
+ .
+(N.B. The mass always appears in the combination \e GM, with units
+m<sup>3</sup>/s<sup>2</sup>, where \e G is the gravtitational constant.)
+The distribution of the mass \e M within the ellipsoid is such that the
+surface of the ellipsoid is at a constant normal potential where the
+normal potential is the sum of the gravitational potential (due to the
+gravitional attraction) and the centrifugal potention (due to the
+rotation).  The resulting field exterior to the ellipsoid is called
+<i>normal gravity</i> and was found by Somigliana (1929).  Because the
+potential is constant on the ellipsoid it is sometimes referred to as
+the <i>level ellipsoid</i>.
+
+References:
+ - C. Somigliana, Teoria generale del campo gravitazionale dell'ellissoide
+   di rotazione, Mem. Soc. Astron. Ital, <b>4</b>, 541--599 (1929).
+ - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San
+   Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3).
+ - B. Hofmann-Wellenhof, H. Moritz, Physical Geodesy (Second edition,
+   Springer, 2006). https://doi.org/10.1007/978-3-211-33545-1
+ - H. Moritz, Geodetic Reference System 1980, J. Geodesy 54(3), 395--405
+   (1980). https://doi.org/10.1007/BF02521480
+ - H. Moritz, The Figure of the Earth (Wichmann, 1990).
+ - M. Chasles, Solution nouvelle du problème de l’attraction d’un
+   ellipsoïde hétérogène sur un point
+   exterieur, Jour. Liouville 5, 465--488 (1840), Note 2.
+   http://sites.mathdoc.fr/JMPA/PDF/JMPA_1840_1_5_A41_0.pdf
+
+\subsection normalgravcoords Ellipsoidal coordinates
+
+Two set of formulas are presented: those of Heiskanen and Moritz (1967)
+which are applicable to an oblate ellipsoid and a second set where the
+variables are distinguished with primes which apply to a prolate
+ellipsoid.  The primes are omitted from those variables which are the
+same in the two cases.  In the text, the parenthetical "resp." clauses
+apply to prolate ellipsoids.
+
+Cylindrical coordinates \f$ R,Z \f$ are expressed in terms of
+ellipsoidal coordinates
+\f[
+\begin{align}
+  R &= \sqrt{u^2 + E^2} \cos\beta = u' \cos\beta,\\
+  Z &= u \sin\beta = \sqrt{u'^2 + E'^2} \sin\beta,
+\end{align}
+\f]
+where
+\f[
+\begin{align}
+  E^2 = a^2 - b^2,&{} \qquad u^2 = u'^2 + E'^2,\\
+  E'^2 = b^2 - a^2,&{} \qquad u'^2 = u^2 + E^2.
+\end{align}
+\f]
+Surfaces of constant \f$ u \f$ (or \f$ u' \f$) are confocal ellipsoids.
+The surface \f$ u = 0 \f$ (resp. \f$ u' = 0 \f$) corresponds to the
+focal disc of diameter \f$ 2E \f$ (resp. focal rod of length
+\f$ 2E' \f$).  The level ellipsoid is given by \f$ u = b \f$
+(resp. \f$ u' = a \f$).  On the level ellipsoid, \f$ \beta \f$ is the
+familiar parametric latitude.
+
+In writing the potential and the gravity, it is useful to introduce the
+functions
+\f[
+\begin{align}
+  Q(z) &= \frac1{2z^3}
+    \biggl[\biggl(1 + \frac3{z^2}\biggr)\tan^{-1}z - \frac3z\biggr],\\
+  Q'(z') &= \frac{(1+z'^2)^{3/2}}{2z'^3}
+    \biggl[\biggl(2 + \frac3{z'^2}\biggr)\sinh^{-1}z' -
+      \frac{3\sqrt{1+z'^2}}{z'}\biggr],\\
+  G(z) &= \biggl(3Q(z)+z\frac{dQ(z)}{dz}\biggr)(1+z^2)\\
+       &= \frac1{z^4}\biggl[3(1+z^2)
+         \biggl(1-\frac{\tan^{-1}z}z\biggr)-z^2\biggr],\\
+  G'(z') &= \frac{3Q'(z')}{1+z'^2}+z'\frac{dQ'(z')}{dz'}\\
+         &= \frac{1+z'^2}{z'^4}
+           \biggl[3\biggl(1-\frac{\sqrt{1+z'^2}\sinh^{-1}z'}{z'}\biggr)
+           +z'^2\biggr].
+\end{align}
+\f]
+The function arguments are \f$ z = E/u \f$
+(resp. \f$ z' = E'/u' \f$) and the unprimed and primed quantities are
+related by
+\f[
+\begin{align}
+Q'(z') = Q(z),&{} \qquad G'(z') = G(z),\\
+z'^2 = -\frac{z^2}{1 + z^2},&{} \qquad z^2 = -\frac{z'^2}{1 + z'^2}.
+\end{align}
+\f]
+The functions \f$ q(u) \f$ and \f$ q'(u) \f$ used by Heiskanen and
+Moritz are given by
+\f[
+  q(u) = \frac{E^3}{u^3}Q\biggl(\frac Eu\biggr),\qquad
+  q'(u) = \frac{E^2}{u^2}G\biggl(\frac Eu\biggr).
+\f]
+The functions \f$ Q(z) \f$, \f$ Q'(z') \f$, \f$ G(z) \f$, and
+\f$ G'(z') \f$ are more convenient for use in numerical codes because
+they are finite in the spherical limit \f$ E \rightarrow 0 \f$, i.e.,
+\f$ Q(0) = Q'(0) = \frac2{15} \f$, and \f$ G(0) = G'(0) = \frac25 \f$.
+
+\subsection normalgravpot The normal potential
+
+The normal potential is the sum of three components, a mass term, a
+quadrupole term and a centrifugal term,
+\f[ U = U_m + U_q + U_r. \f]
+The mass term is
+\f[ U_m = \frac {GM}E \tan^{-1}\frac Eu
+        = \frac {GM}{E'} \sinh^{-1}\frac{E'}{u'}; \f]
+the quadrupole term is
+\f[
+\begin{align}
+ U_q &= \frac{\omega^2}2 \frac{a^2 b^3}{u^3} \frac{Q(E/u)}{Q(E/b)}
+        \biggl(\sin^2\beta-\frac13\biggr)\\
+     &= \frac{\omega^2}2 \frac{a^2 b^3}{(u'^2+E'^2)^{3/2}}
+        \frac{Q'(E'/u')}{Q'(E'/a)}
+        \biggl(\sin^2\beta-\frac13\biggr);
+\end{align}
+\f]
+finally, the rotational term is
+\f[
+U_r = \frac{\omega^2}2 R^2
+    = \frac{\omega^2}2 (u^2 + E^2) \cos^2\beta
+    = \frac{\omega^2}2 u'^2 \cos^2\beta.
+\f]
+
+\f$ U_m \f$ and \f$ U_q \f$ are both gravitational potentials (due to
+mass within the ellipsoid).  The total mass contributing to \f$ U_m \f$
+is \f$ M \f$; the total mass contributing to \f$ U_q \f$ vanishes (far
+from the ellipsoid, the \f$ U_q \f$ decays inversely as the cube of the
+distance).
+
+\f$ U_m \f$ and \f$ U_q + U_r \f$ are separately both constant on the
+level ellipsoid.  \f$ U_m \f$ is the normal potential for a massive
+non-rotating ellipsoid.  \f$ U_q + U_r \f$ is the potential for a
+massless rotating ellipsoid.  Combining all the terms, \f$ U \f$ is the
+normal potential for a massive rotating ellipsoid.
+
+\subsection normalgravmass The mass distribution
+
+Typically, the normal potential, \f$ U \f$, is only of interest for
+outside the ellipsoid \f$ u \ge b \f$ (resp. \f$ u' \ge a \f$).  In
+planetary applications a open problem is finding a mass distribution
+which is in hydrostatic equilibrium (the mass density is non-negative
+and a non-decreasing function of the potential interior to the
+ellipsoid).
+
+However it is possible to give singular mass distributions consistent
+with the normal potential.
+
+For a non-rotating body, the potential \f$ U = U_m \f$ is generated by a
+sandwiching the mass \f$ M \f$ uniformly between the level ellipsoid
+with semi-axes \f$ a \f$ and \f$ b \f$ and a close <i>similar</i>
+ellipsoid with semi-axes \f$ (1-\epsilon)a \f$ and
+\f$ (1-\epsilon)b \f$.  Chasles (1840) extends a theorem of Newton to
+show that the field interior to such an ellipsoidal shell vanishes.
+Thus the potential on the ellipsoid is constant, i.e., it is indeed a
+level ellipsoid.  This result also holds for a non-rotating triaxial
+ellipsoid.
+
+Observing that \f$ U_m \f$ and \f$ U_q \f$ as defined above obey
+\f$ \nabla^2 U_m = \nabla^2 U_q = 0 \f$ everywhere for \f$ u > 0 \f$
+(resp. \f$ u' > 0 \f$), we see that these potentials correspond to
+masses concentrated at \f$ u = 0 \f$ (resp. \f$ u' = 0 \f$).
+
+In the oblate case, \f$ U_m \f$ is generated by a massive disc at
+\f$ Z = 0 \f$, \f$ R < E \f$, with mass density (mass per unit area) \f$
+\rho_m \f$ and moments of inertia about the equatorial (resp. polar)
+axis of \f$ A_m \f$ (resp. \f$ C_m \f$) given by
+\f[
+\begin{align}
+\rho_m &= \frac M{2\pi E\sqrt{E^2 - R^2}},\\
+A_m &= \frac {ME^2}3, \\
+C_m &= \frac {2ME^2}3, \\
+C_m-A_m &= \frac {ME^2}3.
+\end{align}
+\f]
+This mass distribution is the same as that produced by projecting a
+uniform spheric shell of mass \f$ M \f$ and radius \f$ E \f$ onto the
+equatorial plane.
+
+In the prolate case, \f$ U_m \f$ is generated by a massive rod at \f$ R
+= 0 \f$, \f$ Z < E' \f$ and now the mass density \f$ \rho'_m \f$ has
+units mass per unit length,
+\f[
+\begin{align}
+\rho'_m &= \frac M{2E'},\\
+A_m &= \frac {ME'^2}3, \\
+C_m &= 0, \\
+C_m-A_m &= -\frac {ME'^2}3.
+\end{align}
+\f]
+This mass distribution is the same as that produced by projecting a
+uniform spheric shell of mass \f$ M \f$ and radius \f$ E' \f$ onto the
+polar axis.
+
+Similarly, \f$ U_q \f$ is generated in the oblate case by
+\f[
+\begin{align}
+\rho_q &= \frac{a^2 b^3 \omega^2}G
+   \frac{2E^2 - 3R^2}{6\pi E^5 \sqrt{E^2 - R^2} Q(E/b)}, \\
+A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45 Q(E/b)}, \\
+C_q &= -\frac{a^2 b^3 \omega^2}G \frac4{45 Q(E/b)}, \\
+C_q-A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45 Q(E/b)}.
+\end{align}
+\f]
+The corresponding results for a prolate ellipsoid are
+\f[
+\begin{align}
+\rho_q' &= \frac{a^2 b^3 \omega^2}G
+   \frac{3Z^2 - E'^2}{12 E'^5 Q'(E'/a)}, \\
+A_q &= \frac{a^2 b^3 \omega^2}G \frac2{45 Q'(E'/a)}, \\
+C_q &= 0, \\
+C_q-A_q &= -\frac{a^2 b^3 \omega^2}G \frac2{45 Q'(E'/a)}.
+\end{align}
+\f]
+
+Summing up the mass and quadrupole terms, we have
+\f[
+\begin{align}
+A &= A_m + A_q, \\
+C &= C_m + C_q, \\
+J_2 & = \frac{C - A}{Ma^2},
+\end{align}
+\f]
+where \f$ J_2 \f$ is the <i>dynamical form factor</i>.
+
+\subsection normalgravsurg The surface gravity
+
+Each term in the potential contributes to the gravity on the surface of
+the ellipsoid
+\f[
+\gamma = \gamma_m + \gamma_q + \gamma_r;
+\f]
+These are the components of gravity normal to the ellipsoid and, by
+convention, \f$ \gamma \f$ is positive downwards.  The tangential
+components of the total gravity and that due to \f$ U_m \f$ vanish.
+Those tangential components of the gravity due to \f$ U_q \f$ and \f$
+U_r \f$ cancel one another.
+
+The gravity \f$ \gamma \f$ has the following dependence on latitude
+\f[
+\begin{align}
+\gamma &= \frac{b\gamma_a\cos^2\beta + a\gamma_b\sin^2\beta}
+               {\sqrt{b^2\cos^2\beta + a^2\sin^2\beta}}\\
+       &= \frac{a\gamma_a\cos^2\phi + b\gamma_b\sin^2\phi}
+               {\sqrt{a^2\cos^2\phi + b^2\sin^2\phi}},
+\end{align}
+\f]
+and the individual components, \f$ \gamma_m \f$, \f$ \gamma_q \f$, and
+\f$ \gamma_r \f$, have the same dependence on latitude.  The equatorial
+and polar gravities are
+\f[
+\begin{align}
+\gamma_a &= \gamma_{ma} + \gamma_{qa} + \gamma_{ra},\\
+\gamma_b &= \gamma_{mb} + \gamma_{qb} + \gamma_{rb},
+\end{align}
+\f]
+where
+\f[
+\begin{align}
+\gamma_{ma} &= \frac{GM}{ab},\qquad \gamma_{mb} = \frac{GM}{a^2},\\
+\gamma_{qa} &= -\frac{\omega^2 a}6 \frac{G(E/b)}{Q(E/b)}
+             = -\frac{\omega^2 a}6 \frac{G'(E'/a)}{Q'(E'/a)},\\
+\gamma_{qb} &= -\frac{\omega^2 b}3 \frac{G(E/b)}{Q(E/b)}
+             = -\frac{\omega^2 b}3 \frac{G'(E'/a)}{Q'(E'/a)},\\
+\gamma_{ra} &= -\omega^2 a,\qquad \gamma_{rb} = 0.
+\end{align}
+\f]
+
+\subsection normalgravmean The mean gravity
+
+Performing an average of the surface gravity over the area of the
+ellipsoid gives
+\f[
+\langle \gamma \rangle = \frac {4\pi a^2 b}A
+  \biggl(\frac{2\gamma_a}{3a} + \frac{\gamma_b}{3b}\biggr),
+\f]
+where \f$ A \f$ is the area of the ellipsoid
+\f[
+\begin{align}
+ A &= 2\pi\biggl( a^2 + ab\frac{\sinh^{-1}(E/b)}{E/b} \biggr)\\
+   &= 2\pi\biggl( a^2 + b^2\frac{\tan^{-1}(E'/a)}{E'/a} \biggr).
+\end{align}
+\f]
+
+The contributions to the mean gravity are
+\f[
+\begin{align}
+\langle \gamma_m \rangle &= \frac{4\pi}A GM, \\
+\langle \gamma_q \rangle &= 0 \quad \text{(as expected)}, \\
+\langle \gamma_r \rangle &= -\frac{4\pi}A \frac{2\omega^2 a^2b}3,\\
+\end{align}
+\f]
+resulting in
+\f[
+\langle \gamma \rangle = \frac{4\pi}A
+    \biggl(GM - \frac{2\omega^2 a^2b}3\biggr).
+\f]
+
+\subsection normalgrav Possible values of the dynamical form factor
+
+The solution for the normal gravity is well defined for arbitrary
+\f$ M \f$, \f$ \omega \f$, \f$ a > 0\f$, and \f$ f < 1 \f$.  (Note that
+arbitrary oblate and prolate ellipsoids are possible, although
+hydrostatic equilibrium would not result in a prolate ellipsoid.)
+However, if is much easier to measure the dynamical form factor
+\f$ J_2 \f$ (from the motion of artificial satellites) than the
+flattening \f$ f \f$.  (Note too that \f$ GM \f$ is also typically
+measured from from satellite or astronomical observations and so it
+includes the mass of the atmosphere.)
+
+So a question for the software developer is: given values of \f$ M > 0\f$,
+\f$ \omega \f$, and \f$ a > 0 \f$, what are the allowed values of
+\f$ J_2 \f$?  We restrict the question to \f$ M > 0 \f$.  The
+(unphysical) case \f$ M = 0 \f$ is problematic because \f$ M \f$ appears
+in the denominator in the definition of \f$ J_2 \f$.  In the (also
+unphysical) case \f$ M < 0 \f$, a given \f$ J_2 \f$ can result from two
+distinct values of \f$ f \f$.
+
+Holding \f$ M > 0\f$, \f$ \omega \f$, and \f$ a > 0 \f$ fixed and
+varying \f$ f \f$ from \f$ -\infty \f$ to \f$ 1 \f$, we find that
+\f$ J_2 \f$ monotonically increases from \f$ -\infty \f$ to
+\f[
+\frac13 - \frac8{45\pi} \frac{\omega^2 a^3}{GM}.
+\f]
+Thus any value of \f$ J_2 \f$ less that this value is permissible (but
+some of these values may be unphysical).  In obtaining this limiting
+value, we used the result
+\f$ Q(z \rightarrow \infty) \rightarrow \pi/(4 z^3) \f$.  The value
+\f[
+J_2 = -\frac13 \frac{\omega^2 a^3}{GM}
+\f]
+results in a sphere (\f$ f = 0 \f$).
+
 <center>
 Back to \ref geoid.  Forward to \ref magnetic.  Up to \ref contents.
 </center>
@@ -2804,26 +3164,26 @@ For some background information on geodesics on triaxial ellipsoids, see
 
 References:
  - F. W. Bessel,
-   <a href="https://dx.doi.org/10.1002/asna.201011352">The calculation
+   <a href="https://doi.org/10.1002/asna.201011352">The calculation
    of longitude and latitude from geodesic measurements (1825)</a>,
    Astron. Nachr. 331(8), 852--861 (2010);
    translated by C. F. F. Karney and R. E. Deakin; preprint:
-   <a href="http://arxiv.org/abs/0908.1824">arXiv:0908.1824</a>.
+   <a href="https://arxiv.org/abs/0908.1824">arXiv:0908.1824</a>.
  - F. R. Helmert,
-   <a href="https://dx.doi.org/10.5281/zenodo.32050">
+   <a href="https://doi.org/10.5281/zenodo.32050">
    Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880)</a>,
    Aeronautical Chart and Information Center (St. Louis, 1964),
    Chaps. 5--7.
  - J. Danielsen,
    The area under the geodesic,
    Survey Review 30(232), 61--66 (1989).
-   DOI: <a href="https://dx.doi.org/10.1179/003962689791474267">
+   DOI: <a href="https://doi.org/10.1179/003962689791474267">
    10.1179/003962689791474267</a>
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    Algorithms for geodesics</a>,
    J. Geodesy 87(1), 43--55 (2013);
-   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    10.1007/s00190-012-0578-z</a>;
    addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    geod-addenda.html</a>;
@@ -2841,7 +3201,7 @@ A test set a geodesics is available at
  - <a href="https://sourceforge.net/projects/geographiclib/files/testdata/GeodTest.dat.gz">
    GeodTest.dat.gz</a>
  - C. F. F. Karney, <i>Test set for geodesics</i> (2010), <br>
-   DOI: <a href="https://dx.doi.org/10.5281/zenodo.32156">
+   DOI: <a href="https://doi.org/10.5281/zenodo.32156">
    10.5281/zenodo.32156</a>.
  .
 This is about 39 MB (compressed).  This consists of a set of geodesics
@@ -3191,7 +3551,7 @@ C3[9] = + 2431/1179648 * eps^9;
 \endverbatim
 
 The formula for area between the geodesic and the equator is given in
-Sec. 6 of <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+Sec. 6 of <a href="https://doi.org/10.1007/s00190-012-0578-z">
 Algorithms for geodesics</a> in terms of \e S,
 \f[
 S = c^2 \alpha + e^2 a^2 \cos\alpha_0 \sin\alpha_0 I_4(\sigma)
@@ -3268,10 +3628,10 @@ GeodesicExact and GeodesicLineExact solve the geodesic problem using
 elliptic integrals.  The formulation of geodesic in terms of incomplete
 elliptic integrals is given in
  - C. F. F. Karney,
-   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    on an ellipsoid of revolution</a>,
    Feb. 2011; preprint
-   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
+   <a href="https://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
  .
 It is most convenient to use the form derived for a prolate ellipsoid in
 Appendix D.  For an oblate ellipsoid this results in elliptic integrals
@@ -3759,7 +4119,7 @@ Go to
     measuring distances on the earth using a triaxial ellipsoid, you
     should also be worrying about the shape of the geoid, which
     essentially makes the geodesic problem a hopeless mess; see, for
-    example, <a href="http://arxiv.org/abs/1112.3231"> Waters
+    example, <a href="https://arxiv.org/abs/1112.3231"> Waters
     (2011)</a>.
  -# There is nothing new in this section.  It is just an exercise in
     exploring Jacobi's solution.  My interest here is in generating long
@@ -3807,10 +4167,10 @@ Go to
  -# If you only want to learn about geodesics on a biaxial ellipsoid (an
     ellipsoid of revolution), then see \ref geodesic or the paper
     - C. F. F. Karney,
-      <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+      <a href="https://doi.org/10.1007/s00190-012-0578-z">
       Algorithms for geodesics</a>,
       J. Geodesy 87(1), 43--55 (2013);
-      DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+      DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
       10.1007/s00190-012-0578-z</a>;
       addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
       geod-addenda.html</a>.
@@ -4180,7 +4540,7 @@ differential equation with periodic coefficients.  In fact it's a
 special case of Hill's equation which can be treated using Floquet
 theory, see <a href="http://dlmf.nist.gov/28.29">DLMF, §28.29</a>.
 Using the notation of §3 of
-<a href="https://dx.doi.org/10.1007/s00190-012-0578-z"> Algorithms for
+<a href="https://doi.org/10.1007/s00190-012-0578-z"> Algorithms for
 geodesics</a>, the stability is determined by computing the reduced
 length \f$m_{12}\f$ and the geodesic scales \f$M_{12}, M_{21}\f$ over
 half the perimeter of the ellipse and determining the eigenvalues
@@ -4221,7 +4581,7 @@ single point \f$(\beta_1, \omega_1)\f$.
  - Otherwise, the first envelope of the geodesics is a 4-pointed
    astroid.  The cusps of the astroid lie on either \f$\beta = -
    \beta_1\f$ or \f$\omega = \omega_1 + \pi\f$; see
-   <a href="https://dx.doi.org/10.1080/10586458.2003.10504515"> Sinclair
+   <a href="https://doi.org/10.1080/10586458.2003.10504515"> Sinclair
    (2003)</a>.
  - All geodesics intersect (or, in the case of \f$\alpha_1 = 0\f$ or
    \f$\pi\f$, touch) the line \f$\omega = \omega_1 + \pi\f$.
@@ -4255,7 +4615,7 @@ ellipsoid.)  Consider now terminating the geodesics from \f$(\beta_1,
 These properties show that the inverse problem can be solved using
 techniques similar to those employed for an ellipsoid of revolution (see
 §4 of
-<a href="https://dx.doi.org/10.1007/s00190-012-0578-z"> Algorithms for
+<a href="https://doi.org/10.1007/s00190-012-0578-z"> Algorithms for
 geodesics</a>).
  - If the points are opposite umbilical points, an arbitrary
    \f$\alpha_1\f$ may be chosen.
@@ -4402,7 +4762,7 @@ EllipticFunction::Pi(real phi) const.
 
 Nyrtsov, et al.,
  - M. V. Nyrtsov, M. E. Flies, M. M. Borisov, P. J. Stooke,
-   <a href="https://dx.doi.org/10.1007/978-3-642-32618-9_17">
+   <a href="https://doi.org/10.1007/978-3-642-32618-9_17">
    Jacobi conformal projection of the triaxial ellipsoid: new projection
    for mapping of small celestial bodies,</a> in
    <i>Cartography from Pole to Pole</i>
@@ -4655,15 +5015,15 @@ Go to
 
 References:
  - G. G. Bennett,
-   <a href="https://dx.doi.org/10.1017/S0373463300013151">
+   <a href="https://doi.org/10.1017/S0373463300013151">
    Practical Rhumb Line Calculations on the Spheroid</a>
    J. Navigation 49(1), 112--119 (1996).
  - F. W. Bessel,
-   <a href="https://dx.doi.org/10.1002/asna.201011352">The calculation
+   <a href="https://doi.org/10.1002/asna.201011352">The calculation
    of longitude and latitude from geodesic measurements (1825)</a>,
    Astron. Nachr. 331(8), 852--861 (2010);
    translated by C. F. F. Karney and R. E. Deakin; preprint:
-   <a href="http://arxiv.org/abs/0908.1824">arXiv:0908.1824</a>.
+   <a href="https://arxiv.org/abs/0908.1824">arXiv:0908.1824</a>.
  - V.A. Botnev, S.M. Ustinov,
    <a href="http://ntv.spbstu.ru/fulltext/T3.198.2014_05.PDF">
    Metody resheniya pryamoy i obratnoy geodezicheskikh zadach s vysokoy
@@ -4672,7 +5032,7 @@ References:
    solving with high precision), St. Petersburg State Polytechnical
    University Journal 3(198), 49--58 (2014).
  - K. C. Carlton-Wippern
-   <a href="https://dx.doi.org/10.1017/S0373463300010791">
+   <a href="https://doi.org/10.1017/S0373463300010791">
    On Loxodromic Navigation</a>,
    J. Navigation 45(2), 292--297 (1992).
  - K. E. Engsager and K. Poder,
@@ -4681,7 +5041,7 @@ References:
    transverse Mercator mapping (almost)</a>,
    Proc. XXIII Intl. Cartographic Conf. (ICC2007), Moscow (2007).
  - F. R. Helmert,
-   <a href="https://dx.doi.org/10.5281/zenodo.32050">
+   <a href="https://doi.org/10.5281/zenodo.32050">
    Mathematical and Physical Theories of Higher Geodesy, Part 1 (1880)</a>,
    Aeronautical Chart and Information Center (St. Louis, 1964),
    Chaps. 5--7.
@@ -4689,30 +5049,30 @@ References:
    <a href="http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf">
    Symbolic computation of divided differences</a>,
    SIGSAM Bull. 33(3), 7--28 (1999)
-   DOI: <a href="https://dx.doi.org/10.1145/334714.334716">
+   DOI: <a href="https://doi.org/10.1145/334714.334716">
    10.1145/334714.334716</a>.
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   <a href="https://doi.org/10.1007/s00190-011-0445-3">
    Transverse Mercator with an accuracy of a few nanometers</a>,
    J. Geodesy 85(8), 475--485 (Aug. 2011);
    addenda: <a href="http://geographiclib.sourceforge.net/tm-addenda.html">
    tm-addenda.html</a>;
    preprint:
-   <a href="http://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
+   <a href="https://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
    resource page:
    <a href="http://geographiclib.sourceforge.net/tm.html"> tm.html</a>.
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    Algorithms for geodesics</a>,
    J. Geodesy 87(1), 43--55 (2013);
-   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    10.1007/s00190-012-0578-z</a>;
    addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    geod-addenda.html</a>;
    resource page:
    <a href="http://geographiclib.sourceforge.net/geod.html"> geod.html</a>.
  - L. Krüger,
-   <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
+   <a href="https://doi.org/10.2312/GFZ.b103-krueger28"> Konforme
    Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of
    the ellipsoidal earth to the plane), Royal Prussian Geodetic Institute,
    New Series 52, 172 pp. (1912).
@@ -4720,11 +5080,11 @@ References:
    <a href="http://www.mercator99.webspace.virginmedia.com/">
    The Mercator Projections</a> (2013), §2.5 and §6.5.
  - W. M. Smart
-   <a href="https://dx.doi.org/10.1093/mnras/106.2.124">
+   <a href="https://doi.org/10.1093/mnras/106.2.124">
    On a Problem in Navigation</a>
    MNRAS 106(2), 124--127 (1946).
  - J. E. D. Williams
-   <a href="https://dx.doi.org/10.1017/S0373463300045549">
+   <a href="https://doi.org/10.1017/S0373463300045549">
    Loxodromic Distances on the Terrestrial Spheroid Journal</a>,
    J. Navigation 3(2), 133--140 (1950)
 
@@ -5228,10 +5588,10 @@ ellipses.  This is discussed in more detail in \ref gevsgeodesic.
 Solutions of the great ellipse problems implemented for MATLAB and
 Octave are provided by
  - gedoc: briefly describe the routines
- - gereckon: solve the direct great circle problem
- - gedistance: solve the inverse great circle problem
+ - gereckon: solve the direct great ellipse problem
+ - gedistance: solve the inverse great ellipse problem
  .
-At this time, there are no C++ support in GeographicLib for great
+At this time, there is C++ support in GeographicLib for great
 ellipses.
 
 References:
@@ -5240,34 +5600,34 @@ References:
    Mathematical Models for Navigation Systems</a>,
    TR-182 (U.S. Naval Oceanographic Office, 1965).
  - B. R. Bowring,
-   <a href="https://dx.doi.org/10.1007/BF02521760">
+   <a href="https://doi.org/10.1007/BF02521760">
    The direct and inverse solutions for the great elliptic line on the
    reference ellipsoid</a>, Bull. Geod. 58, 101--108 (1984).
  - M. A. Earle,
    A vector solution for navigation on a great ellipse,
    J. Navigation 53(3), 473--481 (2000).
  - M. A. Earle,
-   <a href="https://dx.doi.org/10.1017/S037346330800475X">
+   <a href="https://doi.org/10.1017/S037346330800475X">
    Vector solutions for azimuth</a>,
    J. Navigation 61(3), 537--545 (2008).
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    Algorithms for geodesics</a>, J. Geodesy 87(1), 43--55 (2013);
    addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    geod-addenda.html</a>.
  - A. Pallikaris & G. Latsas,
-   <a href="https://dx.doi.org/1017/S0373463309005323">
+   <a href="https://doi.org/1017/S0373463309005323">
    New algorithm for great elliptic sailing (GES)</a>,
    J. Navigation 62(3), 493--507 (2009).
  - A. Pallikaris, L. Tsoulos, & D. Paradissis,
    New meridian arc formulas for sailing calculations in navigational
    GIS, International Hydrographic Review, 24--34 (May 2009).
  - L. E. Sjöberg,
-   <a href="https://dx.doi.org/10.2478/v10156-011-0040-9">
+   <a href="https://doi.org/10.2478/v10156-011-0040-9">
    Solutions to the direct and inverse navigation problems on the great
    ellipse</a>, J. Geodetic Science 2(3), 200--205 (2012).
  - R. Williams,
-   <a href="https://dx.doi.org/10.1017/S0373463300013333">
+   <a href="https://doi.org/10.1017/S0373463300013333">
    The Great Ellipse on the Surface of the Spheroid</a>,
    J. Navigation 49(2), 229--234 (1996).
  - T. Vincenty,
@@ -5348,9 +5708,9 @@ the ellipsoid.
 
 The area between the segment of a great ellipse and the equator can be
 found by very similar methods to those used for geodesic areas; see
-<a href="https://dx.doi.org/10.1179/003962689791474267"> Danielsen
+<a href="https://doi.org/10.1179/003962689791474267"> Danielsen
 (1989)</a>.  The notation here is similar to that employed by
-<a href="https://dx.doi.org/10.1007/s00190-012-0578-z"> Karney
+<a href="https://doi.org/10.1007/s00190-012-0578-z"> Karney
 (2013)</a>.
 \f[
 \begin{align}
@@ -5592,7 +5952,7 @@ Go to
 
 References:
  - L. Krüger,
-   <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
+   <a href="https://doi.org/10.2312/GFZ.b103-krueger28"> Konforme
    Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of
    the ellipsoidal earth to the plane), Royal Prussian Geodetic Institute,
    New Series 52, 172 pp. (1912).
@@ -5603,16 +5963,16 @@ References:
    (Also appeared as:
    Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13).
    Part V, pp. 67--101,
-   <a href="https://dx.doi.org/10.3138/X687-1574-4325-WM62">Conformal
+   <a href="https://doi.org/10.3138/X687-1574-4325-WM62">Conformal
    Projections Based On Jacobian Elliptic Functions</a>.
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   <a href="https://doi.org/10.1007/s00190-011-0445-3">
    Transverse Mercator with an accuracy of a few nanometers</a>,
    J. Geodesy 85(8), 475--485 (Aug. 2011);
    addenda: <a href="http://geographiclib.sourceforge.net/tm-addenda.html">
    tm-addenda.html</a>;
    preprint:
-   <a href="http://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
+   <a href="https://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
    resource page:
    <a href="http://geographiclib.sourceforge.net/tm.html"> tm.html</a>.
  .
@@ -5631,7 +5991,7 @@ A test set for the transverse Mercator projection is available at
    TMcoords.dat.gz</a>
  - C. F. F. Karney, <i>Test data for the transverse Mercator projection</i>
    (2009),  <br>
-   DOI: <a href="https://dx.doi.org/10.5281/zenodo.32470">
+   DOI: <a href="https://doi.org/10.5281/zenodo.32470">
    10.5281/zenodo.32470</a>.
  .
 This is about 17 MB (compressed).  This test set consists of a set of
@@ -5851,13 +6211,13 @@ Further instructions are included at the top of the file.
 
 This section gives color versions of the figures in
  - C. F. F. Karney,
-   <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   <a href="https://doi.org/10.1007/s00190-011-0445-3">
    Transverse Mercator with an accuracy of a few nanometers</a>,
    J. Geodesy 85(8), 475--485 (Aug. 2011);
    addenda: <a href="http://geographiclib.sourceforge.net/tm-addenda.html">
    tm-addenda.html</a>;
    preprint:
-   <a href="http://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
+   <a href="https://arxiv.org/abs/1002.1417"> arXiv:1002.1417</a>;
    resource page:
    <a href="http://geographiclib.sourceforge.net/tm.html"> tm.html</a>.
 
@@ -5964,7 +6324,7 @@ Back to \ref transversemercator.  Forward to \ref auxlat.  Up to
 
 The implementation of Geocentric::Reverse is adapted from
  - H. Vermeille,
-   <a href="https://dx.doi.org/10.1007/s00190-002-0273-6">
+   <a href="https://doi.org/10.1007/s00190-002-0273-6">
    Direct transformation from geocentric coordinates to geodetic
    coordinates</a>, J. Geodesy 76, 451--454 (2002).
 
@@ -5974,14 +6334,14 @@ restriction and to improve the numerical accuracy.  Now the method is
 accurate for all inputs (even if \e h is infinite).  The changes are
 described in Appendix B of
  - C. F. F. Karney,
-   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    on an ellipsoid of revolution</a>,
    Feb. 2011; preprint
-   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
+   <a href="https://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
  .
 Vermeille similarly updated his method in
  - H. Vermeille,
-   <a href="https://dx.doi.org/10.1007/s00190-010-0419-x">
+   <a href="https://doi.org/10.1007/s00190-010-0419-x">
    An analytical method to transform geocentric into
    geodetic coordinates</a>, J. Geodesy 85, 105--117 (2011).
 
@@ -6058,12 +6418,12 @@ inaccurate results due to underflow; in the other hand, the case of the
 sphere, \e f = 0, is treated specially and gives accurate results.
 
 Other comparable methods are K. M. Borkowski,
-<a href="https://dx.doi.org/10.1007/BF00643807"> Transformation
+<a href="https://doi.org/10.1007/BF00643807"> Transformation
 of geocentric to geodetic coordinates without approximations</a>,
 Astrophys. Space Sci. 139, 1--4 (1987)
-(<a href="https://dx.doi.org/10.1007/BF00656995"> erratum</a>)
+(<a href="https://doi.org/10.1007/BF00656995"> erratum</a>)
 and T. Fukushima,
-<a href="https://dx.doi.org/10.1007/s001900050271"> Fast transform from
+<a href="https://doi.org/10.1007/s001900050271"> Fast transform from
 geocentric to geodetic coordinates</a>, J. Geodesy 73, 603--610 (1999).
 However the choice of independent variables in these methods leads
 to a loss of accuracy for points near the equatorial plane.
@@ -6648,7 +7008,7 @@ Here's what you should know:
    arbitrary precision via mpfr::mpreal; this requires:
    - <a href="http://www.mpfr.org"> MPFR</a>, version 3.0 or later,
    - <a href="http://www.holoborodko.com/pavel/mpfr"> MPFR C++</a>
-     (version 3.6.2 or later),
+     (version 3.6.5, dated 2016-12-19, or later),
    - a compiler which supports the explicit cast operator (e.g., g++ 4.5
      or later, Visual Studio 12 2013 or later).
  - MPFR, MPFR C++, and Boost all come with their own licenses.  Be sure
@@ -6663,10 +7023,11 @@ Here's what you should know:
    Calling this function after other GeographicLib routines will lead to
    inconsistent results (because the precision of some constants like
    Math::pi() is set when the functions are first called).
- - All the \ref utilities call Utility::set_digits().  This causes the
-   precision (in bits) to be determined by the
-   <code>GEOGRAPHICLIB_DIGITS</code> environment variable.  If this is
-   not defined the precision is set to 256 bits.
+ - All the \ref utilities call Utility::set_digits() (with no
+   arguments).  This causes the precision (in bits) to be determined by
+   the <code>GEOGRAPHICLIB_DIGITS</code> environment variable.  If this
+   is not defined the precision is set to 256 bits (about 77 decimal
+   digits).
  - The accuracy of most calculations should increase as the precision
    increases (and typically only a few bits of accuracy should be lost).
    We can distinguish 4 sources of error:
@@ -6711,15 +7072,15 @@ Here's what you should know:
  - Because only a tiny number of people will be interested in using this
    facility:
    - the cmake support for the required libraries is rudimentary;
+   - however geographiclib-config.cmake does export
+     <code>GEOGRAPHICLIB_PRECISION</code> and
+     <code>GEOGRAPHICLIB_HIGHPREC_LIBRARIES</code>, the libraries
+     providing the support for high-precision arithmetic;
    - support for the C++11 mathematical functions and the explicit cast
      operator is required;
    - quad precision is only available on Linux;
    - mpfr has been mostly tested on Linux (but it works on Windows with
-     Visual Studio 12 and MacOS too);
-   - because the boost library (used for quad precision) interprets fixed +
-     setprecision(0) to mean "print all the digits you've got" instead
-     of "print the nearest integer", some of the formatted output is
-     wrong with <code>GEOGRAPHICLIB_PRECISION=4.</code>
+     Visual Studio 12 and MacOS too).
 
 The following steps needed to be taken
 
@@ -6915,6 +7276,49 @@ of the
 <a href="https://sourceforge.net/p/geographiclib/code/ci/release/tree/">
 git repository for GeographicLib</a>.
 
+ - <a href="http://geographiclib.sourceforge.net/1.47">Version 1.47</a>
+   (released 2017-02-15)
+     - Add NearestNeighbor class.
+     - Improve accuracy of area calculation (fixing a flaw introduced in
+       version 1.46); fix applied in Geodesic, GeodesicExact, and the
+       implementations in C, Fortran, Java, JavaScript, Python, MATLAB,
+       and Maxima.
+     - Generalize NormalGravity to allow oblate and prolate ellipsoids.
+       As a consequence a new form of constructor,
+       NormalGravity::NormalGravity, has been introduced and the old
+       form is now deprecated (and because the signatures of the two
+       constructors are similar, the compiler will warn about the use of
+       the old one).
+     - Changes in Math class:
+       - Math::sincosd, Math::sind, Math::cosd only return −0 for
+         the case sin(−0);
+       - Math::atan2d and Math::AngNormalize return results in
+         (−180°, 180°]; this may affect the longitudes and
+         azimuth returned by several other functions.
+     - Add Utility::trim() and Utility::val<T>(); Utility::num<T>() is now
+       DEPRECATED.
+     - Changes in cmake support:
+       - remove support of PACKAGE_PATH and INSTALL_PATH in cmake
+         configuration;
+       - fix to FindGeographicLib.cmake to make it work on Debian systems;
+       - use $<TARGET_PDB_FILE:tgt> (cmake version >= 3.1);
+       - use NAMESPACE for exported targets;
+       - geographiclib-config.cmake exports GEOGRAPHICLIB_DATA,
+         GEOGRAPHICLIB_PRECISION, and GeographicLib_HIGHPREC_LIBRARIES.
+     - Add pkg-config support for cmake and autoconf builds.
+     - Minor fixes:
+       - fix the order of declarations in C library, incorporating the
+         patches in version 1.46.1;
+       - fix the packaging of the python library, incorporating the
+         patches in version 1.46.3;
+       - restrict junit dependency in the Java package to testing scope
+         (thanks to Mick Killianey);
+       - various behind-the-scenes fixes to EllipticFunction;
+       - fix documentation and default install location for Windows binary
+         installers;
+       - fix clang compiler warnings in GeodesicExactC4 and
+         TransverseMercator.
+
  - <a href="http://geographiclib.sourceforge.net/1.46">Version 1.46</a>
    (released 2016-02-15)
    - The following BUGS have been fixed:
@@ -8143,7 +8547,7 @@ git repository for GeographicLib</a>.
    - Increase accuracy of scale calculation in TransverseMercator and
      TransverseMercatorExact.
    - Code and documentation changes for consistency with
-     <a  href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>
+     <a  href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>
 
  - <a href="http://geographiclib.sourceforge.net/1.0">Version 1.0</a>
    (released 2010-01-07)
diff --git a/doc/Makefile.in b/doc/Makefile.in
index fac283b..c4a9025 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -193,6 +193,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -243,6 +246,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/doc/NETGeographicLib.dox b/doc/NETGeographicLib.dox
index b9b7c5b..637e1c0 100644
--- a/doc/NETGeographicLib.dox
+++ b/doc/NETGeographicLib.dox
@@ -11,8 +11,8 @@
 /**
 \mainpage NETGeographicLib library
 \author Scott Heiman (mrmtdew2 at outlook.com)
-\version 1.46
-\date 2016-02-15
+\version 1.47
+\date 2017-02-15
 
 The documentation for other versions is available at
 <tt>http://geographiclib.sourceforge.net/m.nn/NET</tt> for versions numbers
diff --git a/doc/geodesic-c.dox b/doc/geodesic-c.dox
index a92cb00..10daeb8 100644
--- a/doc/geodesic-c.dox
+++ b/doc/geodesic-c.dox
@@ -11,7 +11,7 @@
 /**
 \mainpage Geodesic routines implemented in C
 \author Charles F. F. Karney (charles at karney.com)
-\version 1.46
+\version 1.47
 
 The documentation for other versions is available at
 <tt>http://geographiclib.sourceforge.net/m.nn/C</tt> for versions numbers
@@ -32,10 +32,10 @@ compile correctly with just about any C compiler.
 \section download-c Downloading the source
 
 The C library is part of %GeographicLib which available for download at
-- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.tar.gz">
-  GeographicLib-1.46.tar.gz</a>
-- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.zip">
-  GeographicLib-1.46.zip</a>
+- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.tar.gz">
+  GeographicLib-1.47.tar.gz</a>
+- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.zip">
+  GeographicLib-1.47.zip</a>
 .
 as either a compressed tar file (tar.gz) or a zip file.  After unpacking
 the source, the C library can be found in the directory <tt>legacy/C</tt>.
@@ -125,12 +125,12 @@ echo 30 0 29.5 179.5 | ./inverse \endverbatim
 \section external-c External links
 
 - These algorithms are derived in C. F. F. Karney,
-  <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+  <a href="https://doi.org/10.1007/s00190-012-0578-z">
   Algorithms for geodesics</a>,
   J. Geodesy <b>87</b>, 43--55 (2013)
   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html"> addenda</a>).
 - A longer paper on geodesics: C. F. F. Karney,
-   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    on an ellipsoid of revolution</a>,
    Feb. 2011
    (<a href="http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata">
@@ -190,6 +190,13 @@ echo 30 0 29.5 179.5 | ./inverse \endverbatim
 
 \section changes-c Change log
 
+ - <a href="http://geographiclib.sourceforge.net/1.47/C">Version 1.47</a>
+   (released 2017-02-15)
+   - Fix the order of declarations, incorporating the patches in version
+     1.46.1.
+   - Improve accuracy of area calculation (fixing a flaw introduced in
+     version 1.46).
+
  - <a href="http://geographiclib.sourceforge.net/1.46/C">Version 1.46</a>
    (released 2016-02-15)
    - Add s13 and a13 to the geod_geodesicline struct.
diff --git a/doc/geodesic-for.dox b/doc/geodesic-for.dox
index e83bfcc..cdba88d 100644
--- a/doc/geodesic-for.dox
+++ b/doc/geodesic-for.dox
@@ -11,7 +11,7 @@
 /**
 \mainpage Geodesic routines implemented in Fortran
 \author Charles F. F. Karney (charles at karney.com)
-\version 1.46
+\version 1.47
 
 The documentation for other versions is available at
 <tt>http://geographiclib.sourceforge.net/m.nn/Fortran</tt> for versions numbers
@@ -29,10 +29,10 @@ compile correctly with just about any Fortran compiler.
 \section download-for Downloading the source
 
 The Fortran library is part of %GeographicLib which available for download at
-- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.tar.gz">
-  GeographicLib-1.46.tar.gz</a>
-- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.zip">
-  GeographicLib-1.46.zip</a>
+- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.tar.gz">
+  GeographicLib-1.47.tar.gz</a>
+- <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.zip">
+  GeographicLib-1.47.zip</a>
 .
 as either a compressed tar file (tar.gz) or a zip file.  After unpacking
 the source, the Fortran library can be found in the directory
@@ -109,12 +109,12 @@ and are therefore in the public domain.
 \section external-for External links
 
 - These algorithms are derived in C. F. F. Karney,
-  <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+  <a href="https://doi.org/10.1007/s00190-012-0578-z">
   Algorithms for geodesics</a>,
   J. Geodesy <b>87</b>, 43--55 (2013)
   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html"> addenda</a>).
 - A longer paper on geodesics: C. F. F. Karney,
-   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    on an ellipsoid of revolution</a>,
    Feb. 2011
    (<a href="http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata">
@@ -174,6 +174,11 @@ and are therefore in the public domain.
 
 \section changes-for Change log
 
+ - <a href="http://geographiclib.sourceforge.net/1.47/Fortran">Version 1.47</a>
+   (released 2017-02-15)
+   - Improve accuracy of area calculation (fixing a flaw introduced in
+     version 1.46).
+
  - <a href="http://geographiclib.sourceforge.net/1.46/Fortran">Version 1.46</a>
    (released 2016-02-15)
    - More accurate inverse solution when longitude difference is close
diff --git a/doc/geodseries30.html b/doc/geodseries30.html
index 59cf575..f6093df 100644
--- a/doc/geodseries30.html
+++ b/doc/geodseries30.html
@@ -13,13 +13,13 @@ This extends the series given
 flattening.  See
     <blockquote>
       Charles F. F. Karney,<br>
-      <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+      <a href="https://doi.org/10.1007/s00190-012-0578-z">
 	<i>Algorithms for geodesics</i></a>,<br>
       J. Geodesy <b>87</b>(1), 43–55 (Jan. 2013);<br>
       DOI:
-      <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+      <a href="https://doi.org/10.1007/s00190-012-0578-z">
 	10.1007/s00190-012-0578-z</a>
-      (<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">pdf</a>);
+      (<a href="https://doi.org/10.1007/s00190-012-0578-z">pdf</a>);
       addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
 	geod-addenda.html</a>.
     </blockquote>
diff --git a/doc/tmseries30.html b/doc/tmseries30.html
index 2739772..099fbde 100644
--- a/doc/tmseries30.html
+++ b/doc/tmseries30.html
@@ -13,20 +13,20 @@
     order in the flattening.  See
     <blockquote>
       Louis Krueger,
-      <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28">
+      <a href="https://doi.org/10.2312/GFZ.b103-krueger28">
         Konforme Abbildung des Erdellipsoids in der Ebene</a>,
       Royal Prussian Geodetic Institute, New Series 52, 172 pp. (1912),
       DOI:
-      <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28">
+      <a href="https://doi.org/10.2312/GFZ.b103-krueger28">
         10.2312/GFZ.b103-krueger28</a>
     </blockquote>
     and
     <blockquote>
       Charles F. F. Karney,
-      <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+      <a href="https://doi.org/10.1007/s00190-011-0445-3">
         Transverse Mercator with an accuracy of a few nanometers</a>,
       J. Geodesy 85(8), 475–485 (Aug. 2011); preprint
-      <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>;
+      <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>;
       resource page
       <a href="http://geographiclib.sourceforge.net/tm.html">tm.html</a>.
     </blockquote>
diff --git a/dotnet/NETGeographicLib/Accumulator.h b/dotnet/NETGeographicLib/Accumulator.h
index a0fa765..095f8b3 100644
--- a/dotnet/NETGeographicLib/Accumulator.h
+++ b/dotnet/NETGeographicLib/Accumulator.h
@@ -22,7 +22,7 @@ namespace NETGeographicLib
     precision of the sum is 106 bits or about 32 decimal places.
 
     The implementation follows J. R. Shewchuk,
-    <a href="https://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
+    <a href="https://doi.org/10.1007/PL00009321"> Adaptive Precision
     Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
     Discrete & Computational Geometry 18(3) 305--363 (1997).
 
diff --git a/dotnet/NETGeographicLib/EllipticFunction.h b/dotnet/NETGeographicLib/EllipticFunction.h
index 10b8294..b56a6df 100644
--- a/dotnet/NETGeographicLib/EllipticFunction.h
+++ b/dotnet/NETGeographicLib/EllipticFunction.h
@@ -43,14 +43,14 @@ namespace NETGeographicLib
    *
    * The computation of the elliptic integrals uses the algorithms given in
    * - B. C. Carlson,
-   *   <a href="https://dx.doi.org/10.1007/BF02198293"> Computation of real or
+   *   <a href="https://doi.org/10.1007/BF02198293"> Computation of real or
    *   complex elliptic integrals</a>, Numerical Algorithms 10, 13--26 (1995)
    * .
    * with the additional optimizations given in http://dlmf.nist.gov/19.36.i.
    * The computation of the Jacobi elliptic functions uses the algorithm given
    * in
    * - R. Bulirsch,
-   *   <a href="https://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of
+   *   <a href="https://doi.org/10.1007/BF01397975"> Numerical Calculation of
    *   Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
    *   78--90 (1965).
    * .
diff --git a/dotnet/NETGeographicLib/Geocentric.h b/dotnet/NETGeographicLib/Geocentric.h
index b078ce3..ba61c27 100644
--- a/dotnet/NETGeographicLib/Geocentric.h
+++ b/dotnet/NETGeographicLib/Geocentric.h
@@ -28,7 +28,7 @@ namespace NETGeographicLib
    * The conversion from geographic to geocentric coordinates is
    * straightforward.  For the reverse transformation we use
    * - H. Vermeille,
-   *   <a href="https://dx.doi.org/10.1007/s00190-002-0273-6"> Direct
+   *   <a href="https://doi.org/10.1007/s00190-002-0273-6"> Direct
    *   transformation from geocentric coordinates to geodetic coordinates</a>,
    *   J. Geodesy 76, 451--454 (2002).
    * .
@@ -36,11 +36,11 @@ namespace NETGeographicLib
    * results for all finite inputs (even if \e h is infinite).  The changes are
    * described in Appendix B of
    * - C. F. F. Karney,
-   *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   *   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    *   on an ellipsoid of revolution</a>,
    *   Feb. 2011;
    *   preprint
-   *   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
+   *   <a href="https://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
    * .
    * See \ref geocentric for more information.
    *
diff --git a/dotnet/NETGeographicLib/Geodesic.h b/dotnet/NETGeographicLib/Geodesic.h
index 8c91bdf..af80024 100644
--- a/dotnet/NETGeographicLib/Geodesic.h
+++ b/dotnet/NETGeographicLib/Geodesic.h
@@ -121,7 +121,7 @@ namespace NETGeographicLib
    *
    * The calculations are accurate to better than 15 nm (15 nanometers) for the
    * WGS84 ellipsoid.  See Sec. 9 of
-   * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+   * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
    * details.  The algorithms used by this class are based on series expansions
    * using the flattening \e f as a small parameter.  These are only accurate
    * for |<i>f</i>| < 0.02; however reasonably accurate results will be
@@ -140,10 +140,10 @@ namespace NETGeographicLib
    *
    * The algorithms are described in
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
diff --git a/dotnet/NETGeographicLib/GeodesicLine.h b/dotnet/NETGeographicLib/GeodesicLine.h
index 49902d5..450cf17 100644
--- a/dotnet/NETGeographicLib/GeodesicLine.h
+++ b/dotnet/NETGeographicLib/GeodesicLine.h
@@ -30,7 +30,7 @@ namespace NETGeographicLib
    *
    * The calculations are accurate to better than 15 nm (15 nanometers).  See
    * Sec. 9 of
-   * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+   * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
    * details.  The algorithms used by this class are based on series expansions
    * using the flattening \e f as a small parameter.  These are only accurate
    * for |<i>f</i>| < 0.02; however reasonably accurate results will be
@@ -39,10 +39,10 @@ namespace NETGeographicLib
    *
    * The algorithms are described in
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
diff --git a/dotnet/NETGeographicLib/Gnomonic.h b/dotnet/NETGeographicLib/Gnomonic.h
index 337d023..5b8f26b 100644
--- a/dotnet/NETGeographicLib/Gnomonic.h
+++ b/dotnet/NETGeographicLib/Gnomonic.h
@@ -21,10 +21,10 @@ namespace NETGeographicLib
    * %Gnomonic projection centered at an arbitrary position \e C on the
    * ellipsoid.  This projection is derived in Section 8 of
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
diff --git a/dotnet/NETGeographicLib/NormalGravity.cpp b/dotnet/NETGeographicLib/NormalGravity.cpp
index b394ca8..5c99ec2 100644
--- a/dotnet/NETGeographicLib/NormalGravity.cpp
+++ b/dotnet/NETGeographicLib/NormalGravity.cpp
@@ -29,11 +29,11 @@ NormalGravity::!NormalGravity(void)
 }
 
 //*****************************************************************************
-NormalGravity::NormalGravity(double a, double GM, double omega, double f, double J2)
+NormalGravity::NormalGravity(double a, double GM, double omega, double f_J2, bool geometricp)
 {
     try
     {
-        m_pNormalGravity = new GeographicLib::NormalGravity( a, GM, omega, f, J2 );
+      m_pNormalGravity = new GeographicLib::NormalGravity( a, GM, omega, f_J2, geometricp );
     }
     catch ( std::bad_alloc )
     {
diff --git a/dotnet/NETGeographicLib/NormalGravity.h b/dotnet/NETGeographicLib/NormalGravity.h
index 256b35f..fe55a42 100644
--- a/dotnet/NETGeographicLib/NormalGravity.h
+++ b/dotnet/NETGeographicLib/NormalGravity.h
@@ -51,7 +51,7 @@ namespace NETGeographicLib
    * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San
    *   Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3).
    * - H. Moritz, Geodetic Reference System 1980, J. Geodesy 54(3), 395-405
-   *   (1980) https://dx.doi.org/10.1007/BF02521480
+   *   (1980) https://doi.org/10.1007/BF02521480
    *
    * C# Example:
    * \include example-NormalGravity.cs
@@ -96,23 +96,29 @@ namespace NETGeographicLib
          *   the gravitational constant and \e M the mass of the earth (usually
          *   including the mass of the earth's atmosphere).
          * @param[in] omega the angular velocity (rad s<sup>−1</sup>).
-         * @param[in] f the flattening of the ellipsoid.
-         * @param[in] J2 dynamical form factor.
-         * @exception if \e a is not positive or the other constants are
-         *   inconsistent (see below).
+         * @param[in] f_J2 either the flattening of the ellipsoid \e f or the
+         *   the dynamical form factor \e J2.
+         * @param[out] geometricp if true, then \e f_J2 denotes the
+         *   flattening, else it denotes the dynamical form factor \e J2.
+         * @exception if \e a is not positive or if the other parameters do not
+         *   obey the restrictions given below.
          *
-         * Exactly one of \e f and \e J2 should be positive and this will be used
-         * to define the ellipsoid.  The shape of the ellipsoid can be given in one
-         * of two ways:
-         * - geometrically, the ellipsoid is defined by the flattening \e f = (\e a
-         *   − \e b) / \e a, where \e a and \e b are the equatorial radius
-         *   and the polar semi-axis.
-         * - physically, the ellipsoid is defined by the dynamical form factor
-         *   <i>J</i><sub>2</sub> = (\e C − \e A) / <i>Ma</i><sup>2</sup>,
-         *   where \e A and \e C are the equatorial and polar moments of inertia
-         *   and \e M is the mass of the earth.
+         * The shape of the ellipsoid can be given in one of two ways:
+         * - geometrically (\e geomtricp = true), the ellipsoid is defined by the
+         *   flattening \e f = (\e a − \e b) / \e a, where \e a and \e b are
+         *   the equatorial radius and the polar semi-axis.  The parameters should
+         *   obey \e a > 0, \e f < 1.  There are no restrictions on \e GM or
+         *   \e omega, in particular, \e GM need not be positive.
+         * - physically (\e geometricp = false), the ellipsoid is defined by the
+         *   dynamical form factor <i>J</i><sub>2</sub> = (\e C − \e A) /
+         *   <i>Ma</i><sup>2</sup>, where \e A and \e C are the equatorial and
+         *   polar moments of inertia and \e M is the mass of the earth.  The
+         *   parameters should obey \e a > 0, \e GM > 0 and \e J2 < 1/3
+         *   − (<i>omega</i><sup>2</sup><i>a</i><sup>3</sup>/<i>GM</i>)
+         *   8/(45π).  There is no restriction on \e omega.
          **********************************************************************/
-        NormalGravity(double a, double GM, double omega, double f, double J2);
+        NormalGravity(double a, double GM, double omega, double f_J2,
+                      bool geometricp);
 
         /**
          * A constructor for creating standard gravity models..
diff --git a/dotnet/NETGeographicLib/PolygonArea.h b/dotnet/NETGeographicLib/PolygonArea.h
index 30bbf3c..f423033 100644
--- a/dotnet/NETGeographicLib/PolygonArea.h
+++ b/dotnet/NETGeographicLib/PolygonArea.h
@@ -21,10 +21,10 @@ namespace NETGeographicLib
    * This computes the area of a geodesic polygon using the method given
    * Section 6 of
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
diff --git a/dotnet/NETGeographicLib/TransverseMercator.h b/dotnet/NETGeographicLib/TransverseMercator.h
index f8d6c14..8309960 100644
--- a/dotnet/NETGeographicLib/TransverseMercator.h
+++ b/dotnet/NETGeographicLib/TransverseMercator.h
@@ -20,23 +20,23 @@ namespace NETGeographicLib
    * This uses Krüger's method which evaluates the projection and its
    * inverse in terms of a series.  See
    *  - L. Krüger,
-   *    <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
+   *    <a href="https://doi.org/10.2312/GFZ.b103-krueger28"> Konforme
    *    Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the
    *    ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New
    *    Series 52, 172 pp. (1912).
    *  - C. F. F. Karney,
-   *    <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   *    <a href="https://doi.org/10.1007/s00190-011-0445-3">
    *    Transverse Mercator with an accuracy of a few nanometers,</a>
    *    J. Geodesy 85(8), 475--485 (Aug. 2011);
    *    preprint
-   *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
+   *    <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
    *
    * Krüger's method has been extended from 4th to 6th order.  The maximum
    * error is 5 nm (5 nanometers), ground distance, for all positions within 35
    * degrees of the central meridian.  The error in the convergence is 2
    * × 10<sup>−15</sup>" and the relative error in the scale
    * is 6 − 10<sup>−12</sup>%%.  See Sec. 4 of
-   * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
+   * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
    * The speed penalty in going to 6th order is only about 1%.
    * TransverseMercatorExact is an alternative implementation of the projection
    * using exact formulas which yield accurate (to 8 nm) results over the
diff --git a/dotnet/NETGeographicLib/TransverseMercatorExact.h b/dotnet/NETGeographicLib/TransverseMercatorExact.h
index 7874cf1..3ea151c 100644
--- a/dotnet/NETGeographicLib/TransverseMercatorExact.h
+++ b/dotnet/NETGeographicLib/TransverseMercatorExact.h
@@ -19,7 +19,7 @@ namespace NETGeographicLib
    *
    * Implementation of the Transverse Mercator Projection given in
    *  - L. P. Lee,
-   *    <a href="https://dx.doi.org/10.3138/X687-1574-4325-WM62"> Conformal
+   *    <a href="https://doi.org/10.3138/X687-1574-4325-WM62"> Conformal
    *    Projections Based On Jacobian Elliptic Functions</a>, Part V of
    *    Conformal Projections Based on Elliptic Functions,
    *    (B. V. Gutsell, Toronto, 1976), 128pp.,
@@ -27,11 +27,11 @@ namespace NETGeographicLib
    *    (also appeared as:
    *    Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13).
    *  - C. F. F. Karney,
-   *    <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   *    <a href="https://doi.org/10.1007/s00190-011-0445-3">
    *    Transverse Mercator with an accuracy of a few nanometers,</a>
    *    J. Geodesy 85(8), 475--485 (Aug. 2011);
    *    preprint
-   *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
+   *    <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
    *
    * Lee gives the correct results for forward and reverse transformations
    * subject to the branch cut rules (see the description of the \e extendp
@@ -40,7 +40,7 @@ namespace NETGeographicLib
    * The error in the convergence is 2 × 10<sup>−15</sup>",
    * the relative error in the scale is 7 × 10<sup>−12</sup>%%.
    * See Sec. 3 of
-   * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
+   * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
    * The method is "exact" in the sense that the errors are close to the
    * round-off limit and that no changes are needed in the algorithms for them
    * to be used with reals of a higher precision.  Thus the errors using long
@@ -128,7 +128,7 @@ namespace NETGeographicLib
          *     a) in (−∞, 0]
          * .
          * See Sec. 5 of
-         * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a full
+         * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a full
          * discussion of the treatment of the branch cut.
          *
          * The method will work for all ellipsoids used in terrestrial geodesy.
diff --git a/dotnet/examples/ManagedCPP/CMakeLists.txt b/dotnet/examples/ManagedCPP/CMakeLists.txt
index 44e3334..defb193 100644
--- a/dotnet/examples/ManagedCPP/CMakeLists.txt
+++ b/dotnet/examples/ManagedCPP/CMakeLists.txt
@@ -15,7 +15,8 @@ foreach (EXAMPLE_SOURCE ${EXAMPLE_SOURCES})
   set_target_properties (${EXAMPLE} PROPERTIES COMPILE_FLAGS "/clr")
   # This is set up for Release builds only.  Change
   # Release/NETGeographic.dll to Debug/NETGeographic_d.dll for Debug
-  # builds.
+  # builds.  TODO: get this to work for Debug + Release.  Unfortunately
+  # generator expressions don't work in this context.
   set_target_properties (${EXAMPLE} PROPERTIES VS_DOTNET_REFERENCES
     "${PROJECT_BINARY_DIR}/bin/Release/NETGeographic.dll")
 endforeach ()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index df97f27..397c5d7 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -5,6 +5,11 @@
 if (GEOGRAPHICLIB_PRECISION EQUAL 2)
   # These examples all assume real = double
   file (GLOB EXAMPLE_SOURCES example-*.cpp)
+  find_package (Boost COMPONENTS serialization)
+  if (Boost_FOUND)
+    add_definitions (-DGEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION=1)
+    include_directories (${Boost_INCLUDE_DIRS})
+  endif ()
 else ()
   set (EXAMPLE_SOURCES)
 endif ()
@@ -25,6 +30,10 @@ foreach (EXAMPLE_SOURCE ${EXAMPLE_SOURCES})
     ${QUAD_LIBRARIES} ${MPFR_LIBRARIES})
 endforeach ()
 
+if (Boost_FOUND AND GEOGRAPHICLIB_PRECISION EQUAL 2)
+  target_link_libraries (example-NearestNeighbor ${Boost_LIBRARIES})
+endif ()
+
 find_package (OpenMP QUIET)
 
 if (OPENMP_FOUND)
diff --git a/examples/GeoidToGTX.cpp b/examples/GeoidToGTX.cpp
index d9ca6bf..936dd11 100644
--- a/examples/GeoidToGTX.cpp
+++ b/examples/GeoidToGTX.cpp
@@ -37,7 +37,7 @@
 using namespace std;
 using namespace GeographicLib;
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   // Hardwired for 3 args:
   // 1 = the gravity model (e.g., egm2008)
   // 2 = intervals per degree
@@ -52,7 +52,7 @@ int main(int argc, char* argv[]) {
     int ndigits = Utility::set_digits();
     string model(argv[1]);
     // Number of intervals per degree
-    int ndeg = Utility::num<int>(string(argv[2]));
+    int ndeg = Utility::val<int>(string(argv[2]));
     string filename(argv[3]);
     GravityModel g(model);
     int
@@ -108,5 +108,4 @@ int main(int argc, char* argv[]) {
     cerr << "Caught unknown exception\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/JacobiConformal.cpp b/examples/JacobiConformal.cpp
index 8033bdd..a132e55 100644
--- a/examples/JacobiConformal.cpp
+++ b/examples/JacobiConformal.cpp
@@ -1,3 +1,5 @@
+// Example of using the GeographicLib::JacobiConformal class.
+
 #include <iostream>
 #include <iomanip>
 #include <GeographicLib/Utility.hpp>
@@ -7,28 +9,34 @@ using namespace std;
 using namespace GeographicLib;
 
 int main() {
-  Utility::set_digits();
-  // These parameters were derived from the EGM2008 geoid; see 2011-07-04
-  // E-mail to PROJ.4 list, "Analyzing the bumps in the EGM2008 geoid".  The
-  // longitude of the major axis is -15.  These are close to the values given
-  // by Milan Bursa, Vladimira Fialova, "Parameters of the Earth's tri-axial
-  // level ellipsoid", Studia Geophysica et Geodaetica 37(1), 1-13 (1993):
-  //
-  //    longitude of major axis = -14.93 +/- 0.05
-  //    a = 6378171.36 +/- 0.30
-  //    a/(a-c) = 297.7738 +/- 0.0003
-  //    a/(a-b) = 91449 +/- 60
-  // which gives: a = 6378171.36, b = 6378101.61, c = 6356751.84
-  Math::real a = 6378137+35, b = 6378137-35, c = 6356752;
-  JacobiConformal jc(a, b, c, a-b, b-c);
-  cout  << fixed << setprecision(1)
-        << "Ellipsoid parameters: a = "
-        << a << ", b = " << b << ", c = " << c << "\n"
-        << setprecision(10)
-        << "Quadrants: x = " << jc.x() << ", y = " << jc.y() << "\n";
-  cout << "Coordinates (angle x y) in degrees:\n";
-  for (int i = 0; i <= 90; i += 5) {
-    Math::real omg = i, bet = i;
-    cout << i << " " << jc.x(omg) << " " << jc.y(bet) << "\n";
+  try {
+    Utility::set_digits();
+    // These parameters were derived from the EGM2008 geoid; see 2011-07-04
+    // E-mail to PROJ.4 list, "Analyzing the bumps in the EGM2008 geoid".  The
+    // longitude of the major axis is -15.  These are close to the values given
+    // by Milan Bursa, Vladimira Fialova, "Parameters of the Earth's tri-axial
+    // level ellipsoid", Studia Geophysica et Geodaetica 37(1), 1-13 (1993):
+    //
+    //    longitude of major axis = -14.93 +/- 0.05
+    //    a = 6378171.36 +/- 0.30
+    //    a/(a-c) = 297.7738 +/- 0.0003
+    //    a/(a-b) = 91449 +/- 60
+    // which gives: a = 6378171.36, b = 6378101.61, c = 6356751.84
+    Math::real a = 6378137+35, b = 6378137-35, c = 6356752;
+    JacobiConformal jc(a, b, c, a-b, b-c);
+    cout  << fixed << setprecision(1)
+          << "Ellipsoid parameters: a = "
+          << a << ", b = " << b << ", c = " << c << "\n"
+          << setprecision(10)
+          << "Quadrants: x = " << jc.x() << ", y = " << jc.y() << "\n";
+    cout << "Coordinates (angle x y) in degrees:\n";
+    for (int i = 0; i <= 90; i += 5) {
+      Math::real omg = i, bet = i;
+      cout << i << " " << jc.x(omg) << " " << jc.y(bet) << "\n";
+    }
+  }
+  catch (const exception& e) {
+    cerr << "Caught exception: " << e.what() << "\n";
+    return 1;
   }
 }
diff --git a/examples/JacobiConformal.hpp b/examples/JacobiConformal.hpp
index 7c83b22..984ffa9 100644
--- a/examples/JacobiConformal.hpp
+++ b/examples/JacobiConformal.hpp
@@ -46,7 +46,7 @@ namespace GeographicLib {
     { real z = Math::hypot(x, y); x /= z; y /= z; }
   public:
     /**
-     * Constructor for a trixial ellipsoid with semi-axes
+     * Constructor for a trixial ellipsoid with semi-axes.
      *
      * @param[in] a the largest semi-axis.
      * @param[in] b the middle semi-axis.
@@ -66,10 +66,11 @@ namespace GeographicLib {
       , _ey(_bc2 / _ac2 * Math::sq(_a / _b), +_bc2 / Math::sq(_b),
             _ab2 / _ac2 * Math::sq(_c / _b), Math::sq(_c / _b))
     {
-      if (!(a >= b && b >= c && c > 0))
+      if (!(Math::isfinite(_a) && _a >= _b && _b >= _c && _c > 0))
         throw GeographicErr("JacobiConformal: axes are not in order");
-      if (!(a > c))
-        throw GeographicErr("JacobiConformal: use alternate constructor for sphere");
+      if (!(_a > _c))
+        throw GeographicErr
+          ("JacobiConformal: use alternate constructor for sphere");
     }
     /**
      * Alternate constructor for a triaxial ellipsoid.
@@ -97,21 +98,22 @@ namespace GeographicLib {
             +(_b - _c) * (_b + _c) / Math::sq(_b),
             _ab2 / _ac2 * Math::sq(_c / _b), Math::sq(_c / _b))
     {
-      if (!(a >= b && b >= c && c > 0 && ab >= 0 && bc >= 0))
+      if (!(Math::isfinite(_a) && _a >= _b && _b >= _c && _c > 0 &&
+            ab >= 0 && bc >= 0))
         throw GeographicErr("JacobiConformal: axes are not in order");
-      if (!(ab + bc > 0))
+      if (!(ab + bc > 0 && Math::isfinite(_ac2)))
         throw GeographicErr("JacobiConformal: ab + bc must be positive");
     }
     /**
-     * @return the quadrant length in the \e x direction
+     * @return the quadrant length in the \e x direction.
      **********************************************************************/
     Math::real x() const { return Math::sq(_a / _b) * _ex.Pi(); }
     /**
-     * The \e x projection
+     * The \e x projection.
      *
-     * @param[in] somg sin(ω)
-     * @param[in] comg cos(ω)
-     * @return \e x
+     * @param[in] somg sin(ω).
+     * @param[in] comg cos(ω).
+     * @return \e x.
      **********************************************************************/
     Math::real x(real somg, real comg) const {
       real somg1 = _b * somg, comg1 = _a * comg; norm(somg1, comg1);
@@ -119,10 +121,10 @@ namespace GeographicLib {
         * _ex.Pi(somg1, comg1, _ex.Delta(somg1, comg1));
     }
     /**
-     * The \e x projection
+     * The \e x projection.
      *
-     * @param[in] omg ω (in degrees)
-     * @return \e x (in degrees)
+     * @param[in] omg ω (in degrees).
+     * @return \e x (in degrees).
      *
      * ω must be in (−180°, 180°].
      **********************************************************************/
@@ -132,15 +134,15 @@ namespace GeographicLib {
       return x(somg, comg) / Math::degree();
     }
     /**
-     * @return the quadrant length in the \e y direction
+     * @return the quadrant length in the \e y direction.
      **********************************************************************/
     Math::real y() const { return Math::sq(_c / _b) * _ey.Pi(); }
     /**
-     * The \e y projection
+     * The \e y projection.
      *
-     * @param[in] sbet sin(β)
-     * @param[in] cbet cos(β)
-     * @return \e y
+     * @param[in] sbet sin(β).
+     * @param[in] cbet cos(β).
+     * @return \e y.
      **********************************************************************/
     Math::real y(real sbet, real cbet) const {
       real sbet1 = _b * sbet, cbet1 = _c * cbet; norm(sbet1, cbet1);
@@ -148,10 +150,10 @@ namespace GeographicLib {
         * _ey.Pi(sbet1, cbet1, _ey.Delta(sbet1, cbet1));
     }
     /**
-     * The \e y projection
+     * The \e y projection.
      *
-     * @param[in] bet β (in degrees)
-     * @return \e y (in degrees)
+     * @param[in] bet β (in degrees).
+     * @return \e y (in degrees).
      *
      * β must be in (−180°, 180°].
      **********************************************************************/
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 2009c06..e74aa69 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -34,6 +34,7 @@ EXAMPLE_FILES = \
 	example-MagneticCircle.cpp \
 	example-MagneticModel.cpp \
 	example-Math.cpp \
+	example-NearestNeighbor.cpp \
 	example-NormalGravity.cpp \
 	example-OSGB.cpp \
 	example-PolarStereographic.cpp \
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 834af4c..1ab4e50 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -198,6 +198,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -248,6 +251,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -294,6 +298,7 @@ EXAMPLE_FILES = \
 	example-MagneticCircle.cpp \
 	example-MagneticModel.cpp \
 	example-Math.cpp \
+	example-NearestNeighbor.cpp \
 	example-NormalGravity.cpp \
 	example-OSGB.cpp \
 	example-PolarStereographic.cpp \
diff --git a/examples/example-Accumulator.cpp b/examples/example-Accumulator.cpp
index 50bc22e..fde8dff 100644
--- a/examples/example-Accumulator.cpp
+++ b/examples/example-Accumulator.cpp
@@ -21,5 +21,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-AlbersEqualArea.cpp b/examples/example-AlbersEqualArea.cpp
index 5552eea..2967fdf 100644
--- a/examples/example-AlbersEqualArea.cpp
+++ b/examples/example-AlbersEqualArea.cpp
@@ -36,5 +36,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-AzimuthalEquidistant.cpp b/examples/example-AzimuthalEquidistant.cpp
index 73e9922..d529980 100644
--- a/examples/example-AzimuthalEquidistant.cpp
+++ b/examples/example-AzimuthalEquidistant.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-CassiniSoldner.cpp b/examples/example-CassiniSoldner.cpp
index 1db18a7..4922ca8 100644
--- a/examples/example-CassiniSoldner.cpp
+++ b/examples/example-CassiniSoldner.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-CircularEngine.cpp b/examples/example-CircularEngine.cpp
index 10ac74c..2bb8f07 100644
--- a/examples/example-CircularEngine.cpp
+++ b/examples/example-CircularEngine.cpp
@@ -31,5 +31,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Constants.cpp b/examples/example-Constants.cpp
index 8123d8d..706f4ad 100644
--- a/examples/example-Constants.cpp
+++ b/examples/example-Constants.cpp
@@ -17,5 +17,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-DMS.cpp b/examples/example-DMS.cpp
index dc4006c..bca2a9e 100644
--- a/examples/example-DMS.cpp
+++ b/examples/example-DMS.cpp
@@ -25,5 +25,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Ellipsoid.cpp b/examples/example-Ellipsoid.cpp
index 2e2dc71..fcda245 100644
--- a/examples/example-Ellipsoid.cpp
+++ b/examples/example-Ellipsoid.cpp
@@ -22,5 +22,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-EllipticFunction.cpp b/examples/example-EllipticFunction.cpp
index c2ae4a3..81a6127 100644
--- a/examples/example-EllipticFunction.cpp
+++ b/examples/example-EllipticFunction.cpp
@@ -14,11 +14,12 @@ int main() {
     EllipticFunction ell(0.1);  // parameter m = 0.1
     // See Abramowitz and Stegun, table 17.1
     cout << ell.K() << " " << ell.E() << "\n";
-    double phi = 20 * Math::degree();
+    double phi = 20, sn, cn;
+    Math::sincosd(phi, sn ,cn);
     // See Abramowitz and Stegun, table 17.6 with
     // alpha = asin(sqrt(m)) = 18.43 deg and phi = 20 deg
-    cout << ell.E(phi) << " "
-         << ell.E(sin(phi), cos(phi), sqrt(1 - ell.k2() * Math::sq(sin(phi))))
+    cout << ell.E(phi * Math::degree()) << " "
+         << ell.E(sn, cn, ell.Delta(sn, cn))
          << "\n";
     // See Carlson 1995, Sec 3.
     cout << fixed << setprecision(16)
@@ -38,5 +39,4 @@ int main() {
   catch (const GeographicErr& e) {
     cout << "Caught exception: " << e.what() << "\n";
   }
-  return 0;
 }
diff --git a/examples/example-GARS.cpp b/examples/example-GARS.cpp
index 4fd7dd9..f750831 100644
--- a/examples/example-GARS.cpp
+++ b/examples/example-GARS.cpp
@@ -36,5 +36,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GeoCoords.cpp b/examples/example-GeoCoords.cpp
index 1756f4f..14f049f 100644
--- a/examples/example-GeoCoords.cpp
+++ b/examples/example-GeoCoords.cpp
@@ -24,5 +24,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Geocentric.cpp b/examples/example-Geocentric.cpp
index 2989f34..7b7b41d 100644
--- a/examples/example-Geocentric.cpp
+++ b/examples/example-Geocentric.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Geodesic-small.cpp b/examples/example-Geodesic-small.cpp
index b69b3ec..a9cd398 100644
--- a/examples/example-Geodesic-small.cpp
+++ b/examples/example-Geodesic-small.cpp
@@ -15,5 +15,4 @@ int main() {
   double s12;
   geod.Inverse(lat1, lon1, lat2, lon2, s12);
   cout << s12 / 1000 << " km\n";
-  return 0;
 }
diff --git a/examples/example-Geodesic.cpp b/examples/example-Geodesic.cpp
index cab34da..6246a09 100644
--- a/examples/example-Geodesic.cpp
+++ b/examples/example-Geodesic.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GeodesicExact.cpp b/examples/example-GeodesicExact.cpp
index a74dcd2..27d7cb1 100644
--- a/examples/example-GeodesicExact.cpp
+++ b/examples/example-GeodesicExact.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GeodesicLine.cpp b/examples/example-GeodesicLine.cpp
index cedfd82..4dfcd94 100644
--- a/examples/example-GeodesicLine.cpp
+++ b/examples/example-GeodesicLine.cpp
@@ -47,5 +47,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GeodesicLineExact.cpp b/examples/example-GeodesicLineExact.cpp
index 86d69f0..65595a7 100644
--- a/examples/example-GeodesicLineExact.cpp
+++ b/examples/example-GeodesicLineExact.cpp
@@ -47,5 +47,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GeographicErr.cpp b/examples/example-GeographicErr.cpp
index 7bf4acf..c64423c 100644
--- a/examples/example-GeographicErr.cpp
+++ b/examples/example-GeographicErr.cpp
@@ -13,5 +13,4 @@ int main() {
   catch (const GeographicErr& e) {
     cout << "Caught exception: " << e.what() << "\n";
   }
-  return 0;
 }
diff --git a/examples/example-Geohash.cpp b/examples/example-Geohash.cpp
index 3f3fad0..7e40b05 100644
--- a/examples/example-Geohash.cpp
+++ b/examples/example-Geohash.cpp
@@ -38,5 +38,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Geoid.cpp b/examples/example-Geoid.cpp
index df6e134..936e69e 100644
--- a/examples/example-Geoid.cpp
+++ b/examples/example-Geoid.cpp
@@ -22,5 +22,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Georef.cpp b/examples/example-Georef.cpp
index 4c050f8..c63529e 100644
--- a/examples/example-Georef.cpp
+++ b/examples/example-Georef.cpp
@@ -38,5 +38,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Gnomonic.cpp b/examples/example-Gnomonic.cpp
index a66f482..1ce9097 100644
--- a/examples/example-Gnomonic.cpp
+++ b/examples/example-Gnomonic.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GravityCircle.cpp b/examples/example-GravityCircle.cpp
index 55dd5ee..6b8df3d 100644
--- a/examples/example-GravityCircle.cpp
+++ b/examples/example-GravityCircle.cpp
@@ -38,5 +38,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-GravityModel.cpp b/examples/example-GravityModel.cpp
index f0e634c..d901486 100644
--- a/examples/example-GravityModel.cpp
+++ b/examples/example-GravityModel.cpp
@@ -19,5 +19,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-LambertConformalConic.cpp b/examples/example-LambertConformalConic.cpp
index fa1e89c..651b543 100644
--- a/examples/example-LambertConformalConic.cpp
+++ b/examples/example-LambertConformalConic.cpp
@@ -45,5 +45,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-LocalCartesian.cpp b/examples/example-LocalCartesian.cpp
index d16b4c7..205c6fa 100644
--- a/examples/example-LocalCartesian.cpp
+++ b/examples/example-LocalCartesian.cpp
@@ -34,5 +34,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-MGRS.cpp b/examples/example-MGRS.cpp
index 1fe2f65..54bc8a1 100644
--- a/examples/example-MGRS.cpp
+++ b/examples/example-MGRS.cpp
@@ -39,5 +39,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-MagneticCircle.cpp b/examples/example-MagneticCircle.cpp
index 8dfcbbc..149458f 100644
--- a/examples/example-MagneticCircle.cpp
+++ b/examples/example-MagneticCircle.cpp
@@ -38,5 +38,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-MagneticModel.cpp b/examples/example-MagneticModel.cpp
index 8453ad5..8a3e28e 100644
--- a/examples/example-MagneticModel.cpp
+++ b/examples/example-MagneticModel.cpp
@@ -21,5 +21,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Math.cpp b/examples/example-Math.cpp
index 31b1dbf..c94e40e 100644
--- a/examples/example-Math.cpp
+++ b/examples/example-Math.cpp
@@ -15,5 +15,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-NearestNeighbor.cpp b/examples/example-NearestNeighbor.cpp
new file mode 100644
index 0000000..295b0f0
--- /dev/null
+++ b/examples/example-NearestNeighbor.cpp
@@ -0,0 +1,141 @@
+// Example of using the GeographicLib::NearestNeighbor class.  WARNING: this
+// creates a file, vptree.xml or vptree.bin, in the current directory.
+
+#include <iostream>
+
+#include <vector>
+#include <cstdlib>              // For srand, rand
+#include <cmath>                // For asin
+#include <fstream>
+#include <string>
+#include <sstream>
+#include <algorithm>            // For sort
+#include <GeographicLib/NearestNeighbor.hpp>
+#include <GeographicLib/Geodesic.hpp>
+
+#if !defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION)
+#define GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION 0
+#endif
+
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+// If Boost serialization is available, use it.
+#include <boost/archive/xml_iarchive.hpp>
+#include <boost/archive/xml_oarchive.hpp>
+#endif
+
+using namespace std;
+using namespace GeographicLib;
+
+// A structure to hold a geographic coordinate.  Also included is a field for a
+// "name".  This is unused in this example.
+struct pos {
+  double lat, lon;
+  string name;
+  pos(double lat = 0, double lon = 0, const string& name = "")
+    : lat(lat), lon(lon), name(name) {}
+};
+
+pos randompos() {
+  double r, lat, lon;
+  r = 2 * (rand() + 0.5) / (RAND_MAX + 1.0) - 1;
+  lat = asin(r) / Math::degree();
+  r = 2 * (rand() + 0.5) / (RAND_MAX + 1.0) - 1;
+  lon = 180 * r;
+  return pos(lat, lon);
+}
+
+// A class to compute the distance between 2 positions.
+class DistanceCalculator {
+private:
+  Geodesic _geod;
+public:
+  explicit DistanceCalculator(const Geodesic& geod)
+    : _geod(geod) {}
+  double operator() (const pos& a, const pos& b) const {
+    double s12;
+    _geod.Inverse(a.lat, a.lon, b.lat, b.lon, s12);
+    return s12;
+  }
+};
+
+typedef NearestNeighbor<double, pos, DistanceCalculator> GeodesicNeighbor;
+
+// Pick 10000 points on the ellipsoid and determine which ones are more than
+// 350 km from all the others.
+
+// In this example the NearestNeighbor object is saved to an external file and
+// read back in.  This is unnecessary in this simple application, but is useful
+// if many different applications need to query the same dataset.
+
+int main() {
+  try {
+    // Define a distance function object
+    DistanceCalculator distance(Geodesic::WGS84());
+    srand(0);
+    vector<pos> pts;
+    int num = 10000;
+    // Sample the points
+    for (int i = 0; i < num; ++i) pts.push_back(randompos());
+    {
+      // Illustrate saving and restoring the GeodesicNeighbor
+      // construct it
+      GeodesicNeighbor posset(pts, distance);
+      // and save it
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+      ofstream f("vptree.xml");
+      boost::archive::xml_oarchive oa(f);
+      oa << BOOST_SERIALIZATION_NVP(posset);
+#else
+      ofstream ofs("vptree.bin", ios::binary);
+      posset.Save(ofs, true);
+#endif
+    }
+    // Construct an empty GeodesicNeighbor
+    GeodesicNeighbor posset;
+    // restore it from the file
+    {
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+      ifstream f("vptree.xml");
+      boost::archive::xml_iarchive ia(f);
+      ia >> BOOST_SERIALIZATION_NVP(posset);
+#else
+      ifstream ifs("vptree.bin", ios::binary);
+      posset.Load(ifs, true);
+#endif
+    }
+    // Now use it
+    vector<int> ind;
+    int cnt = 0;
+    double thresh = 325000;
+    cout << "Points more than " << thresh/1000 << "km from their neighbors\n"
+         << "latitude longitude distance\n";
+    for (int i = 0; i < num; ++i) {
+      // Call search with distance limits = (0, thresh].  Set exhaustive = false
+      // so that the search ends as some as a neighbor is found.
+      posset.Search(pts, distance, pts[i], ind, 1, thresh, 0, false);
+      if (ind.size() == 0) {
+        // If no neighbors in (0, thresh], search again with no upper limit and
+        // with exhaustive = true (the default).
+        double d = posset.Search(pts, distance, pts[i], ind, 1,
+                                 numeric_limits<double>::max(), 0);
+        cout << pts[i].lat << " " << pts[i].lon << " " << d << "\n";
+        ++cnt;
+      }
+    }
+    int setupcost, numsearches, searchcost, mincost, maxcost;
+    double mean, sd;
+    posset.Statistics(setupcost, numsearches, searchcost, mincost, maxcost,
+                      mean, sd);
+    int totcost = setupcost + searchcost, exhaustivecost = num * (num - 1) / 2;
+    cout
+      << "Number of distance calculations = " << totcost << "\n"
+      << "With an exhaustive search = " << exhaustivecost << "\n"
+      << "Ratio = " << double(totcost) / exhaustivecost << "\n"
+      << "Efficiency improvement = "
+      << 100 * (1 - double(totcost) / exhaustivecost) << "%\n";
+  }
+  catch (const exception& e) {
+    cerr << "Caught exception: " << e.what() << "\n";
+    return 1;
+  }
+}
diff --git a/examples/example-NormalGravity.cpp b/examples/example-NormalGravity.cpp
index 1a9efa5..aa6510b 100644
--- a/examples/example-NormalGravity.cpp
+++ b/examples/example-NormalGravity.cpp
@@ -11,7 +11,7 @@ using namespace GeographicLib;
 int main() {
   try {
     NormalGravity grav(Constants::WGS84_a(), Constants::WGS84_GM(),
-                       Constants::WGS84_omega(), Constants::WGS84_f(), 0);
+                       Constants::WGS84_omega(), Constants::WGS84_f());
     // Alternatively: const NormalGravity& grav = NormalGravity::WGS84();
     double lat = 27.99, h = 8820; // Mt Everest
     double gammay, gammaz;
@@ -22,5 +22,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-OSGB.cpp b/examples/example-OSGB.cpp
index 801dcea..1e27111 100644
--- a/examples/example-OSGB.cpp
+++ b/examples/example-OSGB.cpp
@@ -41,5 +41,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-PolarStereographic.cpp b/examples/example-PolarStereographic.cpp
index 8b499f0..072664e 100644
--- a/examples/example-PolarStereographic.cpp
+++ b/examples/example-PolarStereographic.cpp
@@ -35,5 +35,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-PolygonArea.cpp b/examples/example-PolygonArea.cpp
index bf848fb..ece25e4 100644
--- a/examples/example-PolygonArea.cpp
+++ b/examples/example-PolygonArea.cpp
@@ -26,5 +26,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Rhumb.cpp b/examples/example-Rhumb.cpp
index 048ffb0..869ae7e 100644
--- a/examples/example-Rhumb.cpp
+++ b/examples/example-Rhumb.cpp
@@ -33,5 +33,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-RhumbLine.cpp b/examples/example-RhumbLine.cpp
index 80b0729..58ac83f 100644
--- a/examples/example-RhumbLine.cpp
+++ b/examples/example-RhumbLine.cpp
@@ -40,5 +40,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-SphericalEngine.cpp b/examples/example-SphericalEngine.cpp
index 29fd7a3..52b3288 100644
--- a/examples/example-SphericalEngine.cpp
+++ b/examples/example-SphericalEngine.cpp
@@ -29,5 +29,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-SphericalHarmonic.cpp b/examples/example-SphericalHarmonic.cpp
index 213b2a7..989b550 100644
--- a/examples/example-SphericalHarmonic.cpp
+++ b/examples/example-SphericalHarmonic.cpp
@@ -26,5 +26,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-SphericalHarmonic1.cpp b/examples/example-SphericalHarmonic1.cpp
index fa3d9b8..111f5ce 100644
--- a/examples/example-SphericalHarmonic1.cpp
+++ b/examples/example-SphericalHarmonic1.cpp
@@ -30,5 +30,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-SphericalHarmonic2.cpp b/examples/example-SphericalHarmonic2.cpp
index cce1f49..d5c9fde 100644
--- a/examples/example-SphericalHarmonic2.cpp
+++ b/examples/example-SphericalHarmonic2.cpp
@@ -34,5 +34,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-TransverseMercator.cpp b/examples/example-TransverseMercator.cpp
index 65b0173..1c58f0e 100644
--- a/examples/example-TransverseMercator.cpp
+++ b/examples/example-TransverseMercator.cpp
@@ -35,5 +35,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-TransverseMercatorExact.cpp b/examples/example-TransverseMercatorExact.cpp
index fb70ab1..2f307de 100644
--- a/examples/example-TransverseMercatorExact.cpp
+++ b/examples/example-TransverseMercatorExact.cpp
@@ -35,5 +35,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-UTMUPS.cpp b/examples/example-UTMUPS.cpp
index 5c567fc..0146a73 100644
--- a/examples/example-UTMUPS.cpp
+++ b/examples/example-UTMUPS.cpp
@@ -39,5 +39,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/example-Utility.cpp b/examples/example-Utility.cpp
index 463f85e..6bc9684 100644
--- a/examples/example-Utility.cpp
+++ b/examples/example-Utility.cpp
@@ -18,5 +18,4 @@ int main() {
     cerr << "Caught exception: " << e.what() << "\n";
     return 1;
   }
-  return 0;
 }
diff --git a/examples/make-egmcof.cpp b/examples/make-egmcof.cpp
index 24295d6..d1ba441 100644
--- a/examples/make-egmcof.cpp
+++ b/examples/make-egmcof.cpp
@@ -42,5 +42,4 @@ int main() {
     cerr << "Caught unknown exception\n";
     return 1;
   }
-  return 0;
 }
diff --git a/include/GeographicLib/Accumulator.hpp b/include/GeographicLib/Accumulator.hpp
index c0502a9..78b5760 100644
--- a/include/GeographicLib/Accumulator.hpp
+++ b/include/GeographicLib/Accumulator.hpp
@@ -22,7 +22,7 @@ namespace GeographicLib {
    * precision of the sum is 106 bits or about 32 decimal places.
    *
    * The implementation follows J. R. Shewchuk,
-   * <a href="https://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
+   * <a href="https://doi.org/10.1007/PL00009321"> Adaptive Precision
    * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
    * Discrete & Computational Geometry 18(3) 305--363 (1997).
    *
diff --git a/include/GeographicLib/AlbersEqualArea.hpp b/include/GeographicLib/AlbersEqualArea.hpp
index 21624e7..9148f44 100644
--- a/include/GeographicLib/AlbersEqualArea.hpp
+++ b/include/GeographicLib/AlbersEqualArea.hpp
@@ -2,7 +2,7 @@
  * \file AlbersEqualArea.hpp
  * \brief Header for GeographicLib::AlbersEqualArea class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -88,7 +88,7 @@ namespace GeographicLib {
     //   W. M. Kahan and R. J. Fateman,
     //   Symbolic computation of divided differences,
     //   SIGSAM Bull. 33(3), 7-28 (1999)
-    //   https://dx.doi.org/10.1145/334714.334716
+    //   https://doi.org/10.1145/334714.334716
     //   http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
     //
     // General rules
@@ -227,7 +227,7 @@ namespace GeographicLib {
      *
      * The latitude origin is given by AlbersEqualArea::LatitudeOrigin().  No
      * false easting or northing is added.  The value of \e lon returned is in
-     * the range [−180°, 180°).  The value of \e lat returned is
+     * the range [−180°, 180°].  The value of \e lat returned is
      * in the range [−90°, 90°].  If the input point is outside
      * the legal projected space the nearest pole is returned.
      **********************************************************************/
diff --git a/include/GeographicLib/AzimuthalEquidistant.hpp b/include/GeographicLib/AzimuthalEquidistant.hpp
index 8d08631..6c5add0 100644
--- a/include/GeographicLib/AzimuthalEquidistant.hpp
+++ b/include/GeographicLib/AzimuthalEquidistant.hpp
@@ -2,7 +2,7 @@
  * \file AzimuthalEquidistant.hpp
  * \brief Header for GeographicLib::AzimuthalEquidistant class
  *
- * Copyright (c) Charles Karney (2009-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -89,7 +89,7 @@ namespace GeographicLib {
      *
      * \e lat0 should be in the range [−90°, 90°].  \e lat will
      * be in the range [−90°, 90°] and \e lon will be in the
-     * range [−180°, 180°).  The scale of the projection is 1 in
+     * range [−180°, 180°].  The scale of the projection is 1 in
      * the "radial" direction, \e azi clockwise from true north, and is 1/\e rk
      * in the direction perpendicular to this.  A call to Reverse followed by a
      * call to Forward will return the original (\e x, \e y) (to roundoff) only
diff --git a/include/GeographicLib/Config.h b/include/GeographicLib/Config.h
index 69d9eee..8033012 100644
--- a/include/GeographicLib/Config.h
+++ b/include/GeographicLib/Config.h
@@ -1,8 +1,8 @@
 // This will be overwritten by ./configure
 
-#define GEOGRAPHICLIB_VERSION_STRING "1.46"
+#define GEOGRAPHICLIB_VERSION_STRING "1.47"
 #define GEOGRAPHICLIB_VERSION_MAJOR 1
-#define GEOGRAPHICLIB_VERSION_MINOR 46
+#define GEOGRAPHICLIB_VERSION_MINOR 47
 #define GEOGRAPHICLIB_VERSION_PATCH 0
 
 // Undefine HAVE_LONG_DOUBLE if this type is unknown to the compiler
diff --git a/include/GeographicLib/Config.h.in b/include/GeographicLib/Config.h.in
index 909cdc0..9e8ec9b 100644
--- a/include/GeographicLib/Config.h.in
+++ b/include/GeographicLib/Config.h.in
@@ -18,8 +18,8 @@
 // Constants.hpp.  In this case, the appropriate value (0 or 1) for
 // GEOGRAPHICLIB_SHARED_LIB must be specified when compiling any program that
 // includes Geographic.hpp.  This is done automatically if GeographicLib and
-// the the user's code were built with cmake version 2.8.11 (which introduced
-// the command target_compile_definitions) or later.
+// the user's code were built with cmake version 2.8.11 (which introduced the
+// command target_compile_definitions) or later.
 #if !defined(GEOGRAPHICLIB_SHARED_LIB)
 #define GEOGRAPHICLIB_SHARED_LIB @GEOGRAPHICLIB_LIB_TYPE_VAL@
 #endif
diff --git a/include/GeographicLib/Constants.hpp b/include/GeographicLib/Constants.hpp
index 6bfa8f8..47d3349 100644
--- a/include/GeographicLib/Constants.hpp
+++ b/include/GeographicLib/Constants.hpp
@@ -2,7 +2,7 @@
  * \file Constants.hpp
  * \brief Header for GeographicLib::Constants class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -90,6 +90,21 @@
 #  define GEOGRAPHICLIB_EXPORT
 #endif
 
+// Use GEOGRAPHICLIB_DEPRECATED to mark functions, types or variables as
+// deprecated.  Code inspired by Apache Subversion's svn_types.h file (via
+// MPFR).
+#if defined(__GNUC__)
+#  if __GNUC__ > 4
+#    define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated(msg)))
+#  else
+#    define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated))
+#  endif
+#elif defined(_MSC_VER) && _MSC_VER >= 1300
+#  define GEOGRAPHICLIB_DEPRECATED(msg) __declspec(deprecated(msg))
+#else
+#  define GEOGRAPHICLIB_DEPRECATED(msg)
+#endif
+
 #include <stdexcept>
 #include <string>
 #include <GeographicLib/Math.hpp>
diff --git a/include/GeographicLib/DMS.hpp b/include/GeographicLib/DMS.hpp
index 2972285..e14bb43 100644
--- a/include/GeographicLib/DMS.hpp
+++ b/include/GeographicLib/DMS.hpp
@@ -2,7 +2,7 @@
  * \file DMS.hpp
  * \brief Header for GeographicLib::DMS class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -170,12 +170,12 @@ namespace GeographicLib {
      * - <i>ILLEGAL</i> (the exception thrown explains the problem)
      *   - 70:01:15W+0:0:15N, W70:01:15+W0:0:15
      *
-     * <b>WARNING:</b> "Exponential" notation is not recognized.  Thus
+     * \warning The "exponential" notation is not recognized.  Thus
      * <code>7.0E1</code> is illegal, while <code>7.0E+1</code> is parsed as
      * <code>(7.0E) + (+1)</code>, yielding the same result as
      * <code>8.0E</code>.
      *
-     * <b>NOTE:</b> At present, all the string handling in the C++
+     * \note At present, all the string handling in the C++
      * implementation %GeographicLib is with 8-bit characters.  The support for
      * unicode symbols for degrees, minutes, and seconds is therefore via the
      * <a href="https://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoding.  (The
@@ -270,7 +270,7 @@ namespace GeographicLib {
      * @exception GeographicErr if \e azistr is malformed.
      * @exception GeographicErr if \e azistr includes a N/S designator.
      * @return azimuth (degrees) reduced to the range [−180°,
-     *   180°).
+     *   180°].
      *
      * A hemisphere designator E/W can be used; the result is multiplied by
      * −1 if W is present.
diff --git a/include/GeographicLib/EllipticFunction.hpp b/include/GeographicLib/EllipticFunction.hpp
index cdf73a6..b7fb56c 100644
--- a/include/GeographicLib/EllipticFunction.hpp
+++ b/include/GeographicLib/EllipticFunction.hpp
@@ -2,7 +2,7 @@
  * \file EllipticFunction.hpp
  * \brief Header for GeographicLib::EllipticFunction class
  *
- * Copyright (c) Charles Karney (2008-2012) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -36,21 +36,21 @@ namespace GeographicLib {
    * In geodesic applications, it is convenient to separate the incomplete
    * integrals into secular and periodic components, e.g.,
    * \f[
-   *   E(\phi, k) = (2 E(\phi) / \pi) [ \phi + \delta E(\phi, k) ]
+   *   E(\phi, k) = (2 E(k) / \pi) [ \phi + \delta E(\phi, k) ]
    * \f]
    * where δ\e E(φ, \e k) is an odd periodic function with period
    * π.
    *
    * The computation of the elliptic integrals uses the algorithms given in
    * - B. C. Carlson,
-   *   <a href="https://dx.doi.org/10.1007/BF02198293"> Computation of real or
+   *   <a href="https://doi.org/10.1007/BF02198293"> Computation of real or
    *   complex elliptic integrals</a>, Numerical Algorithms 10, 13--26 (1995)
    * .
    * with the additional optimizations given in http://dlmf.nist.gov/19.36.i.
    * The computation of the Jacobi elliptic functions uses the algorithm given
    * in
    * - R. Bulirsch,
-   *   <a href="https://dx.doi.org/10.1007/BF01397975"> Numerical Calculation of
+   *   <a href="https://doi.org/10.1007/BF01397975"> Numerical Calculation of
    *   Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik 7,
    *   78--90 (1965).
    * .
@@ -73,10 +73,11 @@ namespace GeographicLib {
      * Constructor specifying the modulus and parameter.
      *
      * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
-     *   <i>k</i><sup>2</sup> must lie in (-∞, 1).  (No checking is
-     *   done.)
+     *   <i>k</i><sup>2</sup> must lie in (−∞, 1].
      * @param[in] alpha2 the parameter α<sup>2</sup>.
-     *   α<sup>2</sup> must lie in (-∞, 1).  (No checking is done.)
+     *   α<sup>2</sup> must lie in (−∞, 1].
+     * @exception GeographicErr if \e k2 or \e alpha2 is out of its legal
+     *   range.
      *
      * If only elliptic integrals of the first and second kinds are needed,
      * then set α<sup>2</sup> = 0 (the default value); in this case, we
@@ -91,14 +92,15 @@ namespace GeographicLib {
      * Constructor specifying the modulus and parameter and their complements.
      *
      * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
-     *   <i>k</i><sup>2</sup> must lie in (-∞, 1).  (No checking is
-     *   done.)
+     *   <i>k</i><sup>2</sup> must lie in (−∞, 1].
      * @param[in] alpha2 the parameter α<sup>2</sup>.
-     *   α<sup>2</sup> must lie in (-∞, 1).  (No checking is done.)
+     *   α<sup>2</sup> must lie in (−∞, 1].
      * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
-     *   1 − <i>k</i><sup>2</sup>.
+     *   1 − <i>k</i><sup>2</sup>.  This must lie in [0, ∞).
      * @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1
-     *   − α<sup>2</sup>.
+     *   − α<sup>2</sup>.  This must lie in [0, ∞).
+     * @exception GeographicErr if \e k2, \e alpha2, \e kp2, or \e alphap2 is
+     *   out of its legal range.
      *
      * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
      * = 1.  (No checking is done that these conditions are met.)  This
@@ -112,10 +114,12 @@ namespace GeographicLib {
      * Reset the modulus and parameter.
      *
      * @param[in] k2 the new value of square of the modulus
-     *   <i>k</i><sup>2</sup> which must lie in (-∞, 1).  (No checking is
+     *   <i>k</i><sup>2</sup> which must lie in (−∞, ].
      *   done.)
      * @param[in] alpha2 the new value of parameter α<sup>2</sup>.
-     *   α<sup>2</sup> must lie in (-∞, 1).  (No checking is done.)
+     *   α<sup>2</sup> must lie in (−∞, 1].
+     * @exception GeographicErr if \e k2 or \e alpha2 is out of its legal
+     *   range.
      **********************************************************************/
     void Reset(real k2 = 0, real alpha2 = 0)
     { Reset(k2, alpha2, 1 - k2, 1 - alpha2); }
@@ -124,14 +128,15 @@ namespace GeographicLib {
      * Reset the modulus and parameter supplying also their complements.
      *
      * @param[in] k2 the square of the modulus <i>k</i><sup>2</sup>.
-     *   <i>k</i><sup>2</sup> must lie in (-∞, 1).  (No checking is
-     *   done.)
+     *   <i>k</i><sup>2</sup> must lie in (−∞, 1].
      * @param[in] alpha2 the parameter α<sup>2</sup>.
-     *   α<sup>2</sup> must lie in (-∞, 1).  (No checking is done.)
+     *   α<sup>2</sup> must lie in (−∞, 1].
      * @param[in] kp2 the complementary modulus squared <i>k'</i><sup>2</sup> =
-     *   1 − <i>k</i><sup>2</sup>.
+     *   1 − <i>k</i><sup>2</sup>.  This must lie in [0, ∞).
      * @param[in] alphap2 the complementary parameter α'<sup>2</sup> = 1
-     *   − α<sup>2</sup>.
+     *   − α<sup>2</sup>.  This must lie in [0, ∞).
+     * @exception GeographicErr if \e k2, \e alpha2, \e kp2, or \e alphap2 is
+     *   out of its legal range.
      *
      * The arguments must satisfy \e k2 + \e kp2 = 1 and \e alpha2 + \e alphap2
      * = 1.  (No checking is done that these conditions are met.)  This
@@ -186,7 +191,7 @@ namespace GeographicLib {
     /**
      * The complete integral of the second kind.
      *
-     * @return \e E(\e k)
+     * @return \e E(\e k).
      *
      * \e E(\e k) is defined in http://dlmf.nist.gov/19.2.E5
      * \f[
@@ -218,7 +223,7 @@ namespace GeographicLib {
     /**
      * The complete integral of the third kind.
      *
-     * @return Π(α<sup>2</sup>, \e k)
+     * @return Π(α<sup>2</sup>, \e k).
      *
      * Π(α<sup>2</sup>, \e k) is defined in
      * http://dlmf.nist.gov/19.2.E7
@@ -232,7 +237,7 @@ namespace GeographicLib {
     /**
      * Legendre's complete geodesic longitude integral.
      *
-     * @return \e G(α<sup>2</sup>, \e k)
+     * @return \e G(α<sup>2</sup>, \e k).
      *
      * \e G(α<sup>2</sup>, \e k) is given by
      * \f[
@@ -245,7 +250,7 @@ namespace GeographicLib {
     /**
      * Cayley's complete geodesic longitude difference integral.
      *
-     * @return \e H(α<sup>2</sup>, \e k)
+     * @return \e H(α<sup>2</sup>, \e k).
      *
      * \e H(α<sup>2</sup>, \e k) is given by
      * \f[
@@ -394,10 +399,10 @@ namespace GeographicLib {
      * The incomplete integral of the first kind in terms of Jacobi elliptic
      * functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return \e F(φ, \e k) as though φ ∈ (−π, π].
      **********************************************************************/
     Math::real F(real sn, real cn, real dn) const;
@@ -406,10 +411,10 @@ namespace GeographicLib {
      * The incomplete integral of the second kind in terms of Jacobi elliptic
      * functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return \e E(φ, \e k) as though φ ∈ (−π, π].
      **********************************************************************/
     Math::real E(real sn, real cn, real dn) const;
@@ -418,10 +423,10 @@ namespace GeographicLib {
      * The incomplete integral of the third kind in terms of Jacobi elliptic
      * functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return Π(φ, α<sup>2</sup>, \e k) as though φ ∈
      *   (−π, π].
      **********************************************************************/
@@ -431,10 +436,10 @@ namespace GeographicLib {
      * Jahnke's incomplete elliptic integral in terms of Jacobi elliptic
      * functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return \e D(φ, \e k) as though φ ∈ (−π, π].
      **********************************************************************/
     Math::real D(real sn, real cn, real dn) const;
@@ -443,10 +448,10 @@ namespace GeographicLib {
      * Legendre's geodesic longitude integral in terms of Jacobi elliptic
      * functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return \e G(φ, α<sup>2</sup>, \e k) as though φ ∈
      *   (−π, π].
      **********************************************************************/
@@ -456,10 +461,10 @@ namespace GeographicLib {
      * Cayley's geodesic longitude difference integral in terms of Jacobi
      * elliptic functions.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return \e H(φ, α<sup>2</sup>, \e k) as though φ ∈
      *   (−π, π].
      **********************************************************************/
@@ -472,82 +477,82 @@ namespace GeographicLib {
     /**
      * The periodic incomplete integral of the first kind.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return the periodic function π \e F(φ, \e k) / (2 \e K(\e k)) -
-     *   φ
+     *   φ.
      **********************************************************************/
     Math::real deltaF(real sn, real cn, real dn) const;
 
     /**
      * The periodic incomplete integral of the second kind.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return the periodic function π \e E(φ, \e k) / (2 \e E(\e k)) -
-     *   φ
+     *   φ.
      **********************************************************************/
     Math::real deltaE(real sn, real cn, real dn) const;
 
     /**
      * The periodic inverse of the incomplete integral of the second kind.
      *
-     * @param[in] stau = sinτ
-     * @param[in] ctau = sinτ
+     * @param[in] stau = sinτ.
+     * @param[in] ctau = sinτ.
      * @return the periodic function <i>E</i><sup>−1</sup>(τ (2 \e
-     *   E(\e k)/π), \e k) - τ
+     *   E(\e k)/π), \e k) - τ.
      **********************************************************************/
     Math::real deltaEinv(real stau, real ctau) const;
 
     /**
      * The periodic incomplete integral of the third kind.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
-     * @return the periodic function π Π(φ, \e k) / (2 Π(\e k)) -
-     *   φ
+     *   sin<sup>2</sup>φ).
+     * @return the periodic function π Π(φ, α<sup>2</sup>,
+     *   \e k) / (2 Π(α<sup>2</sup>, \e k)) - φ.
      **********************************************************************/
     Math::real deltaPi(real sn, real cn, real dn) const;
 
     /**
      * The periodic Jahnke's incomplete elliptic integral.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return the periodic function π \e D(φ, \e k) / (2 \e D(\e k)) -
-     *   φ
+     *   φ.
      **********************************************************************/
     Math::real deltaD(real sn, real cn, real dn) const;
 
     /**
      * Legendre's periodic geodesic longitude integral.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return the periodic function π \e G(φ, \e k) / (2 \e G(\e k)) -
-     *   φ
+     *   φ.
      **********************************************************************/
     Math::real deltaG(real sn, real cn, real dn) const;
 
     /**
      * Cayley's periodic geodesic longitude difference integral.
      *
-     * @param[in] sn = sinφ
-     * @param[in] cn = cosφ
+     * @param[in] sn = sinφ.
+     * @param[in] cn = cosφ.
      * @param[in] dn = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      * @return the periodic function π \e H(φ, \e k) / (2 \e H(\e k)) -
-     *   φ
+     *   φ.
      **********************************************************************/
     Math::real deltaH(real sn, real cn, real dn) const;
     ///@}
@@ -568,10 +573,10 @@ namespace GeographicLib {
     /**
      * The Δ amplitude function.
      *
-     * @param[in] sn sinφ
-     * @param[in] cn cosφ
+     * @param[in] sn sinφ.
+     * @param[in] cn cosφ.
      * @return Δ = sqrt(1 − <i>k</i><sup>2</sup>
-     *   sin<sup>2</sup>φ)
+     *   sin<sup>2</sup>φ).
      **********************************************************************/
     Math::real Delta(real sn, real cn) const {
       using std::sqrt;
@@ -588,7 +593,7 @@ namespace GeographicLib {
      * @param[in] x
      * @param[in] y
      * @param[in] z
-     * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e z)
+     * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e z).
      *
      * <i>R</i><sub><i>F</i></sub> is defined in http://dlmf.nist.gov/19.16.E1
      * \f[ R_F(x, y, z) = \frac12
@@ -604,7 +609,7 @@ namespace GeographicLib {
      *
      * @param[in] x
      * @param[in] y
-     * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, 0)
+     * @return <i>R</i><sub><i>F</i></sub>(\e x, \e y, 0).
      **********************************************************************/
     static real RF(real x, real y);
 
@@ -615,7 +620,7 @@ namespace GeographicLib {
      * @param[in] x
      * @param[in] y
      * @return <i>R</i><sub><i>C</i></sub>(\e x, \e y) =
-     *   <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e y)
+     *   <i>R</i><sub><i>F</i></sub>(\e x, \e y, \e y).
      *
      * <i>R</i><sub><i>C</i></sub> is defined in http://dlmf.nist.gov/19.2.E17
      * \f[ R_C(x, y) = \frac12
@@ -629,7 +634,7 @@ namespace GeographicLib {
      * @param[in] x
      * @param[in] y
      * @param[in] z
-     * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, \e z)
+     * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, \e z).
      *
      * <i>R</i><sub><i>G</i></sub> is defined in Carlson, eq 1.5
      * \f[ R_G(x, y, z) = \frac14
@@ -649,7 +654,7 @@ namespace GeographicLib {
      *
      * @param[in] x
      * @param[in] y
-     * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, 0)
+     * @return <i>R</i><sub><i>G</i></sub>(\e x, \e y, 0).
      **********************************************************************/
     static real RG(real x, real y);
 
@@ -660,7 +665,7 @@ namespace GeographicLib {
      * @param[in] y
      * @param[in] z
      * @param[in] p
-     * @return <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e p)
+     * @return <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e p).
      *
      * <i>R</i><sub><i>J</i></sub> is defined in http://dlmf.nist.gov/19.16.E2
      * \f[ R_J(x, y, z, p) = \frac32
@@ -676,7 +681,7 @@ namespace GeographicLib {
      * @param[in] y
      * @param[in] z
      * @return <i>R</i><sub><i>D</i></sub>(\e x, \e y, \e z) =
-     *   <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e z)
+     *   <i>R</i><sub><i>J</i></sub>(\e x, \e y, \e z, \e z).
      *
      * <i>R</i><sub><i>D</i></sub> is defined in http://dlmf.nist.gov/19.16.E5
      * \f[ R_D(x, y, z) = \frac32
diff --git a/include/GeographicLib/GeoCoords.hpp b/include/GeographicLib/GeoCoords.hpp
index 09f8590..4ea0808 100644
--- a/include/GeographicLib/GeoCoords.hpp
+++ b/include/GeographicLib/GeoCoords.hpp
@@ -2,7 +2,7 @@
  * \file GeoCoords.hpp
  * \brief Header for GeographicLib::GeoCoords class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -151,7 +151,7 @@ namespace GeographicLib {
      * that -1:30-0:0:15 is parsed as (-1:30) + (-0:0:15) = −(1+30/60)
      * − (15/3600).  Latitudes must be in the range [−90°,
      * 90°].  Internally longitudes are reduced to the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * <b>UTM/UPS parsing</b>: For UTM zones (−80° ≤ Lat <
      * 84°), the zone designator is made up of a zone number (for 1 to 60)
@@ -431,7 +431,8 @@ namespace GeographicLib {
      * coordinate at precision −2 (100m) is 38SMB441847 and not
      * 38SMB442848.  \e prec specifies the precision of the MGRS string as
      * follows:
-     * - prec = −5 (min), 100km
+     * - prec = −6 (min), only the grid zone is returned, e.g., 38S
+     * - prec = −5, 100km, e.g., 38SMB
      * - prec = −4, 10km
      * - prec = −3, 1km
      * - prec = −2, 100m
diff --git a/include/GeographicLib/Geocentric.hpp b/include/GeographicLib/Geocentric.hpp
index 7772153..b8fec88 100644
--- a/include/GeographicLib/Geocentric.hpp
+++ b/include/GeographicLib/Geocentric.hpp
@@ -2,7 +2,7 @@
  * \file Geocentric.hpp
  * \brief Header for GeographicLib::Geocentric class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -29,7 +29,7 @@ namespace GeographicLib {
    * The conversion from geographic to geocentric coordinates is
    * straightforward.  For the reverse transformation we use
    * - H. Vermeille,
-   *   <a href="https://dx.doi.org/10.1007/s00190-002-0273-6"> Direct
+   *   <a href="https://doi.org/10.1007/s00190-002-0273-6"> Direct
    *   transformation from geocentric coordinates to geodetic coordinates</a>,
    *   J. Geodesy 76, 451--454 (2002).
    * .
@@ -37,15 +37,15 @@ namespace GeographicLib {
    * results for all finite inputs (even if \e h is infinite).  The changes are
    * described in Appendix B of
    * - C. F. F. Karney,
-   *   <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+   *   <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
    *   on an ellipsoid of revolution</a>,
    *   Feb. 2011;
    *   preprint
-   *   <a href="http://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
+   *   <a href="https://arxiv.org/abs/1102.1215v1">arxiv:1102.1215v1</a>.
    * .
    * Vermeille similarly updated his method in
    * - H. Vermeille,
-   *   <a href="https://dx.doi.org/10.1007/s00190-010-0419-x">
+   *   <a href="https://doi.org/10.1007/s00190-010-0419-x">
    *   An analytical method to transform geocentric into
    *   geodetic coordinates</a>, J. Geodesy 85, 105--117 (2011).
    * .
@@ -189,7 +189,7 @@ namespace GeographicLib {
      * returned.  The value of \e h returned satisfies \e h ≥ − \e a
      * (1 − <i>e</i><sup>2</sup>) / sqrt(1 − <i>e</i><sup>2</sup>
      * sin<sup>2</sup>\e lat).  The value of \e lon returned is in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      **********************************************************************/
     void Reverse(real X, real Y, real Z, real& lat, real& lon, real& h)
       const {
diff --git a/include/GeographicLib/Geodesic.hpp b/include/GeographicLib/Geodesic.hpp
index 52175ec..d3bfa90 100644
--- a/include/GeographicLib/Geodesic.hpp
+++ b/include/GeographicLib/Geodesic.hpp
@@ -2,7 +2,7 @@
  * \file Geodesic.hpp
  * \brief Header for GeographicLib::Geodesic class
  *
- * Copyright (c) Charles Karney (2009-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -132,7 +132,7 @@ namespace GeographicLib {
    *
    * The calculations are accurate to better than 15 nm (15 nanometers) for the
    * WGS84 ellipsoid.  See Sec. 9 of
-   * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+   * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
    * details.  The algorithms used by this class are based on series expansions
    * using the flattening \e f as a small parameter.  These are only accurate
    * for |<i>f</i>| < 0.02; however reasonably accurate results will be
@@ -151,10 +151,10 @@ namespace GeographicLib {
    *
    * The algorithms are described in
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
@@ -227,7 +227,7 @@ namespace GeographicLib {
                   real salp1, real calp1, real slam120, real clam120,
                   real& salp2, real& calp2, real& sig12,
                   real& ssig1, real& csig1, real& ssig2, real& csig2,
-                  real& eps, real& somg12, real& comg12,
+                  real& eps, real& domg12,
                   bool diffp, real& dlam12, real Ca[]) const;
     real GenInverse(real lat1, real lon1, real lat2, real lon2,
                     unsigned outmask, real& s12,
@@ -362,7 +362,7 @@ namespace GeographicLib {
      *
      * \e lat1 should be in the range [−90°, 90°].  The values of
      * \e lon2 and \e azi2 returned are in the range [−180°,
-     * 180°).
+     * 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
@@ -475,7 +475,7 @@ namespace GeographicLib {
      *
      * \e lat1 should be in the range [−90°, 90°].  The values of
      * \e lon2 and \e azi2 returned are in the range [−180°,
-     * 180°).
+     * 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
@@ -613,7 +613,7 @@ namespace GeographicLib {
      * - \e outmask |= Geodesic::AREA for the area \e S12;
      * - \e outmask |= Geodesic::ALL for all of the above;
      * - \e outmask |= Geodesic::LONG_UNROLL to unroll \e lon2 instead of
-     *   wrapping it into the range [−180°, 180°).
+     *   wrapping it into the range [−180°, 180°].
      * .
      * The function value \e a12 is always computed and returned and this
      * equals \e s12_a12 is \e arcmode is true.  If \e outmask includes
@@ -655,7 +655,7 @@ namespace GeographicLib {
      *
      * \e lat1 and \e lat2 should be in the range [−90°, 90°].
      * The values of \e azi1 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
diff --git a/include/GeographicLib/GeodesicExact.hpp b/include/GeographicLib/GeodesicExact.hpp
index 4799c09..2eafecb 100644
--- a/include/GeographicLib/GeodesicExact.hpp
+++ b/include/GeographicLib/GeodesicExact.hpp
@@ -2,7 +2,7 @@
  * \file GeodesicExact.hpp
  * \brief Header for GeographicLib::GeodesicExact class
  *
- * Copyright (c) Charles Karney (2012-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2012-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -33,7 +33,7 @@ namespace GeographicLib {
    * for \e f ∈ [-0.01, 0.01].  The GeodesicExact class computes the
    * ellitpic integrals directly and so provides a solution which is valid for
    * all \e f.  However, in practice, its use should be limited to about
-   * <i>b</i>/\e a ∈ [0.01, 100] or \e f ∈ [-99, 0.99].
+   * <i>b</i>/\e a ∈ [0.01, 100] or \e f ∈ [−99, 0.99].
    *
    * For the WGS84 ellipsoid, these classes are 2--3 times \e slower than the
    * series solution and 2--3 times \e less \e accurate (because it's less easy
@@ -125,7 +125,7 @@ namespace GeographicLib {
                   real& salp2, real& calp2, real& sig12,
                   real& ssig1, real& csig1, real& ssig2, real& csig2,
                   EllipticFunction& E,
-                  real& somg12, real& comg12, bool diffp, real& dlam12) const;
+                  real& domg12, bool diffp, real& dlam12) const;
     real GenInverse(real lat1, real lon1, real lat2, real lon2,
                     unsigned outmask, real& s12,
                     real& salp1, real& calp1, real& salp2, real& calp2,
@@ -258,7 +258,7 @@ namespace GeographicLib {
      *
      * \e lat1 should be in the range [−90°, 90°].  The values of
      * \e lon2 and \e azi2 returned are in the range [−180°,
-     * 180°).
+     * 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
@@ -371,7 +371,7 @@ namespace GeographicLib {
      *
      * \e lat1 should be in the range [−90°, 90°].  The values of
      * \e lon2 and \e azi2 returned are in the range [−180°,
-     * 180°).
+     * 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
@@ -509,7 +509,7 @@ namespace GeographicLib {
      * - \e outmask |= GeodesicExact::AREA for the area \e S12;
      * - \e outmask |= GeodesicExact::ALL for all of the above;
      * - \e outmask |= GeodesicExact::LONG_UNROLL to unroll \e lon2 instead of
-     *   wrapping it into the range [−180°, 180°).
+     *   wrapping it into the range [−180°, 180°].
      * .
      * The function value \e a12 is always computed and returned and this
      * equals \e s12_a12 is \e arcmode is true.  If \e outmask includes
@@ -551,7 +551,7 @@ namespace GeographicLib {
      *
      * \e lat1 and \e lat2 should be in the range [−90°, 90°].
      * The values of \e azi1 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * If either point is at a pole, the azimuth is defined by keeping the
      * longitude fixed, writing \e lat = ±(90° − ε),
diff --git a/include/GeographicLib/GeodesicLine.hpp b/include/GeographicLib/GeodesicLine.hpp
index 07abcf2..868daab 100644
--- a/include/GeographicLib/GeodesicLine.hpp
+++ b/include/GeographicLib/GeodesicLine.hpp
@@ -41,7 +41,7 @@ namespace GeographicLib {
    *
    * The calculations are accurate to better than 15 nm (15 nanometers).  See
    * Sec. 9 of
-   * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+   * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
    * details.  The algorithms used by this class are based on series expansions
    * using the flattening \e f as a small parameter.  These are only accurate
    * for |<i>f</i>| < 0.02; however reasonably accurate results will be
@@ -50,10 +50,10 @@ namespace GeographicLib {
    *
    * The algorithms are described in
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
@@ -264,7 +264,7 @@ namespace GeographicLib {
      * @return \e a12 arc length from point 1 to point 2 (degrees).
      *
      * The values of \e lon2 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * The GeodesicLine object \e must have been constructed with \e caps |=
      * GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no
@@ -381,7 +381,7 @@ namespace GeographicLib {
      *   GeodesicLine::AREA.
      *
      * The values of \e lon2 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * Requesting a value which the GeodesicLine object is not capable of
      * computing is not an error; the corresponding argument will not be
@@ -522,7 +522,7 @@ namespace GeographicLib {
      * - \e outmask |= GeodesicLine::AREA for the area \e S12;
      * - \e outmask |= GeodesicLine::ALL for all of the above;
      * - \e outmask |= GeodesicLine::LONG_UNROLL to unroll \e lon2 instead of
-     *   reducing it into the range [−180°, 180°).
+     *   reducing it into the range [−180°, 180°].
      * .
      * Requesting a value which the GeodesicLine object is not capable of
      * computing is not an error; the corresponding argument will not be
diff --git a/include/GeographicLib/GeodesicLineExact.hpp b/include/GeographicLib/GeodesicLineExact.hpp
index 7a19a1e..31d66c1 100644
--- a/include/GeographicLib/GeodesicLineExact.hpp
+++ b/include/GeographicLib/GeodesicLineExact.hpp
@@ -227,7 +227,7 @@ namespace GeographicLib {
      * @return \e a12 arc length from point 1 to point 2 (degrees).
      *
      * The values of \e lon2 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * The GeodesicLineExact object \e must have been constructed with \e caps
      * |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and
@@ -344,7 +344,7 @@ namespace GeographicLib {
      *   GeodesicLineExact::AREA.
      *
      * The values of \e lon2 and \e azi2 returned are in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * Requesting a value which the GeodesicLineExact object is not capable of
      * computing is not an error; the corresponding argument will not be
@@ -486,7 +486,7 @@ namespace GeographicLib {
      * - \e outmask |= GeodesicLineExact::AREA for the area \e S12;
      * - \e outmask |= GeodesicLineExact::ALL for all of the above;
      * - \e outmask |= GeodesicLineExact::LONG_UNROLL to unroll \e lon2 instead
-     *   of wrapping it into the range [−180°, 180°).
+     *   of wrapping it into the range [−180°, 180°].
      * .
      * Requesting a value which the GeodesicLineExact object is not capable of
      * computing is not an error; the corresponding argument will not be
diff --git a/include/GeographicLib/Gnomonic.hpp b/include/GeographicLib/Gnomonic.hpp
index 53b9068..75ca938 100644
--- a/include/GeographicLib/Gnomonic.hpp
+++ b/include/GeographicLib/Gnomonic.hpp
@@ -2,7 +2,7 @@
  * \file Gnomonic.hpp
  * \brief Header for GeographicLib::Gnomonic class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -22,10 +22,10 @@ namespace GeographicLib {
    * %Gnomonic projection centered at an arbitrary position \e C on the
    * ellipsoid.  This projection is derived in Section 8 of
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
    *   geod-addenda.html</a>.
@@ -68,7 +68,7 @@ namespace GeographicLib {
    * The conversions all take place using a Geodesic object (by default
    * Geodesic::WGS84()).  For more information on geodesics see \ref geodesic.
    *
-   * <b>CAUTION:</b> The definition of this projection for a sphere is
+   * \warning The definition of this projection for a sphere is
    * standard.  However, there is no standard for how it should be extended to
    * an ellipsoid.  The choices are:
    * - Declare that the projection is undefined for an ellipsoid.
@@ -153,7 +153,7 @@ namespace GeographicLib {
      *
      * \e lat0 should be in the range [−90°, 90°].  \e lat will
      * be in the range [−90°, 90°] and \e lon will be in the
-     * range [−180°, 180°).  The scale of the projection is
+     * range [−180°, 180°].  The scale of the projection is
      * 1/<i>rk</i><sup>2</sup> in the "radial" direction, \e azi clockwise from
      * true north, and is 1/\e rk in the direction perpendicular to this.  Even
      * though all inputs should return a valid \e lat and \e lon, it's possible
diff --git a/include/GeographicLib/GravityCircle.hpp b/include/GeographicLib/GravityCircle.hpp
index 7bd94e0..5427256 100644
--- a/include/GeographicLib/GravityCircle.hpp
+++ b/include/GeographicLib/GravityCircle.hpp
@@ -2,7 +2,7 @@
  * \file GravityCircle.hpp
  * \brief Header for GeographicLib::GravityCircle class
  *
- * Copyright (c) Charles Karney (2011-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -117,7 +117,8 @@ namespace GeographicLib {
      *   (m s<sup>−2</sup>).
      * @param[out] gz the upward component of the acceleration
      *   (m s<sup>−2</sup>); this is usually negative.
-     * @return \e W the sum of the gravitational and centrifugal potentials.
+     * @return \e W the sum of the gravitational and centrifugal potentials
+     *   (m<sup>2</sup> s<sup>−2</sup>).
      *
      * The function includes the effects of the earth's rotation.
      **********************************************************************/
@@ -133,7 +134,8 @@ namespace GeographicLib {
      *   (m s<sup>−2</sup>).
      * @param[out] deltaz the upward component of the disturbance vector
      *   (m s<sup>−2</sup>).
-     * @return \e T the corresponding disturbing potential.
+     * @return \e T the corresponding disturbing potential
+     *   (m<sup>2</sup> s<sup>−2</sup>).
      **********************************************************************/
     Math::real Disturbance(real lon, real& deltax, real& deltay, real& deltaz)
       const;
diff --git a/include/GeographicLib/GravityModel.hpp b/include/GeographicLib/GravityModel.hpp
index 5a1662b..db1a095 100644
--- a/include/GeographicLib/GravityModel.hpp
+++ b/include/GeographicLib/GravityModel.hpp
@@ -2,8 +2,8 @@
  * \file GravityModel.hpp
  * \brief Header for GeographicLib::GravityModel class
  *
- * Copyright (c) Charles Karney (2011) <charles at karney.com> and licensed under
- * the MIT/X11 License.  For more information, see
+ * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
+ * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
 
@@ -200,7 +200,8 @@ namespace GeographicLib {
      *   (m s<sup>−2</sup>).
      * @param[out] gz the upward component of the acceleration
      *   (m s<sup>−2</sup>); this is usually negative.
-     * @return \e W the sum of the gravitational and centrifugal potentials.
+     * @return \e W the sum of the gravitational and centrifugal potentials
+     *   (m<sup>2</sup> s<sup>−2</sup>).
      *
      * The function includes the effects of the earth's rotation.
      **********************************************************************/
@@ -220,7 +221,8 @@ namespace GeographicLib {
      *   (m s<sup>−2</sup>).
      * @param[out] deltaz the upward component of the disturbance vector
      *   (m s<sup>−2</sup>).
-     * @return \e T the corresponding disturbing potential.
+     * @return \e T the corresponding disturbing potential
+     *   (m<sup>2</sup> s<sup>−2</sup>).
      **********************************************************************/
     Math::real Disturbance(real lat, real lon, real h,
                            real& deltax, real& deltay, real& deltaz)
@@ -281,7 +283,7 @@ namespace GeographicLib {
      * @return \e W = \e V + Φ the sum of the gravitational and
      *   centrifugal potentials (m<sup>2</sup> s<sup>−2</sup>).
      *
-     * This calls NormalGravity::U for  ReferenceEllipsoid().
+     * This calls NormalGravity::U for ReferenceEllipsoid().
      **********************************************************************/
     Math::real W(real X, real Y, real Z,
                  real& gX, real& gY, real& gZ) const;
@@ -356,7 +358,7 @@ namespace GeographicLib {
      *   normal gravitational and centrifugal potentials
      *   (m<sup>2</sup> s<sup>−2</sup>).
      *
-     * This calls NormalGravity::U for  ReferenceEllipsoid().
+     * This calls NormalGravity::U for ReferenceEllipsoid().
      **********************************************************************/
     Math::real U(real X, real Y, real Z,
                  real& gammaX, real& gammaY, real& gammaZ) const
@@ -374,7 +376,7 @@ namespace GeographicLib {
      * @return Φ the centrifugal potential (m<sup>2</sup>
      * s<sup>−2</sup>).
      *
-     * This calls NormalGravity::Phi for  ReferenceEllipsoid().
+     * This calls NormalGravity::Phi for ReferenceEllipsoid().
      **********************************************************************/
     Math::real Phi(real X, real Y, real& fX, real& fY) const
     { return _earth.Phi(X, Y, fX, fY); }
diff --git a/include/GeographicLib/LambertConformalConic.hpp b/include/GeographicLib/LambertConformalConic.hpp
index 4abd93b..a63e3c1 100644
--- a/include/GeographicLib/LambertConformalConic.hpp
+++ b/include/GeographicLib/LambertConformalConic.hpp
@@ -2,7 +2,7 @@
  * \file LambertConformalConic.hpp
  * \brief Header for GeographicLib::LambertConformalConic class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -69,7 +69,7 @@ namespace GeographicLib {
     //   W. M. Kahan and R. J. Fateman,
     //   Symbolic computation of divided differences,
     //   SIGSAM Bull. 33(3), 7-28 (1999)
-    //   https://dx.doi.org/10.1145/334714.334716
+    //   https://doi.org/10.1145/334714.334716
     //   http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
     //
     // General rules
@@ -242,7 +242,7 @@ namespace GeographicLib {
      *
      * The latitude origin is given by LambertConformalConic::LatitudeOrigin().
      * No false easting or northing is added.  The value of \e lon returned is
-     * in the range [−180°, 180°).  The error in the projection
+     * in the range [−180°, 180°].  The error in the projection
      * is less than about 10 nm (10 nanometers), true distance, and the errors
      * in the meridian convergence and scale are consistent with this.
      **********************************************************************/
diff --git a/include/GeographicLib/LocalCartesian.hpp b/include/GeographicLib/LocalCartesian.hpp
index b6ed512..e3104b0 100644
--- a/include/GeographicLib/LocalCartesian.hpp
+++ b/include/GeographicLib/LocalCartesian.hpp
@@ -2,7 +2,7 @@
  * \file LocalCartesian.hpp
  * \brief Header for GeographicLib::LocalCartesian class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -154,7 +154,7 @@ namespace GeographicLib {
      * @param[out] h height of point above the ellipsoid (meters).
      *
      * The value of \e lon returned is in the range [−180°,
-     * 180°).
+     * 180°].
      **********************************************************************/
     void Reverse(real x, real y, real z, real& lat, real& lon, real& h)
       const {
diff --git a/include/GeographicLib/Math.hpp b/include/GeographicLib/Math.hpp
index 0368b63..dc01065 100644
--- a/include/GeographicLib/Math.hpp
+++ b/include/GeographicLib/Math.hpp
@@ -2,7 +2,7 @@
  * \file Math.hpp
  * \brief Header for GeographicLib::Math class
  *
- * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -156,7 +156,7 @@ namespace GeographicLib {
      * @param[in] ndigits the number of bits of precision.
      * @return the resulting number of bits of precision.
      *
-     * This only has an effect when GEOGRAPHICLIB_PRECISION == 5.  See also
+     * This only has an effect when GEOGRAPHICLIB_PRECISION = 5.  See also
      * Utility::set_digits for caveats about when this routine should be
      * called.
      **********************************************************************/
@@ -250,8 +250,8 @@ namespace GeographicLib {
       y /= (x ? x : 1);
       return x * sqrt(1 + y * y);
       // For an alternative (square-root free) method see
-      // C. Moler and D. Morrision (1983) https://dx.doi.org/10.1147/rd.276.0577
-      // and A. A. Dubrulle (1983) https://dx.doi.org/10.1147/rd.276.0582
+      // C. Moler and D. Morrision (1983) https://doi.org/10.1147/rd.276.0577
+      // and A. A. Dubrulle (1983) https://doi.org/10.1147/rd.276.0582
 #endif
     }
 
@@ -430,18 +430,24 @@ namespace GeographicLib {
      *
      * @tparam T the type of the argument and returned value.
      * @param[in] x the angle in degrees.
-     * @return the angle reduced to the range [−180°, 180°).
+     * @return the angle reduced to the range([−180°, 180°].
      *
      * The range of \e x is unrestricted.
      **********************************************************************/
     template<typename T> static inline T AngNormalize(T x) {
 #if GEOGRAPHICLIB_CXX11_MATH && GEOGRAPHICLIB_PRECISION != 4
       using std::remainder;
-      x = remainder(x, T(360)); return x != 180 ? x : -180;
+      x = remainder(x, T(360)); return x != -180 ? x : 180;
 #else
       using std::fmod;
-      x = fmod(x, T(360));
-      return x < -180 ? x + 360 : (x < 180 ? x : x - 360);
+      T y = fmod(x, T(360));
+#if defined(_MSC_VER) && _MSC_VER < 1900
+      // Before version 14 (2015), Visual Studio had problems dealing
+      // with -0.0.  Specifically
+      //   VC 10,11,12 and 32-bit compile: fmod(-0.0, 360.0) -> +0.0
+      if (x == 0) y = x;
+#endif
+      return y <= -180 ? y + 360 : (y <= 180 ? y : y - 360);
 #endif
     }
 
@@ -475,18 +481,18 @@ namespace GeographicLib {
     template<typename T> static inline T AngDiff(T x, T y, T& e) {
 #if GEOGRAPHICLIB_CXX11_MATH && GEOGRAPHICLIB_PRECISION != 4
       using std::remainder;
-      T t, d = - AngNormalize(sum(remainder( x, T(360)),
-                                  remainder(-y, T(360)), t));
+      T t, d = AngNormalize(sum(remainder(-x, T(360)),
+                                remainder( y, T(360)), t));
 #else
-      T t, d = - AngNormalize(sum(AngNormalize(x), AngNormalize(-y), t));
+      T t, d = AngNormalize(sum(AngNormalize(-x), AngNormalize(y), t));
 #endif
-      // Here y - x = d - t (mod 360), exactly, where d is in (-180,180] and
+      // Here y - x = d + t (mod 360), exactly, where d is in (-180,180] and
       // abs(t) <= eps (eps = 2^-45 for doubles).  The only case where the
       // addition of t takes the result outside the range (-180,180] is d = 180
-      // and t < 0.  The case, d = -180 + eps, t = eps, can't happen, since
+      // and t > 0.  The case, d = -180 + eps, t = -eps, can't happen, since
       // sum would have returned the exact result in such a case (i.e., given t
       // = 0).
-      return sum(d == 180 && t < 0 ? -180 : d, -t, e);
+      return sum(d == 180 && t > 0 ? -180 : d, t, e);
     }
 
     /**
@@ -541,6 +547,8 @@ namespace GeographicLib {
      *
      * The results obey exactly the elementary properties of the trigonometric
      * functions, e.g., sin 9° = cos 81° = − sin 123456789°.
+     * If x = −0, then \e sinx = −0; this is the only case where
+     * −0 is returned.
      **********************************************************************/
     template<typename T> static inline void sincosd(T x, T& sinx, T& cosx) {
       // In order to minimize round-off errors, this function exactly reduces
@@ -575,11 +583,13 @@ namespace GeographicLib {
       if (x == 0) s = x;
 #endif
       switch (unsigned(q) & 3U) {
-      case 0U: sinx =        s; cosx =        c; break;
-      case 1U: sinx =        c; cosx = T(0) - s; break;
-      case 2U: sinx = T(0) - s; cosx = T(0) - c; break;
-      default: sinx = T(0) - c; cosx =        s; break; // case 3U
+      case 0U: sinx =  s; cosx =  c; break;
+      case 1U: sinx =  c; cosx = -s; break;
+      case 2U: sinx = -s; cosx = -c; break;
+      default: sinx = -c; cosx =  s; break; // case 3U
       }
+      // Set sign of 0 results.  -0 only produced for sin(-0)
+      if (x) { sinx += T(0); cosx += T(0); }
     }
 
     /**
@@ -607,7 +617,9 @@ namespace GeographicLib {
       r *= degree();
       unsigned p = unsigned(q);
       r = p & 1U ? cos(r) : sin(r);
-      return p & 2U ? T(0) - r : r;
+      if (p & 2U) r = -r;
+      if (x) r += T(0);
+      return r;
     }
 
     /**
@@ -635,7 +647,8 @@ namespace GeographicLib {
       r *= degree();
       unsigned p = unsigned(q + 1);
       r = p & 1U ? cos(r) : sin(r);
-      return p & 2U ? T(0) - r : r;
+      if (p & 2U) r = -r;
+      return T(0) + r;
     }
 
     /**
@@ -663,10 +676,10 @@ namespace GeographicLib {
      * @param[in] x
      * @return atan2(<i>y</i>, <i>x</i>) in degrees.
      *
-     * The result is in the range [−180° 180°).  N.B.,
-     * atan2d(±0, −1) = −180°; atan2d(+ε,
-     * −1) = +180°, for ε positive and tiny;
-     * atan2d(±0, 1) = ±0°.
+     * The result is in the range (−180° 180°].  N.B.,
+     * atan2d(±0, −1) = +180°; atan2d(−ε,
+     * −1) = −180°, for ε positive and tiny;
+     * atan2d(±0, +1) = ±0°.
      **********************************************************************/
     template<typename T> static inline T atan2d(T y, T x) {
       // In order to minimize round-off errors, this function rearranges the
@@ -686,7 +699,7 @@ namespace GeographicLib {
         //   case 0: ang = 0 + ang; break;
         //
         // and handle mpfr as in AngRound.
-      case 1: ang = (y > 0 ? 180 : -180) - ang; break;
+      case 1: ang = (y >= 0 ? 180 : -180) - ang; break;
       case 2: ang =  90 - ang; break;
       case 3: ang = -90 + ang; break;
       }
@@ -724,12 +737,15 @@ namespace GeographicLib {
      * @param[in] x gives the magitude of the result.
      * @param[in] y gives the sign of the result.
      * @return value with the magnitude of \e x and with the sign of \e y.
+     *
+     * This routine correctly handles the case \e y = −0, returning
+     * &minus|<i>x</i>|.
      **********************************************************************/
     template<typename T> static inline T copysign(T x, T y) {
 #if GEOGRAPHICLIB_CXX11_MATH
       using std::copysign; return copysign(x, y);
 #else
-      using std::abs; using std::atan2;
+      using std::abs;
       // NaN counts as positive
       return abs(x) * (y < 0 || (y == 0 && 1/y < 0)  ? -1 : 1);
 #endif
@@ -746,10 +762,10 @@ namespace GeographicLib {
      *
      * See Eqs. (7--9) of
      * C. F. F. Karney,
-     * <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+     * <a href="https://doi.org/10.1007/s00190-011-0445-3">
      * Transverse Mercator with an accuracy of a few nanometers,</a>
      * J. Geodesy 85(8), 475--485 (Aug. 2011)
-     * (preprint <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>).
+     * (preprint <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>).
      **********************************************************************/
     template<typename T> static T taupf(T tau, T es);
 
@@ -764,10 +780,10 @@ namespace GeographicLib {
      *
      * See Eqs. (19--21) of
      * C. F. F. Karney,
-     * <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+     * <a href="https://doi.org/10.1007/s00190-011-0445-3">
      * Transverse Mercator with an accuracy of a few nanometers,</a>
      * J. Geodesy 85(8), 475--485 (Aug. 2011)
-     * (preprint <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>).
+     * (preprint <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>).
      **********************************************************************/
     template<typename T> static T tauf(T taup, T es);
 
diff --git a/include/GeographicLib/NearestNeighbor.hpp b/include/GeographicLib/NearestNeighbor.hpp
new file mode 100644
index 0000000..ebefeb9
--- /dev/null
+++ b/include/GeographicLib/NearestNeighbor.hpp
@@ -0,0 +1,748 @@
+/**
+ * \file NearestNeighbor.hpp
+ * \brief Header for GeographicLib::NearestNeighbor class
+ *
+ * Copyright (c) Charles Karney (2016) <charles at karney.com> and licensed under
+ * the MIT/X11 License.  For more information, see
+ * http://geographiclib.sourceforge.net/
+ **********************************************************************/
+
+#if !defined(GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP)
+#define GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP 1
+
+#include <algorithm>            // for nth_element, max_element, etc.
+#include <vector>
+#include <queue>                // for priority_queue
+#include <utility>              // for swap + pair
+#include <cstring>
+#include <limits>
+#include <cmath>
+#include <iostream>
+#include <sstream>
+// Only for GEOGRAPHICLIB_STATIC_ASSERT and GeographicLib::GeographicErr
+#include <GeographicLib/Constants.hpp>
+
+#if !defined(GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION)
+#define GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION 0
+#endif
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+#include <boost/serialization/nvp.hpp>
+#include <boost/serialization/split_member.hpp>
+#include <boost/serialization/array.hpp>
+#include <boost/serialization/vector.hpp>
+#endif
+
+#if defined(_MSC_VER)
+// Squelch warnings about constant conditional expressions
+#  pragma warning (push)
+#  pragma warning (disable: 4127)
+#endif
+
+namespace GeographicLib {
+
+  /**
+   * \brief Nearest-neighbor calculations
+   *
+   * This class implements nearest-neighbor calculations using the
+   * vantage-point tree described by
+   * - J. K. Uhlmann,
+   *   <a href="doi:10.1016/0020-0190(91)90074-r">
+   *   Satisfying general proximity/similarity queries with metric trees</a>,
+   *   Information Processing Letters 40 175–179 (1991).
+   * - P. N. Yianilos,
+   *   <a href="http://pnylab.com/pny/papers/vptree/vptree/">
+   *   Data structures and algorithms for nearest neighbor search in general
+   *   metric spaces</a>, Proc. 4th ACM-SIAM Symposium on Discrete Algorithms,
+   *   (SIAM, 1993). pp. 311–321.
+   *
+   * Given a set of points in some space and a distance function \e d
+   * satisfying the metric conditions:
+   * \f[
+   * \begin{align}
+   *  d(x,y) &\ge 0,\\
+   *  d(x,y) &= 0, \ \text{iff $x = y$},\\
+   *  d(x,y) &= d(y,x),\\
+   *  d(x,z) &\ge d(x,y) + d(y,z),
+   * \end{align}
+   * \f]
+   * the vantage-point (VP) tree provides an efficient way of determining
+   * nearest neighbors.  Typically the cost of constructing a VP tree of \e N
+   * points is \e N log \e N, while the cost of a query is log \e N.  Thus a VP
+   * tree should be used in situations where \e N is large and at least log \e
+   * N queries are to be made.  The condition, \e N is large, means that
+   * \f$ N \gg 2^D \f$, where \e D is the dimensionality of the space.
+   *
+   * - This implementation includes Yianilos' upper and lower bounds for the
+   *   inside and outside sets.  This helps limit the number of searches
+   *   (compared to just using the median distance).
+   * - Rather than do a depth-first or breath-first search on the tree, the
+   *   nodes to be processed are put on a priority queue with the nodes most
+   *   likely to contain close points processed first.  Frequently, this allows
+   *   nodes lower down on the priority queue to be skipped.
+   * - This technique also allows non-exhaustive searchs to be performed (to
+   *   answer questions such as "are there any points within 1km of the query
+   *   point?).
+   * - When building the tree, the points furthest from the parent vantage
+   *   point in both the inside and outside sets are selected as the children's
+   *   vantage points.  This information is already available from the
+   *   computation of the upper and lower bounds of the children.  This choice
+   *   seems to lead to a reasonably optimized tree.
+   * - The leaf nodes can contain a bucket of points (instead of just a vantage
+   *   point).
+   *
+   * This class is templated so that it can handle arbitrary metric spaces as
+   * follows:
+   *
+   * @tparam real the type used for measuring distances; it can be a real or
+   *   signed integer type.
+   * @tparam position the type for specifying points.
+   * @tparam distance the type for a function object which takes takes two
+   *   positions as arguments and returns the distance (of type \e real).
+   *
+   * The \e real type must support numeric_limits queries (specifically:
+   * is_signed, is_integer, max(), digits, and digits10).
+   *
+   * Example of use:
+   * \include example-NearestNeighbor.cpp
+   **********************************************************************/
+  template <typename real, typename position, class distance>
+  class NearestNeighbor {
+    // For tracking changes to the I/O format
+    static const int version = 1;
+    // This is what we get "free"; but if sizeof(real) = 1 (unlikely), allow 4
+    // slots (and this accommodates the default value bucket = 4).
+    static const int maxbucket = (2 + ((4 * sizeof(real)) / sizeof(int) >= 2 ?
+                                       (4 * sizeof(real)) / sizeof(int) : 2));
+  public:
+
+    /**
+     * Default constructor for NearestNeighbor.
+     *
+     * This is equivalent to specifying an empty set of points.
+     **********************************************************************/
+    NearestNeighbor() : _numpoints(0) {}
+
+    /**
+     * Constructor for NearestNeighbor.
+     *
+     * @param[in] pts a vector of points to include in the set.
+     * @param[in] dist the distance function object.
+     * @param[in] bucket the size of the buckets at the leaf nodes; this must
+     *   lie in [0, 2 + 4*sizeof(real)/sizeof(int)] (default 4).
+     * @exception GeographicErr if the value of \e bucket is out of bounds or
+     *   the size of \e pts is too big for an int.
+     * @exception std::bad_alloc if memory for the tree can't be allocated.
+     *
+     * The distances computed by \e dist must satisfy the standard metric
+     * conditions.  If not, the results are undefined.  Neither the data in \e
+     * pts nor the query points should contain NaNs or infinities because such
+     * data violates the metric conditions.
+     *
+     * \e pts may contain coincident points (i.e., the distance between them
+     * vanishes); these are treated as distinct.
+     *
+     * The choice of \e bucket is a tradeoff between space and efficiency.  A
+     * larger \e bucket decreases the size of the NearestNeigbor object which
+     * scales as pts.size() / max(1, bucket) and reduces the number of distance
+     * calculations to construct the object by log2(bucket) * pts.size().
+     * However each search then requires about bucket additional distance
+     * calculations.
+     *
+     * \warning The same arguments \e pts and \e dist must be provided
+     * to the Search() function.
+     **********************************************************************/
+    NearestNeighbor(const std::vector<position>& pts, const distance& dist,
+                    int bucket = 4) {
+      Initialize(pts, dist, bucket);
+    }
+
+    /**
+     * Initialize or re-initialize NearestNeighbor.
+     *
+     * @param[in] pts a vector of points to include in the tree.
+     * @param[in] dist the distance function object.
+     * @param[in] bucket the size of the buckets at the leaf nodes; this must
+     *   lie in [0, 2 + 4*sizeof(real)/sizeof(int)] (default 4).
+     * @exception GeographicErr if the value of \e bucket is out of bounds or
+     *   the size of \e pts is too big for an int.
+     * @exception std::bad_alloc if memory for the tree can't be allocated.
+     *
+     * See also the documentation on the constructor.
+     *
+     * If an exception is thrown, the state of the NearestNeighbor is
+     * unchanged.
+     **********************************************************************/
+    void Initialize(const std::vector<position>& pts, const distance& dist,
+                    int bucket = 4) {
+      GEOGRAPHICLIB_STATIC_ASSERT(std::numeric_limits<real>::is_signed,
+                                  "real must be a signed type");
+      if (!( 0 <= bucket && bucket <= maxbucket ))
+        throw GeographicLib::GeographicErr
+          ("bucket must lie in [0, 2 + 4*sizeof(real)/sizeof(int)]");
+      if (pts.size() > size_t(std::numeric_limits<int>::max()))
+        throw GeographicLib::GeographicErr("pts array too big");
+      // the pair contains distance+id
+      std::vector<item> ids(pts.size());
+      for (int k = int(ids.size()); k--;)
+        ids[k] = std::make_pair(real(0), k);
+      int cost = 0;
+      std::vector<Node> tree;
+      init(pts, dist, bucket, tree, ids, cost,
+           0, int(ids.size()), int(ids.size()/2));
+      _tree.swap(tree);
+      _numpoints = int(pts.size());
+      _bucket = bucket;
+      _mc = _sc = 0;
+      _cost = cost; _c1 = _k = _cmax = 0;
+      _cmin = std::numeric_limits<int>::max();
+    }
+
+    /**
+     * Search the NearestNeighbor.
+     *
+     * @param[in] pts the vector of points used for initialization.
+     * @param[in] dist the distance function object used for initialization.
+     * @param[in] query the query point.
+     * @param[out] ind a vector of indices to the closest points found.
+     * @param[in] k the number of points to search for (default = 1).
+     * @param[in] maxdist only return points with distances of \e maxdist or
+     *   less from \e query (default is the maximum \e real).
+     * @param[in] mindist only return points with distances of more than
+     *   \e mindist from \e query (default = −1).
+     * @param[in] exhaustive whether to do an exhaustive search (default true).
+     * @param[in] tol the tolerance on the results (default 0).
+     * @return the distance to the closest point found (−1 if no points
+     *   are found).
+     *
+     * The indices returned in \e ind are sorted by distance from \e query
+     * (closest first).
+     *
+     * With \e exhaustive = true and \e tol = 0 (their default values), this
+     * finds the indices of \e k closest neighbors to \e query whose distances
+     * to \e query are in (\e mindist, \e maxdist].  If \e mindist and \e
+     * maxdist have their default values, then these bounds have no effect.  If
+     * \e query is one of the points in the tree, then set \e mindist = 0 to
+     * prevent this point (and other coincident points) from being returned.
+     *
+     * If \e exhaustive = false, exit as soon as \e k results satisfying the
+     * distance criteria are found.  If less than \e k results are returned
+     * then the search was exhaustive even if \e exhaustive = false.
+     *
+     * If \e tol is positive, do an approximate search; in this case the
+     * results are to be interpreted as follows: if the <i>k</i>'th distance is
+     * \e dk, then all results with distances less than or equal \e dk −
+     * \e tol are correct; all others are suspect — there may be other
+     * closer results with distances greater or equal to \e dk − \e tol.
+     * If less than \e k results are found, then the search is exact.
+     *
+     * \e mindist should be used to exclude a "small" neighborhood of the query
+     * point (relative to the average spacing of the data).  If \e mindist is
+     * large, the efficiency of the search deteriorates.
+     *
+     * \warning The arguments \e pts and \e dist must be identical to
+     * those used to initialize the NearestNeighbor; if not, the behavior of
+     * this function is undefined (however, if the size of \e pts is wrong,
+     * this function exits with no results returned).
+     **********************************************************************/
+    real Search(const std::vector<position>& pts, const distance& dist,
+                const position& query,
+                std::vector<int>& ind,
+                int k = 1,
+                real maxdist = std::numeric_limits<real>::max(),
+                real mindist = -1,
+                bool exhaustive = true,
+                real tol = 0) const {
+      std::priority_queue<item> results;
+      if (_numpoints > 0 && _numpoints == int(pts.size()) &&
+          k > 0 && maxdist > mindist) {
+        // distance to the kth closest point so far
+        real tau = maxdist;
+        // first is negative of how far query is outside boundary of node
+        // +1 if on boundary or inside
+        // second is node index
+        std::priority_queue<item> todo;
+        todo.push(std::make_pair(real(1), int(_tree.size()) - 1));
+        int c = 0;
+        while (!todo.empty()) {
+          int n = todo.top().second;
+          real d = -todo.top().first;
+          todo.pop();
+          real tau1 = tau - tol;
+          // compare tau and d again since tau may have become smaller.
+          if (!( n >= 0 && tau1 >= d )) continue;
+          const Node& current = _tree[n];
+          real dst = 0;     // to suppress warning about uninitialized variable
+          bool exitflag = false, leaf = current.index < 0;
+          for (int i = 0; i < (leaf ? _bucket : 1); ++i) {
+            int index = leaf ? current.leaves[i] : current.index;
+            if (index < 0) break;
+            dst = dist(pts[index], query);
+            ++c;
+
+            if (dst > mindist && dst <= tau) {
+              if (int(results.size()) == k) results.pop();
+              results.push(std::make_pair(dst, index));
+              if (int(results.size()) == k) {
+                if (exhaustive)
+                  tau = results.top().first;
+                else {
+                  exitflag = true;
+                  break;
+                }
+                if (tau <= tol) {
+                  exitflag = true;
+                  break;
+                }
+              }
+            }
+          }
+          if (exitflag) break;
+
+          if (current.index < 0) continue;
+          tau1 = tau - tol;
+          for (int l = 0; l < 2; ++l) {
+            if (current.data.child[l] >= 0 &&
+                dst + current.data.upper[l] >= mindist) {
+              if (dst < current.data.lower[l]) {
+                d = current.data.lower[l] - dst;
+                if (tau1 >= d)
+                  todo.push(std::make_pair(-d, current.data.child[l]));
+              } else if (dst > current.data.upper[l]) {
+                d = dst - current.data.upper[l];
+                if (tau1 >= d)
+                  todo.push(std::make_pair(-d, current.data.child[l]));
+              } else
+                todo.push(std::make_pair(real(1), current.data.child[l]));
+            }
+          }
+        }
+        ++_k;
+        _c1 += c;
+        double omc = _mc;
+        _mc += (c - omc) / _k;
+        _sc += (c - omc) * (c - _mc);
+        if (c > _cmax) _cmax = c;
+        if (c < _cmin) _cmin = c;
+      }
+
+      real d = -1;
+      ind.resize(results.size());
+
+      for (int i = int(ind.size()); i--;) {
+        ind[i] = int(results.top().second);
+        if (i == 0) d = results.top().first;
+        results.pop();
+      }
+      return d;
+
+    }
+
+    /**
+     * @return the total number of points in the set.
+     **********************************************************************/
+    int NumPoints() const { return _numpoints; }
+
+    /**
+     * Write the object to an I/O stream.
+     *
+     * @param[in,out] os the stream to write to.
+     * @param[in] bin if true (the default) save in binary mode.
+     * @exception std::bad_alloc if memory for the string representation of the
+     *   object can't be allocated.
+     *
+     * The counters tracking the statistics of searches are not saved; however
+     * the initializtion cost is saved.  The format of the binary saves is \e
+     * not portable.
+     *
+     * \note <a href="http://www.boost.org/libs/serialization/doc">
+     * Boost serialization</a> can also be used to save and restore a
+     * NearestNeighbor object.  This requires that the
+     * GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION macro be defined.
+     **********************************************************************/
+    void Save(std::ostream& os, bool bin = true) const {
+      int realspec = std::numeric_limits<real>::digits *
+        (std::numeric_limits<real>::is_integer ? -1 : 1);
+      if (bin) {
+        char id[] = "NearestNeighbor_";
+        os.write(id, 16);
+        int buf[6];
+        buf[0] = version;
+        buf[1] = realspec;
+        buf[2] = _bucket;
+        buf[3] = _numpoints;
+        buf[4] = int(_tree.size());
+        buf[5] = _cost;
+        os.write(reinterpret_cast<const char *>(buf), 6 * sizeof(int));
+        for (int i = 0; i < int(_tree.size()); ++i) {
+          const Node& node = _tree[i];
+          os.write(reinterpret_cast<const char *>(&node.index), sizeof(int));
+          if (node.index >= 0) {
+            os.write(reinterpret_cast<const char *>(node.data.lower),
+                     2 * sizeof(real));
+            os.write(reinterpret_cast<const char *>(node.data.upper),
+                     2 * sizeof(real));
+            os.write(reinterpret_cast<const char *>(node.data.child),
+                     2 * sizeof(int));
+          } else {
+            os.write(reinterpret_cast<const char *>(node.leaves),
+                     _bucket * sizeof(int));
+          }
+        }
+      } else {
+        std::stringstream ostring;
+          // Ensure enough precision for type real.  If real is actually a
+          // signed integer type, full precision is used anyway.  With C++11,
+          // max_digits10 can be used instead.
+        ostring.precision(std::numeric_limits<real>::digits10 + 2);
+        ostring << version << " " << realspec << " " << _bucket << " "
+                << _numpoints << " " << _tree.size() << " " << _cost;
+        for (int i = 0; i < int(_tree.size()); ++i) {
+          const Node& node = _tree[i];
+          ostring << "\n" << node.index;
+          if (node.index >= 0) {
+            for (int l = 0; l < 2; ++l)
+              ostring << " " << node.data.lower[l] << " " << node.data.upper[l]
+                      << " " << node.data.child[l];
+          } else {
+            for (int l = 0; l < _bucket; ++l)
+              ostring << " " << node.leaves[l];
+          }
+        }
+        os << ostring.str();
+      }
+    }
+
+    /**
+     * Read the object from an I/O stream.
+     *
+     * @param[in,out] is the stream to read from
+     * @param[in] bin if true (the default) load in binary mode.
+     * @exception GeographicErr if the state read from \e is is illegal.
+     *
+     * The counters tracking the statistics of searches are reset by this
+     * operation.  Binary data must have been saved on a machine with the same
+     * architecture.  If an exception is thrown, the state of the
+     * NearestNeighbor is unchanged.
+     *
+     * \note <a href="http://www.boost.org/libs/serialization/doc">
+     * Boost serialization</a> can also be used to save and restore a
+     * NearestNeighbor object.  This requires that the
+     * GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION macro be defined.
+     *
+     * \warning The same arguments \e pts and \e dist used for
+     * initialization must be provided to the Search() function.
+     **********************************************************************/
+    void Load(std::istream& is, bool bin = true) {
+      int version1, realspec, bucket, numpoints, treesize, cost;
+      if (bin) {
+        char id[17];
+        is.read(id, 16);
+        id[16] = '\0';
+        if (!(std::strcmp(id, "NearestNeighbor_") == 0))
+          throw GeographicLib::GeographicErr("Bad ID");
+        is.read(reinterpret_cast<char *>(&version1), sizeof(int));
+        is.read(reinterpret_cast<char *>(&realspec), sizeof(int));
+        is.read(reinterpret_cast<char *>(&bucket), sizeof(int));
+        is.read(reinterpret_cast<char *>(&numpoints), sizeof(int));
+        is.read(reinterpret_cast<char *>(&treesize), sizeof(int));
+        is.read(reinterpret_cast<char *>(&cost), sizeof(int));
+      } else {
+        if (!( is >> version1 >> realspec >> bucket >> numpoints >> treesize
+               >> cost ))
+          throw GeographicLib::GeographicErr("Bad header");
+      }
+      if (!( version1 == version ))
+        throw GeographicLib::GeographicErr("Incompatible version");
+      if (!( realspec == std::numeric_limits<real>::digits *
+             (std::numeric_limits<real>::is_integer ? -1 : 1) ))
+        throw GeographicLib::GeographicErr("Different real types");
+      if (!( 0 <= bucket && bucket <= maxbucket ))
+        throw GeographicLib::GeographicErr("Bad bucket size");
+      if (!( 0 <= treesize && treesize <= numpoints ))
+        throw GeographicLib::GeographicErr("Bad number of points or tree size");
+      std::vector<Node> tree;
+      tree.reserve(treesize);
+      for (int i = 0; i < treesize; ++i) {
+        Node node;
+        if (bin) {
+          is.read(reinterpret_cast<char *>(&node.index), sizeof(int));
+          if (node.index >= 0) {
+            is.read(reinterpret_cast<char *>(node.data.lower),
+                    2 * sizeof(real));
+            is.read(reinterpret_cast<char *>(node.data.upper),
+                    2 * sizeof(real));
+            is.read(reinterpret_cast<char *>(node.data.child),
+                    2 * sizeof(int));
+          } else {
+            is.read(reinterpret_cast<char *>(node.leaves),
+                    bucket * sizeof(int));
+            for (int l = bucket; l < maxbucket; ++l)
+              node.leaves[l] = 0;
+          }
+        } else {
+          if (!( is >> node.index ))
+            throw GeographicLib::GeographicErr("Bad index");
+          if (node.index >= 0) {
+            for (int l = 0; l < 2; ++l) {
+              if (!( is >> node.data.lower[l] >> node.data.upper[l]
+                     >> node.data.child[l] ))
+                throw GeographicLib::GeographicErr("Bad node data");
+            }
+          } else {
+            // Must be at least one valid leaf followed by a sequence end
+            // markers (-1).
+            for (int l = 0; l < bucket; ++l) {
+              if (!( is >> node.leaves[l] ))
+                throw GeographicLib::GeographicErr("Bad leaf data");
+            }
+            for (int l = bucket; l < maxbucket; ++l)
+              node.leaves[l] = 0;
+          }
+        }
+        node.Check(numpoints, treesize, bucket);
+        tree.push_back(node);
+      }
+      _tree.swap(tree);
+      _numpoints = numpoints;
+      _bucket = bucket;
+      _mc = _sc = 0;
+      _cost = cost; _c1 = _k = _cmax = 0;
+      _cmin = std::numeric_limits<int>::max();
+    }
+
+    /**
+     * The accumulated statistics on the searches so far.
+     *
+     * @param[out] setupcost the cost of initializing the NearestNeighbor.
+     * @param[out] numsearches the number of calls to Search().
+     * @param[out] searchcost the total cost of the calls to Search().
+     * @param[out] mincost the minimum cost of a Search().
+     * @param[out] maxcost the maximum cost of a Search().
+     * @param[out] mean the mean cost of a Search().
+     * @param[out] sd the standard deviation in the cost of a Search().
+     *
+     * Here "cost" measures the number of distance calculations needed.  Note
+     * that the accumulation of statistics is \e not thread safe.
+     **********************************************************************/
+    void Statistics(int& setupcost, int& numsearches, int& searchcost,
+                    int& mincost, int& maxcost,
+                    double& mean, double& sd) const {
+      setupcost = _cost; numsearches = _k; searchcost = _c1;
+      mincost = _cmin; maxcost = _cmax;
+      mean = _mc; sd = std::sqrt(_sc / (_k - 1));
+    }
+
+    /**
+     * Reset the counters for the accumulated statistics on the searches so
+     * far.
+     **********************************************************************/
+    void ResetStatistics() const {
+      _mc = _sc = 0;
+      _c1 = _k = _cmax = 0;
+      _cmin = std::numeric_limits<int>::max();
+    }
+
+  private:
+    // Package up a real and an int.  We will want to sort on the real so put
+    // it first.
+    typedef std::pair<real, int> item;
+    class Node {
+    public:
+      struct bounds {
+        real lower[2], upper[2]; // bounds on inner/outer distances
+        int child[2];
+      };
+      union {
+        bounds data;
+        int leaves[maxbucket];
+      };
+      int index;
+
+      Node()
+        : index(-1)
+      {
+        for (int i = 0; i < 2; ++i) {
+          data.lower[i] = data.upper[i] = 0;
+          data.child[i] = -1;
+        }
+      }
+
+      // Sanity check on a Node
+      void Check(int numpoints, int treesize, int bucket) const {
+        if (!( -1 <= index && index << numpoints ))
+          throw GeographicLib::GeographicErr("Bad index");
+        if (index >= 0) {
+          if (!( -1 <= data.child[0] && data.child[0] < treesize &&
+                 -1 <= data.child[1] && data.child[1] < treesize ))
+            throw GeographicLib::GeographicErr("Bad child pointers");
+          if (!( 0 <= data.lower[0] && data.lower[0] <= data.upper[0] &&
+                 data.upper[0] <= data.lower[1] &&
+                 data.lower[1] <= data.upper[1] ))
+            throw GeographicLib::GeographicErr("Bad bounds");
+        } else {
+          // Must be at least one valid leaf followed by a sequence end markers
+          // (-1).
+          bool start = true;
+          for (int l = 0; l < bucket; ++l) {
+            if (!( (start ?
+                    ((l == 0 ? 0 : -1) <= leaves[l] && leaves[l] < numpoints) :
+                    leaves[l] == -1) ))
+              throw GeographicLib::GeographicErr("Bad leaf data");
+            start = leaves[l] >= 0;
+          }
+          for (int l = bucket; l < maxbucket; ++l) {
+            if (leaves[l] != 0)
+              throw GeographicLib::GeographicErr("Bad leaf data");
+          }
+        }
+      }
+
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+      friend class boost::serialization::access;
+      template<class Archive> void save(Archive& ar, const unsigned int) const {
+        ar & boost::serialization::make_nvp("index", index);
+        if (index < 0)
+          ar & boost::serialization::make_nvp("leaves", leaves);
+        else
+          ar & boost::serialization::make_nvp("lower", data.lower)
+            & boost::serialization::make_nvp("upper", data.upper)
+            & boost::serialization::make_nvp("child", data.child);
+      }
+      template<class Archive> void load(Archive& ar, const unsigned int) {
+        ar & boost::serialization::make_nvp("index", index);
+        if (index < 0)
+          ar & boost::serialization::make_nvp("leaves", leaves);
+        else
+          ar & boost::serialization::make_nvp("lower", data.lower)
+            & boost::serialization::make_nvp("upper", data.upper)
+            & boost::serialization::make_nvp("child", data.child);
+      }
+      template<class Archive>
+      void serialize(Archive& ar, const unsigned int file_version)
+      { boost::serialization::split_member(ar, *this, file_version); }
+#endif
+    };
+#if GEOGRAPHICLIB_HAVE_BOOST_SERIALIZATION
+    friend class boost::serialization::access;
+    template<class Archive> void save(Archive& ar, const unsigned) const {
+      int realspec = std::numeric_limits<real>::digits *
+        (std::numeric_limits<real>::is_integer ? -1 : 1);
+      // Need to use version1, otherwise load error in debug mode on Linux:
+      // undefined reference to GeographicLib::NearestNeighbor<...>::version.
+      int version1 = version;
+      ar & boost::serialization::make_nvp("version", version1)
+        & boost::serialization::make_nvp("realspec", realspec)
+        & boost::serialization::make_nvp("bucket", _bucket)
+        & boost::serialization::make_nvp("numpoints", _numpoints)
+        & boost::serialization::make_nvp("cost", _cost)
+        & boost::serialization::make_nvp("tree", _tree);
+    }
+    template<class Archive> void load(Archive& ar, const unsigned) {
+      int version1, realspec, bucket, numpoints, cost;
+      ar & boost::serialization::make_nvp("version", version1);
+      if (version1 != version)
+        throw GeographicLib::GeographicErr("Incompatible version");
+      std::vector<Node> tree;
+      ar & boost::serialization::make_nvp("realspec", realspec);
+      if (!( realspec == std::numeric_limits<real>::digits *
+             (std::numeric_limits<real>::is_integer ? -1 : 1) ))
+        throw GeographicLib::GeographicErr("Different real types");
+      ar & boost::serialization::make_nvp("bucket", bucket);
+      if (!( 0 <= bucket && bucket <= maxbucket ))
+        throw GeographicLib::GeographicErr("Bad bucket size");
+      ar & boost::serialization::make_nvp("numpoints", numpoints)
+        & boost::serialization::make_nvp("cost", cost)
+        & boost::serialization::make_nvp("tree", tree);
+      if (!( 0 <= int(tree.size()) && int(tree.size()) <= numpoints ))
+        throw GeographicLib::GeographicErr("Bad number of points or tree size");
+      for (int i = 0; i < int(tree.size()); ++i)
+        tree[i].Check(numpoints, int(tree.size()), bucket);
+      _tree.swap(tree);
+      _numpoints = numpoints;
+      _bucket = bucket;
+      _mc = _sc = 0;
+      _cost = cost; _c1 = _k = _cmax = 0;
+      _cmin = std::numeric_limits<int>::max();
+    }
+    template<class Archive>
+    void serialize(Archive& ar, const unsigned int file_version)
+    { boost::serialization::split_member(ar, *this, file_version); }
+#endif
+
+    int _numpoints, _bucket, _cost;
+    std::vector<Node> _tree;
+    // Counters to track stastistics on the cost of searches
+    mutable double _mc, _sc;
+    mutable int _c1, _k, _cmin, _cmax;
+
+    int init(const std::vector<position>& pts, const distance& dist, int bucket,
+             std::vector<Node>& tree, std::vector<item>& ids, int& cost,
+             int l, int u, int vp) {
+
+      if (u == l)
+        return -1;
+      Node node;
+
+      if (u - l > (bucket == 0 ? 1 : bucket)) {
+
+        // choose a vantage point and move it to the start
+        int i = vp;
+        std::swap(ids[l], ids[i]);
+
+        int m = (u + l + 1) / 2;
+
+        for (int k = l + 1; k < u; ++k) {
+          ids[k].first = dist(pts[ids[l].second], pts[ids[k].second]);
+          ++cost;
+        }
+        // partitian around the median distance
+        std::nth_element(ids.begin() + l + 1, ids.begin() + m, ids.begin() + u);
+        node.index = ids[l].second;
+        if (m > l + 1) {        // node.child[0] is possibly empty
+          typename std::vector<item>::iterator
+            t = std::min_element(ids.begin() + l + 1, ids.begin() + m);
+          node.data.lower[0] = t->first;
+          t = std::max_element(ids.begin() + l + 1, ids.begin() + m);
+          node.data.upper[0] = t->first;
+          // Use point with max distance as vantage point; this point act as a
+          // "corner" point and leads to a good partition.
+          node.data.child[0] = init(pts, dist, bucket, tree, ids, cost,
+                                    l + 1, m, int(t - ids.begin()));
+        }
+        typename std::vector<item>::iterator
+          t = std::max_element(ids.begin() + m, ids.begin() + u);
+        node.data.lower[1] = ids[m].first;
+        node.data.upper[1] = t->first;
+        // Use point with max distance as vantage point here too
+        node.data.child[1] = init(pts, dist, bucket, tree, ids, cost,
+                                  m, u, int(t - ids.begin()));
+      } else {
+        if (bucket == 0)
+          node.index = ids[l].second;
+        else {
+          node.index = -1;
+          // Sort the bucket entries so that the tree is independent of the
+          // implementation of nth_element.
+          std::sort(ids.begin() + l, ids.begin() + u);
+          for (int i = l; i < u; ++i)
+            node.leaves[i-l] = ids[i].second;
+          for (int i = u - l; i < bucket; ++i)
+            node.leaves[i] = -1;
+          for (int i = bucket; i < maxbucket; ++i)
+            node.leaves[i] = 0;
+        }
+      }
+
+      tree.push_back(node);
+      return int(tree.size()) - 1;
+    }
+
+  };
+
+} // namespace GeographicLib
+
+#if defined(_MSC_VER)
+#  pragma warning (pop)
+#endif
+
+#endif  // GEOGRAPHICLIB_NEARESTNEIGHBOR_HPP
diff --git a/include/GeographicLib/NormalGravity.hpp b/include/GeographicLib/NormalGravity.hpp
index eaaaf08..2f0e7af 100644
--- a/include/GeographicLib/NormalGravity.hpp
+++ b/include/GeographicLib/NormalGravity.hpp
@@ -2,7 +2,7 @@
  * \file NormalGravity.hpp
  * \brief Header for GeographicLib::NormalGravity class
  *
- * Copyright (c) Charles Karney (2011-2014) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -21,23 +21,36 @@ namespace GeographicLib {
    * "Normal" gravity refers to an idealization of the earth which is modeled
    * as an rotating ellipsoid.  The eccentricity of the ellipsoid, the rotation
    * speed, and the distribution of mass within the ellipsoid are such that the
-   * surface of the ellipsoid is a surface of constant potential (gravitational
-   * plus centrifugal).  The acceleration due to gravity is therefore
-   * perpendicular to the surface of the ellipsoid.
+   * ellipsoid is a "level ellipoid", a surface of constant potential
+   * (gravitational plus centrifugal).  The acceleration due to gravity is
+   * therefore perpendicular to the surface of the ellipsoid.
+   *
+   * Because the distribution of mass within the ellipsoid is unspecified, only
+   * the potential exterior to the ellipsoid is well defined.  In this class,
+   * the mass is assumed to be to concentrated on a "focal disc" of radius,
+   * (<i>a</i><sup>2</sup> − <i>b</i><sup>2</sup>)<sup>1/2</sup>, where
+   * \e a is the equatorial radius of the ellipsoid and \e b is its polar
+   * semi-axis.  In the case of an oblate ellipsoid, the mass is concentrated
+   * on a "focal rod" of length 2(<i>b</i><sup>2</sup> −
+   * <i>a</i><sup>2</sup>)<sup>1/2</sup>.  As a result the potential is well
+   * defined everywhere.
    *
    * There is a closed solution to this problem which is implemented here.
    * Series "approximations" are only used to evaluate certain combinations of
    * elementary functions where use of the closed expression results in a loss
-   * of accuracy for small arguments due to cancellation of the two leading
-   * terms.  However these series include sufficient terms to give full machine
+   * of accuracy for small arguments due to cancellation of the leading terms.
+   * However these series include sufficient terms to give full machine
    * precision.
    *
+   * Although the formulation used in this class applies to ellipsoids with
+   * arbitrary flattening, in practice, its use should be limited to about
+   * <i>b</i>/\e a ∈ [0.01, 100] or \e f ∈ [−99, 0.99].
+   *
    * Definitions:
    * - <i>V</i><sub>0</sub>, the gravitational contribution to the normal
    *   potential;
    * - Φ, the rotational contribution to the normal potential;
-   * - \e U = <i>V</i><sub>0</sub> + Φ, the total
-   *   potential;
+   * - \e U = <i>V</i><sub>0</sub> + Φ, the total potential;
    * - <b>Γ</b> = ∇<i>V</i><sub>0</sub>, the acceleration due to
    *   mass of the earth;
    * - <b>f</b> = ∇Φ, the centrifugal acceleration;
@@ -48,10 +61,16 @@ namespace GeographicLib {
    *   north and up directions.
    *
    * References:
+   * - C. Somigliana, Teoria generale del campo gravitazionale dell'ellissoide
+   *   di rotazione, Mem. Soc. Astron. Ital, <b>4</b>, 541--599 (1929).
    * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San
    *   Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3).
+   * - B. Hofmann-Wellenhof, H. Moritz, Physical Geodesy (Second edition,
+   *   Springer, 2006) https://doi.org/10.1007/978-3-211-33545-1
    * - H. Moritz, Geodetic Reference System 1980, J. Geodesy 54(3), 395-405
-   *   (1980) https://dx.doi.org/10.1007/BF02521480
+   *   (1980) https://doi.org/10.1007/BF02521480
+   *
+   * For more information on normal gravity see \ref normalgravity.
    *
    * Example of use:
    * \include example-NormalGravity.cpp
@@ -59,20 +78,32 @@ namespace GeographicLib {
 
   class GEOGRAPHICLIB_EXPORT NormalGravity {
   private:
-    static const int maxit_ = 10;
+    static const int maxit_ = 20;
     typedef Math::real real;
     friend class GravityModel;
     real _a, _GM, _omega, _f, _J2, _omega2, _aomega2;
-    real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _q0, _m, _k, _fstar;
+    real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _Q0, _k, _fstar;
     Geocentric _earth;
-    // (atan(y)-(y-y^3/3))/y^5 (y = sqrt(x)) = 1/5-y/7+y^2/9-y^3/11...
-    static real atan5(real x);
-    // (atan(y)-(y-y^3/3+y^5/5))/y^7 (y = sqrt(x)) = -1/7+x/9-x^2/11+x^3/13...
-    static real atan7(real x);
-    static real qf(real ep2);
-    static real dq(real ep2);
-    static real qpf(real ep2);
+    static real atanzz(real x, bool alt) {
+      // This routine obeys the identity
+      //   atanzz(x, alt) = atanzz(-x/(1+x), !alt)
+      //
+      // Require x >= -1.  Best to call with alt, s.t. x >= 0; this results in
+      // a call to atan, instead of asin, or to asinh, instead of atanh.
+      using std::sqrt; using std::abs; using std::atan; using std::asin;
+      real z = sqrt(abs(x));
+      return x == 0 ? 1 :
+        (alt ?
+         (!(x < 0) ? Math::asinh(z) : asin(z)) / sqrt(abs(x) / (1 + x)) :
+         (!(x < 0) ? atan(z) : Math::atanh(z)) / z);
+    }
+    static real atan7series(real x);
+    static real atan5series(real x);
+    static real Qf(real x, bool alt);
+    static real Gf(real x, bool alt);
+    static real QG3f(real x, bool alt);
     real Jn(int n) const;
+    void Initialize(real a, real GM, real omega, real f_J2, bool geometricp);
   public:
 
     /** \name Setting up the normal gravity
@@ -87,6 +118,38 @@ namespace GeographicLib {
      *   the gravitational constant and \e M the mass of the earth (usually
      *   including the mass of the earth's atmosphere).
      * @param[in] omega the angular velocity (rad s<sup>−1</sup>).
+     * @param[in] f_J2 either the flattening of the ellipsoid \e f or the
+     *   the dynamical form factor \e J2.
+     * @param[out] geometricp if true (the default), then \e f_J2 denotes the
+     *   flattening, else it denotes the dynamical form factor \e J2.
+     * @exception if \e a is not positive or if the other parameters do not
+     *   obey the restrictions given below.
+     *
+     * The shape of the ellipsoid can be given in one of two ways:
+     * - geometrically (\e geomtricp = true), the ellipsoid is defined by the
+     *   flattening \e f = (\e a − \e b) / \e a, where \e a and \e b are
+     *   the equatorial radius and the polar semi-axis.  The parameters should
+     *   obey \e a > 0, \e f < 1.  There are no restrictions on \e GM or
+     *   \e omega, in particular, \e GM need not be positive.
+     * - physically (\e geometricp = false), the ellipsoid is defined by the
+     *   dynamical form factor <i>J</i><sub>2</sub> = (\e C − \e A) /
+     *   <i>Ma</i><sup>2</sup>, where \e A and \e C are the equatorial and
+     *   polar moments of inertia and \e M is the mass of the earth.  The
+     *   parameters should obey \e a > 0, \e GM > 0 and \e J2 < 1/3
+     *   − (<i>omega</i><sup>2</sup><i>a</i><sup>3</sup>/<i>GM</i>)
+     *   8/(45π).  There is no restriction on \e omega.
+     **********************************************************************/
+    NormalGravity(real a, real GM, real omega, real f_J2,
+                  bool geometricp = true);
+    /**
+     * \deprecated Old constructor for the normal gravity.
+     *
+     * @param[in] a equatorial radius (meters).
+     * @param[in] GM mass constant of the ellipsoid
+     *   (meters<sup>3</sup>/seconds<sup>2</sup>); this is the product of \e G
+     *   the gravitational constant and \e M the mass of the earth (usually
+     *   including the mass of the earth's atmosphere).
+     * @param[in] omega the angular velocity (rad s<sup>−1</sup>).
      * @param[in] f the flattening of the ellipsoid.
      * @param[in] J2 the dynamical form factor.
      * @exception if \e a is not positive or the other constants are
@@ -106,6 +169,7 @@ namespace GeographicLib {
      * If \e omega, \e f, and \e J2 are all zero, then the ellipsoid becomes a
      * sphere.
      **********************************************************************/
+    GEOGRAPHICLIB_DEPRECATED("Use new NormalGravity constructor")
     NormalGravity(real a, real GM, real omega, real f, real J2);
 
     /**
@@ -143,7 +207,8 @@ namespace GeographicLib {
      *   (m s<sup>−2</sup>).
      * @param[out] gammaz the upward component of the acceleration
      *   (m s<sup>−2</sup>); this is usually negative.
-     * @return \e U the corresponding normal potential.
+     * @return \e U the corresponding normal potential
+     *   (m<sup>2</sup> s<sup>−2</sup>).
      *
      * Due to the axial symmetry of the ellipsoid, the result is independent of
      * the value of the longitude and the easterly component of the
@@ -178,18 +243,17 @@ namespace GeographicLib {
                  real& gammaX, real& gammaY, real& gammaZ) const;
 
     /**
-     * Evaluate the components of the acceleration due to gravity alone in
-     * geocentric coordinates.
+     * Evaluate the components of the acceleration due to the gravitational
+     * force in geocentric coordinates.
      *
      * @param[in] X geocentric coordinate of point (meters).
      * @param[in] Y geocentric coordinate of point (meters).
      * @param[in] Z geocentric coordinate of point (meters).
-     * @param[out] GammaX the \e X component of the acceleration due to gravity
-     *   (m s<sup>−2</sup>).
-     * @param[out] GammaY the \e Y component of the acceleration due to gravity
-     *   (m s<sup>−2</sup>).
-     * @param[out] GammaZ the \e Z component of the acceleration due to gravity
-     *   (m s<sup>−2</sup>).
+     * @param[out] GammaX the \e X component of the acceleration due to the
+     *   gravitational force (m s<sup>−2</sup>).
+     * @param[out] GammaY the \e Y component of the acceleration due to the
+     * @param[out] GammaZ the \e Z component of the acceleration due to the
+     *   gravitational force (m s<sup>−2</sup>).
      * @return <i>V</i><sub>0</sub> the gravitational potential
      *   (m<sup>2</sup> s<sup>−2</sup>).
      *
@@ -327,6 +391,12 @@ namespace GeographicLib {
      * @param[in] omega the angular velocity (rad s<sup>−1</sup>).
      * @param[in] J2 the dynamical form factor.
      * @return \e f the flattening of the ellipsoid.
+     *
+     * This routine requires \e a > 0, \e GM > 0, \e J2 < 1/3 −
+     * <i>omega</i><sup>2</sup><i>a</i><sup>3</sup>/<i>GM</i> 8/(45π).  A
+     * NaN is returned if these conditions do not hold.  The restriction to
+     * positive \e GM is made because for negative \e GM two solutions are
+     * possible.
      **********************************************************************/
     static Math::real J2ToFlattening(real a, real GM, real omega, real J2);
 
@@ -341,6 +411,9 @@ namespace GeographicLib {
      * @param[in] omega the angular velocity (rad s<sup>−1</sup>).
      * @param[in] f the flattening of the ellipsoid.
      * @return \e J2 the dynamical form factor.
+     *
+     * This routine requires \e a > 0, \e GM ≠ 0, \e f < 1.  The
+     * values of these parameters are not checked.
      **********************************************************************/
     static Math::real FlatteningToJ2(real a, real GM, real omega, real f);
   };
diff --git a/include/GeographicLib/OSGB.hpp b/include/GeographicLib/OSGB.hpp
index 450dfe7..5889e40 100644
--- a/include/GeographicLib/OSGB.hpp
+++ b/include/GeographicLib/OSGB.hpp
@@ -2,7 +2,7 @@
  * \file OSGB.hpp
  * \brief Header for GeographicLib::OSGB class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -33,7 +33,7 @@ namespace GeographicLib {
    * - <a href="http://www.ordnancesurvey.co.uk/docs/support/national-grid.pdf">
    *   Guide to the National Grid</a>
    *
-   * \b WARNING: the latitudes and longitudes for the Ordnance Survey grid
+   * \warning the latitudes and longitudes for the Ordnance Survey grid
    * system do not use the WGS84 datum.  Do not use the values returned by this
    * class in the UTMUPS, MGRS, or Geoid classes without first converting the
    * datum (and vice versa).
@@ -96,7 +96,7 @@ namespace GeographicLib {
      * @param[out] k scale of projection at point.
      *
      * The value of \e lon returned is in the range [−180°,
-     * 180°).
+     * 180°].
      **********************************************************************/
 
     static void Reverse(real x, real y,
diff --git a/include/GeographicLib/PolarStereographic.hpp b/include/GeographicLib/PolarStereographic.hpp
index ce361f8..b481a42 100644
--- a/include/GeographicLib/PolarStereographic.hpp
+++ b/include/GeographicLib/PolarStereographic.hpp
@@ -2,7 +2,7 @@
  * \file PolarStereographic.hpp
  * \brief Header for GeographicLib::PolarStereographic class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -91,7 +91,7 @@ namespace GeographicLib {
      * @param[out] k scale of projection at point.
      *
      * No false easting or northing is added.  The value of \e lon returned is
-     * in the range [−180°, 180°).
+     * in the range [−180°, 180°].
      **********************************************************************/
     void Reverse(bool northp, real x, real y,
                  real& lat, real& lon, real& gamma, real& k) const;
diff --git a/include/GeographicLib/PolygonArea.hpp b/include/GeographicLib/PolygonArea.hpp
index ef3b801..508ad5f 100644
--- a/include/GeographicLib/PolygonArea.hpp
+++ b/include/GeographicLib/PolygonArea.hpp
@@ -23,10 +23,10 @@ namespace GeographicLib {
    * This computes the area of a polygon whose edges are geodesics using the
    * method given in Section 6 of
    * - C. F. F. Karney,
-   *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   Algorithms for geodesics</a>,
    *   J. Geodesy <b>87</b>, 43--55 (2013);
-   *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+   *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
    *   10.1007/s00190-012-0578-z</a>;
    *   addenda:
    *   <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
@@ -80,9 +80,11 @@ namespace GeographicLib {
       lon1 = Math::AngNormalize(lon1);
       lon2 = Math::AngNormalize(lon2);
       real lon12 = Math::AngDiff(lon1, lon2);
+      // Treat 0 as negative in these tests.  This balances +/- 180 being
+      // treated as positive, i.e., +180.
       int cross =
-        lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 :
-        (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0);
+        lon1 <= 0 && lon2 > 0 && lon12 > 0 ? 1 :
+        (lon2 <= 0 && lon1 > 0 && lon12 < 0 ? -1 : 0);
       return cross;
     }
     // an alternate version of transit to deal with longitudes in the direct
@@ -252,7 +254,7 @@ namespace GeographicLib {
      * @param[out] lon the longitude of the point (degrees).
      *
      * If no points have been added, then NaNs are returned.  Otherwise, \e lon
-     * will be in the range [−180°, 180°).
+     * will be in the range [−180°, 180°].
      **********************************************************************/
     void CurrentPoint(real& lat, real& lon) const
     { lat = _lat1; lon = _lon1; }
diff --git a/include/GeographicLib/Rhumb.hpp b/include/GeographicLib/Rhumb.hpp
index d51f5c9..19d694d 100644
--- a/include/GeographicLib/Rhumb.hpp
+++ b/include/GeographicLib/Rhumb.hpp
@@ -2,7 +2,7 @@
  * \file Rhumb.hpp
  * \brief Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes
  *
- * Copyright (c) Charles Karney (2014-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2014-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -86,7 +86,7 @@ namespace GeographicLib {
     //   W. M. Kahan and R. J. Fateman,
     //   Symbolic computation of divided differences,
     //   SIGSAM Bull. 33(3), 7-28 (1999)
-    //   https://dx.doi.org/10.1145/334714.334716
+    //   https://doi.org/10.1145/334714.334716
     //   http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
 
     static inline real Dlog(real x, real y) {
@@ -258,7 +258,7 @@ namespace GeographicLib {
      * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
      *
      * \e lat1 should be in the range [−90°, 90°].  The value of
-     * \e lon2 returned is in the range [−180°, 180°).
+     * \e lon2 returned is in the range [−180°, 180°].
      *
      * If point 1 is a pole, the cosine of its latitude is taken to be
      * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>).  This
@@ -303,7 +303,7 @@ namespace GeographicLib {
      * - \e outmask |= Rhumb::AREA for the area \e S12;
      * - \e outmask |= Rhumb::ALL for all of the above;
      * - \e outmask |= Rhumb::LONG_UNROLL to unroll \e lon2 instead of wrapping
-     *   it into the range [−180°, 180°).
+     *   it into the range [−180°, 180°].
      * .
      * With the Rhumb::LONG_UNROLL bit set, the quantity \e lon2 −
      * \e lon1 indicates how many times and in what sense the rhumb line
@@ -327,7 +327,7 @@ namespace GeographicLib {
      * meridians, there are two shortest rhumb lines and the east-going one is
      * chosen.  \e lat1 and \e lat2 should be in the range [−90°,
      * 90°].  The value of \e azi12 returned is in the range
-     * [−180°, 180°).
+     * [−180°, 180°].
      *
      * If either point is a pole, the cosine of its latitude is taken to be
      * 1/ε<sup>2</sup> (where ε is 2<sup>-52</sup>).  This
@@ -502,7 +502,7 @@ namespace GeographicLib {
      * @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
      *
      * The value of \e lon2 returned is in the range [−180°,
-     * 180°).
+     * 180°].
      *
      * If \e s12 is large enough that the rhumb line crosses a pole, the
      * longitude of point 2 is indeterminate (a NaN is returned for \e lon2 and
@@ -539,7 +539,7 @@ namespace GeographicLib {
      * - \e outmask |= RhumbLine::AREA for the area \e S12;
      * - \e outmask |= RhumbLine::ALL for all of the above;
      * - \e outmask |= RhumbLine::LONG_UNROLL to unroll \e lon2 instead of
-     *   wrapping it into the range [−180°, 180°).
+     *   wrapping it into the range [−180°, 180°].
      * .
      * With the RhumbLine::LONG_UNROLL bit set, the quantity \e lon2 − \e
      * lon1 indicates how many times and in what sense the rhumb line encircles
diff --git a/include/GeographicLib/SphericalHarmonic.hpp b/include/GeographicLib/SphericalHarmonic.hpp
index a500ef8..cf9195b 100644
--- a/include/GeographicLib/SphericalHarmonic.hpp
+++ b/include/GeographicLib/SphericalHarmonic.hpp
@@ -45,7 +45,7 @@ namespace GeographicLib {
    *
    * References:
    * - C. W. Clenshaw,
-   *   <a href="https://dx.doi.org/10.1090/S0025-5718-1955-0071856-0">
+   *   <a href="https://doi.org/10.1090/S0025-5718-1955-0071856-0">
    *   A note on the summation of Chebyshev series</a>,
    *   %Math. Tables Aids Comput. 9(51), 118--120 (1955).
    * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics
@@ -53,7 +53,7 @@ namespace GeographicLib {
    * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San
    *   Francisco, 1967).  (See Sec. 1-14, for a definition of Pbar.)
    * - S. A. Holmes and W. E. Featherstone,
-   *   <a href="https://dx.doi.org/10.1007/s00190-002-0216-2">
+   *   <a href="https://doi.org/10.1007/s00190-002-0216-2">
    *   A unified approach to the Clenshaw summation and the recursive
    *   computation of very high degree and order normalised associated Legendre
    *   functions</a>, J. Geodesy 76(5), 279--299 (2002).
diff --git a/include/GeographicLib/TransverseMercator.hpp b/include/GeographicLib/TransverseMercator.hpp
index 0ea977b..a822b7c 100644
--- a/include/GeographicLib/TransverseMercator.hpp
+++ b/include/GeographicLib/TransverseMercator.hpp
@@ -2,7 +2,7 @@
  * \file TransverseMercator.hpp
  * \brief Header for GeographicLib::TransverseMercator class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -30,23 +30,23 @@ namespace GeographicLib {
    * This uses Krüger's method which evaluates the projection and its
    * inverse in terms of a series.  See
    *  - L. Krüger,
-   *    <a href="https://dx.doi.org/10.2312/GFZ.b103-krueger28"> Konforme
+   *    <a href="https://doi.org/10.2312/GFZ.b103-krueger28"> Konforme
    *    Abbildung des Erdellipsoids in der Ebene</a> (Conformal mapping of the
    *    ellipsoidal earth to the plane), Royal Prussian Geodetic Institute, New
    *    Series 52, 172 pp. (1912).
    *  - C. F. F. Karney,
-   *    <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   *    <a href="https://doi.org/10.1007/s00190-011-0445-3">
    *    Transverse Mercator with an accuracy of a few nanometers,</a>
    *    J. Geodesy 85(8), 475--485 (Aug. 2011);
    *    preprint
-   *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
+   *    <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
    *
    * Krüger's method has been extended from 4th to 6th order.  The maximum
    * error is 5 nm (5 nanometers), ground distance, for all positions within 35
    * degrees of the central meridian.  The error in the convergence is 2
    * × 10<sup>−15</sup>" and the relative error in the scale
    * is 6 × 10<sup>−12</sup>%%.  See Sec. 4 of
-   * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
+   * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
    * The speed penalty in going to 6th order is only about 1%.
    *
    * There's a singularity in the projection at φ = 0°, λ
@@ -138,7 +138,7 @@ namespace GeographicLib {
      * @param[out] k scale of projection at point.
      *
      * No false easting or northing is added.  The value of \e lon returned is
-     * in the range [−180°, 180°).
+     * in the range [−180°, 180°].
      **********************************************************************/
     void Reverse(real lon0, real x, real y,
                  real& lat, real& lon, real& gamma, real& k) const;
diff --git a/include/GeographicLib/TransverseMercatorExact.hpp b/include/GeographicLib/TransverseMercatorExact.hpp
index a9841b7..ad34fad 100644
--- a/include/GeographicLib/TransverseMercatorExact.hpp
+++ b/include/GeographicLib/TransverseMercatorExact.hpp
@@ -2,7 +2,7 @@
  * \file TransverseMercatorExact.hpp
  * \brief Header for GeographicLib::TransverseMercatorExact class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -20,7 +20,7 @@ namespace GeographicLib {
    *
    * Implementation of the Transverse Mercator Projection given in
    *  - L. P. Lee,
-   *    <a href="https://dx.doi.org/10.3138/X687-1574-4325-WM62"> Conformal
+   *    <a href="https://doi.org/10.3138/X687-1574-4325-WM62"> Conformal
    *    Projections Based On Jacobian Elliptic Functions</a>, Part V of
    *    Conformal Projections Based on Elliptic Functions,
    *    (B. V. Gutsell, Toronto, 1976), 128pp.,
@@ -28,11 +28,11 @@ namespace GeographicLib {
    *    (also appeared as:
    *    Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13).
    *  - C. F. F. Karney,
-   *    <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">
+   *    <a href="https://doi.org/10.1007/s00190-011-0445-3">
    *    Transverse Mercator with an accuracy of a few nanometers,</a>
    *    J. Geodesy 85(8), 475--485 (Aug. 2011);
    *    preprint
-   *    <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
+   *    <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>.
    *
    * Lee gives the correct results for forward and reverse transformations
    * subject to the branch cut rules (see the description of the \e extendp
@@ -41,7 +41,7 @@ namespace GeographicLib {
    * The error in the convergence is 2 × 10<sup>−15</sup>",
    * the relative error in the scale is 7 × 10<sup>−12</sup>%%.
    * See Sec. 3 of
-   * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
+   * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for details.
    * The method is "exact" in the sense that the errors are close to the
    * round-off limit and that no changes are needed in the algorithms for them
    * to be used with reals of a higher precision.  Thus the errors using long
@@ -80,7 +80,7 @@ namespace GeographicLib {
   private:
     typedef Math::real real;
     static const int numit_ = 10;
-    real tol_, tol1_, tol2_, taytol_;
+    real tol_, tol2_, taytol_;
     real _a, _f, _k0, _mu, _mv, _e;
     bool _extendp;
     EllipticFunction _Eu, _Ev;
@@ -153,7 +153,7 @@ namespace GeographicLib {
      *     a) in (−∞, 0]
      * .
      * See Sec. 5 of
-     * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a full
+     * <a href="https://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a full
      * discussion of the treatment of the branch cut.
      *
      * The method will work for all ellipsoids used in terrestrial geodesy.
@@ -194,7 +194,7 @@ namespace GeographicLib {
      * @param[out] k scale of projection at point.
      *
      * No false easting or northing is added.  The value of \e lon returned is
-     * in the range [−180°, 180°).
+     * in the range [−180°, 180°].
      **********************************************************************/
     void Reverse(real lon0, real x, real y,
                  real& lat, real& lon, real& gamma, real& k) const;
diff --git a/include/GeographicLib/Utility.hpp b/include/GeographicLib/Utility.hpp
index 90bfe57..e3943b9 100644
--- a/include/GeographicLib/Utility.hpp
+++ b/include/GeographicLib/Utility.hpp
@@ -2,7 +2,7 @@
  * \file Utility.hpp
  * \brief Header for GeographicLib::Utility class
  *
- * Copyright (c) Charles Karney (2011-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -188,27 +188,27 @@ namespace GeographicLib {
       const char* digits = "0123456789";
       std::string::size_type p1 = s.find_first_not_of(digits);
       if (p1 == std::string::npos)
-        y1 = num<int>(s);
+        y1 = val<int>(s);
       else if (s[p1] != '-')
         throw GeographicErr("Delimiter not hyphen in date " + s);
       else if (p1 == 0)
         throw GeographicErr("Empty year field in date " + s);
       else {
-        y1 = num<int>(s.substr(0, p1));
+        y1 = val<int>(s.substr(0, p1));
         if (++p1 == s.size())
           throw GeographicErr("Empty month field in date " + s);
         std::string::size_type p2 = s.find_first_not_of(digits, p1);
         if (p2 == std::string::npos)
-          m1 = num<int>(s.substr(p1));
+          m1 = val<int>(s.substr(p1));
         else if (s[p2] != '-')
           throw GeographicErr("Delimiter not hyphen in date " + s);
         else if (p2 == p1)
           throw GeographicErr("Empty month field in date " + s);
         else {
-          m1 = num<int>(s.substr(p1, p2 - p1));
+          m1 = val<int>(s.substr(p1, p2 - p1));
           if (++p2 == s.size())
             throw GeographicErr("Empty day field in date " + s);
-          d1 = num<int>(s.substr(p2));
+          d1 = val<int>(s.substr(p2));
         }
       }
       y = y1; m = m1; d = d1;
@@ -251,10 +251,9 @@ namespace GeographicLib {
      **********************************************************************/
     template<typename T> static T fractionalyear(const std::string& s) {
       try {
-        return num<T>(s);
-      }
-      catch (const std::exception&) {
+        return val<T>(s);
       }
+      catch (const std::exception&) {}
       int y, m, d;
       date(s, y, m, d);
       int t = day(y, m, d, true);
@@ -316,26 +315,51 @@ namespace GeographicLib {
     }
 
     /**
-     * Convert a string to an object of type T.
+     * Trim the white space from the beginning and end of a string.
      *
-     * @tparam T the type of the return value.
-     * @param[in] s the string to be converted.
-     * @exception GeographicErr is \e s is not readable as a T.
-     * @return object of type T
-     *
-     * White space at the beginning and end of \e s is ignored.
+     * @param[in] s the string to be trimmed
+     * @return the trimmed string
      **********************************************************************/
-    template<typename T> static T num(const std::string& s) {
-      T x;
-      std::string errmsg;
-      std::string::size_type
+    static std::string trim(const std::string& s) {
+      unsigned
         beg = 0,
         end = unsigned(s.size());
       while (beg < end && isspace(s[beg]))
         ++beg;
       while (beg < end && isspace(s[end - 1]))
         --end;
-      std::string t = s.substr(beg, end-beg);
+      return std::string(s, beg, end-beg);
+    }
+
+    /**
+     * Convert a string to type T.
+     *
+     * @tparam T the type of the return value.
+     * @param[in] s the string to be converted.
+     * @exception GeographicErr is \e s is not readable as a T.
+     * @return object of type T.
+     *
+     * White space at the beginning and end of \e s is ignored.
+     *
+     * Special handling is provided for some types.
+     *
+     * If T is a floating point type, then inf and nan are recognized.
+     *
+     * If T is bool, then \e s should either be string a representing 0 (false)
+     * or 1 (true) or one of the strings
+     * - "false", "f", "nil", "no", "n", "off", or "" meaning false,
+     * - "true", "t", "yes", "y", or "on" meaning true;
+     * .
+     * case is ignored.
+     *
+     * If T is std::string, then \e s is returned (with the white space at the
+     * beginning and end removed).
+     **********************************************************************/
+    template<typename T> static T val(const std::string& s) {
+      // If T is bool, then the specialization val<bool>() defined below is
+      // used.
+      T x;
+      std::string errmsg, t(trim(s));
       do {                     // Executed once (provides the ability to break)
         std::istringstream is(t);
         if (!(is >> x)) {
@@ -354,11 +378,20 @@ namespace GeographicLib {
         throw GeographicErr(errmsg);
       return x;
     }
+    /**
+     * \deprecated An old name for val<T>(s).
+     **********************************************************************/
+    template<typename T>
+      // GEOGRAPHICLIB_DEPRECATED("Use new Utility::val<T>(s)")
+      static T num(const std::string& s) {
+      return val<T>(s);
+    }
 
     /**
      * Match "nan" and "inf" (and variants thereof) in a string.
      *
-     * @tparam T the type of the return value.
+     * @tparam T the type of the return value (this should be a floating point
+     *   type).
      * @param[in] s the string to be matched.
      * @return appropriate special value (±∞, nan) or 0 if none is
      *   found.
@@ -396,7 +429,7 @@ namespace GeographicLib {
      * @exception GeographicErr is \e s is not readable as a fraction of type T.
      * @return object of type T
      *
-     * <b>NOTE</b>: The msys shell under Windows converts arguments which look
+     * \note The msys shell under Windows converts arguments which look
      * like pathnames into their Windows equivalents.  As a result the argument
      * "-1/300" gets mangled into something unrecognizable.  A workaround is to
      * use a floating point number in the numerator, i.e., "-1.0/300".
@@ -405,9 +438,9 @@ namespace GeographicLib {
       std::string::size_type delim = s.find('/');
       return
         !(delim != std::string::npos && delim >= 1 && delim + 2 <= s.size()) ?
-        num<T>(s) :
+        val<T>(s) :
         // delim in [1, size() - 2]
-        num<T>(s.substr(0, delim)) / num<T>(s.substr(delim + 1));
+        val<T>(s.substr(0, delim)) / val<T>(s.substr(delim + 1));
     }
 
     /**
@@ -591,7 +624,7 @@ namespace GeographicLib {
      *   256 (i.e., about 77 decimal digits).
      * @return the resulting number of bits of precision.
      *
-     * This only has an effect when GEOGRAPHICLIB_PRECISION == 5.  The
+     * This only has an effect when GEOGRAPHICLIB_PRECISION = 5.  The
      * precision should only be set once and before calls to any other
      * GeographicLib functions.  (Several functions, for example Math::pi(),
      * cache the return value in a static local variable.  The precision needs
@@ -603,6 +636,49 @@ namespace GeographicLib {
 
   };
 
+  /**
+   * The specialization of Utility::val<T>() for strings.
+   **********************************************************************/
+  template<> inline std::string Utility::val<std::string>(const std::string& s)
+  { return trim(s); }
+
+  /**
+   * The specialization of Utility::val<T>() for bools.
+   **********************************************************************/
+  template<> inline bool Utility::val<bool>(const std::string& s) {
+    std::string t(trim(s));
+    if (t.empty()) return false;
+    bool x;
+    std::istringstream is(t);
+    if (is >> x) {
+      int pos = int(is.tellg()); // Returns -1 at end of string?
+      if (!(pos < 0 || pos == int(t.size())))
+        throw GeographicErr("Extra text " + t.substr(pos) +
+                            " at end of " + t);
+      return x;
+    }
+    std::transform(t.begin(), t.end(), t.begin(), (int(*)(int))tolower);
+    switch (t[0]) {             // already checked that t isn't empty
+    case 'f':
+      if (t == "f" || t == "false") return false;
+      break;
+    case 'n':
+      if (t == "n" || t == "nil" || t == "no") return false;
+      break;
+    case 'o':
+      if (t == "off") return false;
+      else if (t == "on") return true;
+      break;
+    case 't':
+      if (t == "t" || t == "true") return true;
+      break;
+    case 'y':
+      if (t == "y" || t == "yes") return true;
+      break;
+    }
+    throw GeographicErr("Cannot decode " + t + " as a bool");
+  }
+
 } // namespace GeographicLib
 
 #if defined(_MSC_VER)
diff --git a/include/Makefile.am b/include/Makefile.am
index 2415eb4..369ca95 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -31,6 +31,7 @@ nobase_include_HEADERS = GeographicLib/Accumulator.hpp \
 			GeographicLib/MagneticCircle.hpp \
 			GeographicLib/MagneticModel.hpp \
 			GeographicLib/Math.hpp \
+			GeographicLib/NearestNeighbor.hpp \
 			GeographicLib/NormalGravity.hpp \
 			GeographicLib/OSGB.hpp \
 			GeographicLib/PolarStereographic.hpp \
diff --git a/include/Makefile.in b/include/Makefile.in
index 790da3d..df826e1 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -247,6 +247,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -297,6 +300,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -340,6 +344,7 @@ nobase_include_HEADERS = GeographicLib/Accumulator.hpp \
 			GeographicLib/MagneticCircle.hpp \
 			GeographicLib/MagneticModel.hpp \
 			GeographicLib/Math.hpp \
+			GeographicLib/NearestNeighbor.hpp \
 			GeographicLib/NormalGravity.hpp \
 			GeographicLib/OSGB.hpp \
 			GeographicLib/PolarStereographic.hpp \
diff --git a/include/Makefile.mk b/include/Makefile.mk
index 6337b24..a9225cd 100644
--- a/include/Makefile.mk
+++ b/include/Makefile.mk
@@ -36,6 +36,7 @@ MODULES = Accumulator \
 	UTMUPS \
 	Utility
 EXTRAHEADERS = Constants \
+	NearestNeighbor \
 	SphericalHarmonic \
 	SphericalHarmonic1 \
 	SphericalHarmonic2
diff --git a/java/README.txt b/java/README.txt
index 5092129..6ef15ec 100644
--- a/java/README.txt
+++ b/java/README.txt
@@ -3,7 +3,7 @@ This is a Java implementation of the geodesic algorithms described in
   C. F. F. Karney,
   Algorithms for geodesics,
   J. Geodesy 87, 43-55 (2013);
-  https://dx.doi.org/10.1007/s00190-012-0578-z
+  https://doi.org/10.1007/s00190-012-0578-z
   Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 
 For documentation, see
@@ -18,4 +18,9 @@ programs using, for example,
   javac -cp .:../../../../src/main/java Inverse.java
   echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse
 
+On Windows, change this to
+  cd inverse\src\main\java
+  javac -cp .;../../../../src/main/java Inverse.java
+  echo -30 0 29.5 179.5 | java -cp .;../../../../src/main/java Inverse
+
 Building with maven is also supported (see the documentation).
diff --git a/java/direct/pom.xml b/java/direct/pom.xml
index 7f4236a..af381cf 100644
--- a/java/direct/pom.xml
+++ b/java/direct/pom.xml
@@ -9,7 +9,7 @@
   <groupId>net.sf.geographiclib.example</groupId>
   <artifactId>Direct</artifactId>
   <name>Direct</name>
-  <version>1.46-SNAPSHOT</version>
+  <version>1.47-SNAPSHOT</version>
 
   <packaging>jar</packaging>
 
@@ -28,7 +28,7 @@
     <dependency>
       <groupId>net.sf.geographiclib</groupId>
       <artifactId>GeographicLib-Java</artifactId>
-      <version>1.46</version>
+      <version>1.47</version>
     </dependency>
   </dependencies>
 
diff --git a/java/inverse/pom.xml b/java/inverse/pom.xml
index 85ea443..1c6afec 100644
--- a/java/inverse/pom.xml
+++ b/java/inverse/pom.xml
@@ -9,7 +9,7 @@
   <groupId>net.sf.geographiclib.example</groupId>
   <artifactId>Inverse</artifactId>
   <name>Inverse</name>
-  <version>1.46-SNAPSHOT</version>
+  <version>1.47-SNAPSHOT</version>
 
   <packaging>jar</packaging>
 
@@ -28,7 +28,7 @@
     <dependency>
       <groupId>net.sf.geographiclib</groupId>
       <artifactId>GeographicLib-Java</artifactId>
-      <version>1.46</version>
+      <version>1.47</version>
     </dependency>
   </dependencies>
 
diff --git a/java/planimeter/pom.xml b/java/planimeter/pom.xml
index c524735..cb86102 100644
--- a/java/planimeter/pom.xml
+++ b/java/planimeter/pom.xml
@@ -9,7 +9,7 @@
   <groupId>net.sf.geographiclib.example</groupId>
   <artifactId>Planimeter</artifactId>
   <name>Planimeter</name>
-  <version>1.46-SNAPSHOT</version>
+  <version>1.47-SNAPSHOT</version>
 
   <packaging>jar</packaging>
 
@@ -28,7 +28,7 @@
     <dependency>
       <groupId>net.sf.geographiclib</groupId>
       <artifactId>GeographicLib-Java</artifactId>
-      <version>1.46</version>
+      <version>1.47</version>
     </dependency>
   </dependencies>
 
diff --git a/java/pom.xml b/java/pom.xml
index 65ab122..25ca9e2 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -8,7 +8,7 @@
 
   <groupId>net.sf.geographiclib</groupId>
   <artifactId>GeographicLib-Java</artifactId>
-  <version>1.46</version>
+  <version>1.47</version>
 
   <packaging>jar</packaging>
 
@@ -172,6 +172,7 @@
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>4.12</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
 
diff --git a/java/src/main/java/net/sf/geographiclib/Accumulator.java b/java/src/main/java/net/sf/geographiclib/Accumulator.java
index 1a8cf34..7dc7dee 100644
--- a/java/src/main/java/net/sf/geographiclib/Accumulator.java
+++ b/java/src/main/java/net/sf/geographiclib/Accumulator.java
@@ -15,7 +15,7 @@ package net.sf.geographiclib;
  * about 32 decimal places.
  * <p>
  * The implementation follows J. R. Shewchuk,
- * <a href="https://dx.doi.org/10.1007/PL00009321"> Adaptive Precision
+ * <a href="https://doi.org/10.1007/PL00009321"> Adaptive Precision
  * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>,
  * Discrete & Computational Geometry 18(3) 305–363 (1997).
  * <p>
diff --git a/java/src/main/java/net/sf/geographiclib/GeoMath.java b/java/src/main/java/net/sf/geographiclib/GeoMath.java
index 7bb6ead..6f36380 100644
--- a/java/src/main/java/net/sf/geographiclib/GeoMath.java
+++ b/java/src/main/java/net/sf/geographiclib/GeoMath.java
@@ -51,8 +51,8 @@ public class GeoMath {
     double a = Math.max(x, y), b = Math.min(x, y) / (a != 0 ? a : 1);
     return a * Math.sqrt(1 + b * b);
     // For an alternative method see
-    // C. Moler and D. Morrision (1983) https://dx.doi.org/10.1147/rd.276.0577
-    // and A. A. Dubrulle (1983) https://dx.doi.org/10.1147/rd.276.0582
+    // C. Moler and D. Morrision (1983) https://doi.org/10.1147/rd.276.0577
+    // and A. A. Dubrulle (1983) https://doi.org/10.1147/rd.276.0582
   }
 
   /**
@@ -60,7 +60,7 @@ public class GeoMath {
    * later, Math.log1p can be used.
    * <p>
    * This is taken from D. Goldberg,
-   * <a href="https://dx.doi.org/10.1145/103162.103163">What every computer
+   * <a href="https://doi.org/10.1145/103162.103163">What every computer
    * scientist should know about floating-point arithmetic</a> (1991),
    * Theorem 4.  See also, N. J. Higham, Accuracy and Stability of Numerical
    * Algorithms, 2nd Edition (SIAM, 2002), Answer to Problem 1.5, p 528.
diff --git a/java/src/main/java/net/sf/geographiclib/Geodesic.java b/java/src/main/java/net/sf/geographiclib/Geodesic.java
index 1f1cc99..df7fbb5 100644
--- a/java/src/main/java/net/sf/geographiclib/Geodesic.java
+++ b/java/src/main/java/net/sf/geographiclib/Geodesic.java
@@ -1,7 +1,7 @@
 /**
  * Implementation of the net.sf.geographiclib.Geodesic class
  *
- * Copyright (c) Charles Karney (2013-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2013-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -149,13 +149,13 @@ package net.sf.geographiclib;
  * <p>
  * The calculations are accurate to better than 15 nm (15 nanometers) for the
  * WGS84 ellipsoid.  See Sec. 9 of
- * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+ * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
  * details.  The algorithms used by this class are based on series expansions
  * using the flattening <i>f</i> as a small parameter.  These are only accurate
  * for |<i>f</i>| < 0.02; however reasonably accurate results will be
  * obtained for |<i>f</i>| < 0.2.  Here is a table of the approximate
  * maximum error (expressed as a distance) for an ellipsoid with the same
- * major radius as the WGS84 ellipsoid and different values of the
+ * equatorial radius as the WGS84 ellipsoid and different values of the
  * flattening.<pre>
  *     |f|      error
  *     0.01     25 nm
@@ -167,7 +167,7 @@ package net.sf.geographiclib;
  * The algorithms are described in
  * <ul>
  * <li>C. F. F. Karney,
- *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   Algorithms for geodesics</a>,
  *   J. Geodesy <b>87</b>, 43–55 (2013)
  *   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html">addenda</a>).
@@ -274,9 +274,9 @@ public class Geodesic {
               Math.sqrt( Math.max(0.001, Math.abs(_f)) *
                          Math.min(1.0, 1 - _f/2) / 2 );
     if (!(GeoMath.isfinite(_a) && _a > 0))
-      throw new GeographicErr("Major radius is not positive");
+      throw new GeographicErr("Equatorial radius is not positive");
     if (!(GeoMath.isfinite(_b) && _b > 0))
-      throw new GeographicErr("Minor radius is not positive");
+      throw new GeographicErr("Polar semi-axis is not positive");
     _A3x = new double[nA3x_];
     _C3x = new double[nC3x_];
     _C4x = new double[nC4x_];
@@ -737,7 +737,7 @@ public class Geodesic {
 
       // sig12 = sig2 - sig1
       sig12 = Math.atan2(Math.max(0.0, csig1 * ssig2 - ssig1 * csig2),
-                    csig1 * csig2 + ssig1 * ssig2);
+                                       csig1 * csig2 + ssig1 * ssig2);
       {
         LengthsV v =
           Lengths(_n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2,
@@ -821,8 +821,8 @@ public class Geodesic {
         // value of alp1 is then further from the solution) or if the new
         // estimate of alp1 lies outside (0,pi); in this case, the new starting
         // guess is taken to be (alp1a + alp1b) / 2.
-        double ssig1, csig1, ssig2, csig2, eps;
-        ssig1 = csig1 = ssig2 = csig2 = eps = Double.NaN;
+        double ssig1, csig1, ssig2, csig2, eps, domg12;
+        ssig1 = csig1 = ssig2 = csig2 = eps = domg12 = Double.NaN;
         int numit = 0;
         // Bracketing range
         double salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1;
@@ -839,7 +839,7 @@ public class Geodesic {
             sig12 = w.sig12;
             ssig1 = w.ssig1; csig1 = w.csig1;
             ssig2 = w.ssig2; csig2 = w.csig2;
-            eps = w.eps; comg12 = w.comg12; somg12 = w.somg12;
+            eps = w.eps; domg12 = w.domg12;
             dv = w.dlam12;
           }
           // 2 * tol0 is approximately 1 ulp for a number in [0, pi].
@@ -903,6 +903,12 @@ public class Geodesic {
         m12x *= _b;
         s12x *= _b;
         a12 = Math.toDegrees(sig12);
+        if ((outmask & GeodesicMask.AREA) != 0) {
+          // omg12 = lam12 - domg12
+          double sdomg12 = Math.sin(domg12), cdomg12 = Math.cos(domg12);
+          somg12 = slam12 * cdomg12 - clam12 * sdomg12;
+          comg12 = clam12 * cdomg12 + slam12 * sdomg12;
+        }
       }
     }
 
@@ -941,13 +947,8 @@ public class Geodesic {
         // Avoid problems with indeterminate sig1, sig2 on equator
         r.S12 = 0;
 
-      if (!meridian) {
-        if (somg12 > 1) {
-          somg12 = Math.sin(omg12); comg12 = Math.cos(omg12);
-        } else {
-          Pair p = GeoMath.norm(somg12, comg12);
-          somg12 = p.first; comg12 = p.second;
-        }
+      if (!meridian && somg12 > 1) {
+        somg12 = Math.sin(omg12); comg12 = Math.cos(omg12);
       }
 
       if (!meridian &&
@@ -1540,10 +1541,10 @@ public class Geodesic {
 
   private class Lambda12V {
     private double lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-      eps, somg12, comg12, dlam12;
+      eps, domg12, dlam12;
     private Lambda12V() {
       lam12 = salp2 = calp2 = sig12 = ssig1 = csig1 = ssig2 = csig2
-        = eps = somg12 = comg12 = dlam12 = Double.NaN;
+        = eps = domg12 = dlam12 = Double.NaN;
     }
   }
 
@@ -1569,7 +1570,7 @@ public class Geodesic {
       salp0 = salp1 * cbet1,
       calp0 = GeoMath.hypot(calp1, salp1 * sbet1); // calp0 > 0
 
-    double somg1, comg1, somg2, comg2;
+    double somg1, comg1, somg2, comg2, somg12, comg12;
     // tan(bet1) = tan(sig1) * cos(alp1)
     // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1)
     w.ssig1 = sbet1; somg1 = salp0 * sbet1;
@@ -1603,21 +1604,22 @@ public class Geodesic {
 
     // sig12 = sig2 - sig1, limit to [0, pi]
     w.sig12 = Math.atan2(Math.max(0.0, w.csig1 * w.ssig2 - w.ssig1 * w.csig2),
-                  w.csig1 * w.csig2 + w.ssig1 * w.ssig2);
+                                       w.csig1 * w.csig2 + w.ssig1 * w.ssig2);
 
     // omg12 = omg2 - omg1, limit to [0, pi]
-    w.somg12 = Math.max(0.0, comg1 * somg2 - somg1 * comg2);
-    w.comg12 =               comg1 * comg2 + somg1 * somg2;
+    somg12 = Math.max(0.0, comg1 * somg2 - somg1 * comg2);
+    comg12 =               comg1 * comg2 + somg1 * somg2;
     // eta = omg12 - lam120
-    double eta = Math.atan2(w.somg12 * clam120 - w.comg12 * slam120,
-                            w.comg12 * clam120 + w.somg12 * slam120);
+    double eta = Math.atan2(somg12 * clam120 - comg12 * slam120,
+                            comg12 * clam120 + somg12 * slam120);
     double B312;
     double k2 = GeoMath.sq(calp0) * _ep2;
     w.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
     C3f(w.eps, C3a);
     B312 = (SinCosSeries(true, w.ssig2, w.csig2, C3a) -
             SinCosSeries(true, w.ssig1, w.csig1, C3a));
-    w.lam12 = eta - _f * A3f(w.eps) * salp0 * (w.sig12 + B312);
+    w.domg12 = -_f * A3f(w.eps) * salp0 * (w.sig12 + B312);
+    w.lam12 = eta + w.domg12;
 
     if (diffp) {
       if (w.calp2 == 0)
diff --git a/java/src/main/java/net/sf/geographiclib/GeodesicLine.java b/java/src/main/java/net/sf/geographiclib/GeodesicLine.java
index d0cf9f6..a81fb7c 100644
--- a/java/src/main/java/net/sf/geographiclib/GeodesicLine.java
+++ b/java/src/main/java/net/sf/geographiclib/GeodesicLine.java
@@ -33,7 +33,7 @@ package net.sf.geographiclib;
  * <p>
  * The calculations are accurate to better than 15 nm (15 nanometers).  See
  * Sec. 9 of
- * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
+ * <a href="https://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for
  * details.  The algorithms used by this class are based on series expansions
  * using the flattening <i>f</i> as a small parameter.  These are only accurate
  * for |<i>f</i>| < 0.02; however reasonably accurate results will be
@@ -43,7 +43,7 @@ package net.sf.geographiclib;
  * <ul>
  * <li>
  *   C. F. F. Karney,
- *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   Algorithms for geodesics</a>,
  *   J. Geodesy <b>87</b>, 43–55 (2013)
  *   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html">addenda</a>).
diff --git a/java/src/main/java/net/sf/geographiclib/Gnomonic.java b/java/src/main/java/net/sf/geographiclib/Gnomonic.java
index 2319263..9335008 100644
--- a/java/src/main/java/net/sf/geographiclib/Gnomonic.java
+++ b/java/src/main/java/net/sf/geographiclib/Gnomonic.java
@@ -19,9 +19,9 @@ package net.sf.geographiclib;
  * ellipsoid. This projection is derived in Section 8 of
  * <ul>
  * <li>
- * C. F. F. Karney, <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
+ * C. F. F. Karney, <a href="http://doi.org/10.1007/s00190-012-0578-z">
  * Algorithms for geodesics</a>, J. Geodesy <b>87</b>, 43–55 (2013);
- * DOI: <a href="http://dx.doi.org/10.1007/s00190-012-0578-z">
+ * DOI: <a href="http://doi.org/10.1007/s00190-012-0578-z">
  * 10.1007/s00190-012-0578-z</a>; addenda:
  * <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
  * geod-addenda.html</a>.
diff --git a/java/src/main/java/net/sf/geographiclib/PolygonArea.java b/java/src/main/java/net/sf/geographiclib/PolygonArea.java
index f98ab60..3376d04 100644
--- a/java/src/main/java/net/sf/geographiclib/PolygonArea.java
+++ b/java/src/main/java/net/sf/geographiclib/PolygonArea.java
@@ -15,7 +15,7 @@ package net.sf.geographiclib;
  * <ul>
  * <li>
  *   C. F. F. Karney,
- *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   Algorithms for geodesics</a>,
  *   J. Geodesy <b>87</b>, 43–55 (2013)
  *   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html">addenda</a>).
diff --git a/java/src/main/java/net/sf/geographiclib/package-info.java b/java/src/main/java/net/sf/geographiclib/package-info.java
index f87e016..eeb47e8 100644
--- a/java/src/main/java/net/sf/geographiclib/package-info.java
+++ b/java/src/main/java/net/sf/geographiclib/package-info.java
@@ -1,7 +1,7 @@
 /**
  * <h1>Geodesic routines from GeographicLib implemented in Java</h1>
  * @author Charles F. F. Karney (charles at karney.com)
- * @version 1.46
+ * @version 1.47
  *
  * <p>
  * The documentation for other versions is available at
@@ -29,15 +29,15 @@
  * GeographicLib-Java is part of GeographicLib which available for download at
  * <ul>
  * <li>
- *   <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.tar.gz">
- *   GeographicLib-1.46.tar.gz</a>
+ *   <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.tar.gz">
+ *   GeographicLib-1.47.tar.gz</a>
  * <li>
- *   <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.46.zip">
- *   GeographicLib-1.46.zip</a>
+ *   <a href="https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.47.zip">
+ *   GeographicLib-1.47.zip</a>
  * </ul>
  * <p>
  * as either a compressed tar file (tar.gz) or a zip file.  After unpacking
- * the source, the Java library can be found in GeographicLib-1.46/java.  (This
+ * the source, the Java library can be found in GeographicLib-1.47/java.  (This
  * library is completely independent from the rest of GeodegraphicLib.)  The
  * library consists of the files in the src/main/java/net/sf/geographiclib
  * subdirectory.
@@ -50,7 +50,7 @@
  *   <dependency>
  *     <groupId>net.sf.geographiclib</groupId>
  *     <artifactId>GeographicLib-Java</artifactId>
- *     <version>1.46</version>
+ *     <version>1.47</version>
  *   </dependency> }</pre>
  * in your {@code pom.xml}.
  *
@@ -106,6 +106,10 @@
  * cd inverse/src/main/java
  * javac -cp .:../../../../src/main/java Inverse.java
  * echo -30 0 29.5 179.5 | java -cp .:../../../../src/main/java Inverse </pre>
+ * On Windows, change this to <pre>
+ * cd inverse\src\main\java
+ * javac -cp .;../../../../src/main/java Inverse.java
+ * echo -30 0 29.5 179.5 | java -cp .;../../../../src/main/java Inverse </pre>
  *
  * <h3>Using maven to package GeographicLib</h3>
  * Use <a href="http://maven.apache.org/">maven</a> to create a jar file by
@@ -115,9 +119,9 @@
  * some additional packages to your local repository.)  Then compile and run
  * Inverse.java with <pre>
  * cd inverse/src/main/java
- * javac -cp .:../../../../target/GeographicLib-Java-1.46.jar Inverse.java
+ * javac -cp .:../../../../target/GeographicLib-Java-1.47.jar Inverse.java
  * echo -30 0 29.5 179.5 |
- *   java -cp .:../../../../target/GeographicLib-Java-1.46.jar Inverse </pre>
+ *   java -cp .:../../../../target/GeographicLib-Java-1.47.jar Inverse </pre>
  *
  * <h3>Using maven to build and run {@code Inverse.java}</h3>
  * The sample code includes a {@code pom.xml} which specifies
@@ -177,13 +181,13 @@
  * <ul>
  * <li>
  *   These algorithms are derived in C. F. F. Karney,
- *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   Algorithms for geodesics</a>,
  *   J. Geodesy <b>87</b>, 43–55 (2013)
  *   (<a href="http://geographiclib.sourceforge.net/geod-addenda.html">addenda</a>).
  * <li>
  *   A longer paper on geodesics: C. F. F. Karney,
- *    <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
+ *    <a href="https://arxiv.org/abs/1102.1215v1">Geodesics
  *    on an ellipsoid of revolution</a>,
  *    Feb. 2011
  *    (<a href="http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata">
@@ -261,6 +265,14 @@
  * <h2>Change log</h2>
  * <ul>
  * <li>
+ *   <a href="http://geographiclib.sourceforge.net/1.47/java">Version 1.47</a>
+ *   (released 2017-02-15)
+ * <ul>
+ * <li>
+ *   Improve accuracy of area calculation (fixing a flaw introduced in
+ *   version 1.46).
+ * </ul>
+ * <li>
  *   <a href="http://geographiclib.sourceforge.net/1.46/java">Version 1.46</a>
  *   (released 2016-02-15)
  * <ul>
diff --git a/java/src/test/java/net/sf/geographiclib/GeodesicTest.java b/java/src/test/java/net/sf/geographiclib/GeodesicTest.java
index de4aa0c..0ca0c9b 100644
--- a/java/src/test/java/net/sf/geographiclib/GeodesicTest.java
+++ b/java/src/test/java/net/sf/geographiclib/GeodesicTest.java
@@ -534,6 +534,23 @@ public class GeodesicTest {
   }
 
   @Test
+  public void GeodSolve74() {
+    // Check fix for inaccurate areas, bug introduced in v1.46, fixed
+    // 2015-10-16.
+    GeodesicData inv = Geodesic.WGS84.Inverse(54.1589, 15.3872,
+                                              54.1591, 15.3877,
+                                              GeodesicMask.ALL);
+    assertEquals(inv.azi1, 55.723110355, 5e-9);
+    assertEquals(inv.azi2, 55.723515675, 5e-9);
+    assertEquals(inv.s12,  39.527686385, 5e-9);
+    assertEquals(inv.a12,   0.000355495, 5e-9);
+    assertEquals(inv.m12,  39.527686385, 5e-9);
+    assertEquals(inv.M12,   0.999999995, 5e-9);
+    assertEquals(inv.M21,   0.999999995, 5e-9);
+    assertEquals(inv.S12, 286698586.30197, 5e-4);
+  }
+
+  @Test
   public void Planimeter0() {
     // Check fix for pole-encircling bug found 2011-03-16
     double pa[][] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}};
diff --git a/js/GeographicLib.md b/js/GeographicLib.md
index c244568..a0eee0d 100644
--- a/js/GeographicLib.md
+++ b/js/GeographicLib.md
@@ -1,6 +1,6 @@
 ## Geodesic routines from GeographicLib
 
-This documentation applies to version 1.46.
+This documentation applies to version 1.47.
 
 The documentation for other versions is available
 at <tt>http://geographiclib.sourceforge.net/m.nn/js</tt> for versions
@@ -109,6 +109,10 @@ Two examples of this library in use are
 
 ### Change log
 
+* Version 1.47 (released 2017-02-15)
+  * Improve accuracy of area calculation (fixing a flaw introduced in
+    version 1.46).
+
 * Version 1.46 (released 2016-02-15)
   * Fix bugs in PolygonArea.TestEdge (problem found by threepointone).
   * Add Geodesic.DirectLine, Geodesic.ArcDirectLine,
diff --git a/js/HEADER.js b/js/HEADER.js
index 258ce49..a9ee1be 100644
--- a/js/HEADER.js
+++ b/js/HEADER.js
@@ -6,7 +6,7 @@
  *
  *    Charles F. F. Karney,
  *    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
- *    https://dx.doi.org/10.1007/s00190-012-0578-z
+ *    https://doi.org/10.1007/s00190-012-0578-z
  *    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
  *
  * This file is the concatenation and compression of the JavaScript files in
diff --git a/js/Makefile.in b/js/Makefile.in
index 5582fa8..245373b 100644
--- a/js/Makefile.in
+++ b/js/Makefile.in
@@ -193,6 +193,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -243,6 +246,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/js/README.md b/js/README.md
index d4cc034..7a56ede 100644
--- a/js/README.md
+++ b/js/README.md
@@ -23,7 +23,7 @@ var GeographicLib = require("geographiclib");
 ## Documentation
 
 Full documentation is provided at
-[http://geographiclib.sourceforge.net/1.46/js/](http://geographiclib.sourceforge.net/1.46/js/).
+[http://geographiclib.sourceforge.net/1.47/js/](http://geographiclib.sourceforge.net/1.47/js/).
 
 ## Examples
 
diff --git a/js/doc/1-geodesics.md b/js/doc/1-geodesics.md
index d8d5383..867caf0 100644
--- a/js/doc/1-geodesics.md
+++ b/js/doc/1-geodesics.md
@@ -139,12 +139,12 @@ Vincenty (1975) in the following respects:
 ### <a name="references"></a>References
 
 * F. W. Bessel,
-  {@link http://arxiv.org/abs/0908.1824 The calculation of longitude and
+  {@link https://arxiv.org/abs/0908.1824 The calculation of longitude and
   latitude from geodesic measurements (1825)},
   Astron. Nachr. **331**(8), 852–861 (2010),
   translated by C. F. F. Karney and R. E. Deakin.
 * F. R. Helmert,
-  {@link https://dx.doi.org/10.5281/zenodo.32050
+  {@link https://doi.org/10.5281/zenodo.32050
   Mathematical and Physical Theories of Higher Geodesy, Vol 1},
   (Teubner, Leipzig, 1880), Chaps. 5–7.
 * T. Vincenty,
@@ -153,14 +153,14 @@ Vincenty (1975) in the following respects:
   application of nested equations},
   Survey Review **23**(176), 88–93 (1975).
 * J. Danielsen,
-  {@link https://dx.doi.org/10.1179/003962689791474267 The area under
+  {@link https://doi.org/10.1179/003962689791474267 The area under
   the geodesic}, Survey Review **30**(232), 61–66 (1989).
 * C. F. F. Karney,
-  {@link https://dx.doi.org/10.1007/s00190-012-0578-z
+  {@link https://doi.org/10.1007/s00190-012-0578-z
   Algorithms for geodesics}, J. Geodesy **87**(1) 43–55 (2013);
   {@link http://geographiclib.sourceforge.net/geod-addenda.html addenda}.
 * C. F. F. Karney,
-  {@http://arxiv.org/abs/1102.1215v1
+  {@https://arxiv.org/abs/1102.1215v1
   Geodesics on an ellipsoid of revolution},
   Feb. 2011;
   {@link http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata
diff --git a/js/doc/2-interface.md b/js/doc/2-interface.md
index bf9194b..6452d56 100644
--- a/js/doc/2-interface.md
+++ b/js/doc/2-interface.md
@@ -102,7 +102,7 @@ Note that *a12* is always included in the result.
 
 Reasonably accurate results can be obtained for −0.2 ≤ *f* ≤
 0.2.  Here is a table of the approximate maximum error (expressed as a
-distance) for an ellipsoid with the same major radius as the WGS84
+distance) for an ellipsoid with the same equatorial radius as the WGS84
 ellipsoid and different values of the flattening.
 
   | abs(f) | error
diff --git a/js/package.json b/js/package.json
index 5441399..c59626a 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
 {
   "name": "geographiclib",
-  "version": "1.46.0",
+  "version": "1.47.0",
   "description":
   "JavaScript implementation of geodesic routines in GeographicLib",
   "main": "geographiclib.js",
diff --git a/js/samples/geod-calc.html b/js/samples/geod-calc.html
index b28aff3..0449bf5 100644
--- a/js/samples/geod-calc.html
+++ b/js/samples/geod-calc.html
@@ -51,28 +51,23 @@ var geod = GeographicLib.Geodesic.WGS84,
   };
 
   /*
-   * split a geodesic line into k equal pieces which are no longer than about
-   * ds12 (but k cannot exceed maxk, default 20), and returns an array of
-   * length k + 1 of objects with fields lat, lon, azi.
+   * split a geodesic line into k approximately equal pieces which are no
+   * longer than about ds12 (but k cannot exceed maxk, default 20), and returns
+   * an array of length k + 1 of objects with fields lat, lon, azi.
    */
   g.Geodesic.prototype.InversePath =
     function(lat1, lon1, lat2, lon2, ds12, maxk) {
-      var t = this.Inverse(lat1, lon1, lat2, lon2),
-          k, points, line, da12, vals, i;
+      var line = this.InverseLine(lat1, lon1, lat2, lon2, g.STANDARD),
+          k, points, da12, vals, i;
       if (!maxk) maxk = 20;
       if (!(ds12 > 0))
         throw new Error("ds12 must be a positive number");
-      k = Math.max(1, Math.min(maxk, Math.ceil(t.s12/ds12)));
+      k = Math.max(1, Math.min(maxk, Math.ceil(line.s13 / ds12)));
       points = new Array(k + 1);
-      points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1};
-      points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2};
-      if (k > 1) {
-        line = this.Line(t.lat1, t.lon1, t.azi1, g.STANDARD);
-        da12 = t.a12/k;
-        for (i = 1; i < k; ++i) {
-          vals = line.ArcPosition(i * da12);
-          points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
-        }
+      da12 = line.a13 / k;
+      for (i = 0; i <= k; ++i) {
+        vals = line.ArcPosition(i * da12);
+        points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
       }
       return points;
     };
@@ -235,22 +230,21 @@ function GeodesicArea(input, polyline) {
       This page illustrates the geodesic routines available in
       JavaScript package
       <a href="https://www.npmjs.com/package/geographiclib">
-	geographiclib</a>, which is documented
-      <a href="http://geographiclib.sourceforge.net/html/js/">
-	here</a>.
+	geographiclib, the geodesic routines in GeographicLib</a>
+      (<a href="http://geographiclib.sourceforge.net/html/js/">documentation</a>).
       The algorithms are considerably more accurate than Vincenty's
       method, and offer more functionality (an inverse method which
       never fails to converge, differential properties of the geodesic,
       and the area under a geodesic).  The algorithms are derived in
       <blockquote>
 	Charles F. F. Karney,<br>
-	<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+	<a href="https://doi.org/10.1007/s00190-012-0578-z">
 	  <i>Algorithms for geodesics</i></a>,<br>
 	J. Geodesy <b>87</b>(1), 43–55 (Jan. 2013);<br>
 	DOI:
-	<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+	<a href="https://doi.org/10.1007/s00190-012-0578-z">
 	  10.1007/s00190-012-0578-z</a>
-	(<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">pdf</a>);
+	(<a href="https://doi.org/10.1007/s00190-012-0578-z">pdf</a>);
 	addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
 	  geod-addenda.html</a>.
       </blockquote>
diff --git a/js/samples/geod-google-instructions.html b/js/samples/geod-google-instructions.html
index 46a25e3..ee95a9d 100644
--- a/js/samples/geod-google-instructions.html
+++ b/js/samples/geod-google-instructions.html
@@ -81,7 +81,7 @@
       solves the inverse and direct geodesic problems, computes
       intermediate points on a geodesic, and finds the area of a
       geodesic polygon; it allows you to specify the precision of the
-      output and choose between decimal degrees and degress, minutes,
+      output and choose between decimal degrees and degrees, minutes,
       and seconds.  Basic online tools which provide similar capabilities
       are
       <a href="http://geographiclib.sourceforge.net/cgi-bin/GeodSolve">GeodSolve</a>
@@ -91,20 +91,20 @@
     </p>
     <p>
       The JavaScript code for computing the geodesic lines, circles, and
-      envelopes availabe in the JavaScript package
+      envelopes available in the JavaScript package
       <a href="https://www.npmjs.com/package/geographiclib">
-	geographiclib</a>, which is documented
-      <a href="http://geographiclib.sourceforge.net/html/js/">
-	here</a>.  The algorithms are derived in
+	geographiclib, the geodesic routines in GeographicLib</a>
+      (<a href="http://geographiclib.sourceforge.net/html/js/">
+	documentation</a>).  The algorithms are derived in
       <blockquote>
 	Charles F. F. Karney,<br>
-	<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+	<a href="https://doi.org/10.1007/s00190-012-0578-z">
 	  <i>Algorithms for geodesics</i></a>,<br>
 	J. Geodesy <b>87</b>(1), 43–55 (Jan. 2013);<br>
 	DOI:
-	<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+	<a href="https://doi.org/10.1007/s00190-012-0578-z">
 	  10.1007/s00190-012-0578-z</a>
-	(<a href="https://dx.doi.org/10.1007/s00190-012-0578-z">pdf</a>);<br>
+	(<a href="https://doi.org/10.1007/s00190-012-0578-z">pdf</a>);<br>
 	addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
 	  geod-addenda.html</a>.
       </blockquote>
diff --git a/js/samples/geod-google.html b/js/samples/geod-google.html
index bd7408a..ca34daa 100644
--- a/js/samples/geod-google.html
+++ b/js/samples/geod-google.html
@@ -53,28 +53,22 @@ var geod = GeographicLib.Geodesic.WGS84,
   "use strict";
 
   /*
-   * split a geodesic line into k equal pieces which are no longer than about
-   * ds12 (but k cannot exceed maxk, default 20), and returns an array of
-   * length k + 1 of objects with fields lat, lon, azi.
+   * split a geodesic line into k approximately equal pieces which are no
+   * longer than about ds12 (but k cannot exceed maxk, default 20), and returns
+   * an array of length k + 1 of objects with fields lat, lon, azi.
    */
-  g.Geodesic.prototype.DirectPath =
-    function(lat1, lon1, azi1, s12, ds12, maxk) {
-      var t = this.Direct(lat1, lon1, azi1, s12),
-          k, points, line, da12, vals, i;
+  g.Geodesic.prototype.Path =
+    function(line, ds12, maxk) {
+      var k, points, da12, vals, i;
       if (!maxk) maxk = 20;
       if (!(ds12 > 0))
         throw new Error("ds12 must be a positive number");
-      k = Math.max(1, Math.min(maxk, Math.ceil(Math.abs(t.s12)/ds12)));
+      k = Math.max(1, Math.min(maxk, Math.ceil(Math.abs(line.s13) / ds12)));
       points = new Array(k + 1);
-      points[0] = {lat: t.lat1, lon: t.lon1, azi: t.azi1};
-      points[k] = {lat: t.lat2, lon: t.lon2, azi: t.azi2};
-      if (k > 1) {
-        line = this.Line(t.lat1, t.lon1, t.azi1, g.STANDARD);
-        da12 = t.a12/k;
-        for (i = 1; i < k; ++i) {
-          vals = line.ArcPosition(i * da12);
-          points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
-        }
+      da12 = line.a13 / k;
+      for (i = 0; i <= k; ++i) {
+        vals = line.ArcPosition(i * da12);
+        points[i] = {lat: vals.lat2, lon: vals.lon2, azi: vals.azi2};
       }
       return points;
     };
@@ -201,7 +195,7 @@ function formatpoint(lat, lon, azi, dmsformat, prec) {
 function GeodesicInverse(input) {
   "use strict";
   var result = {},
-      t, p1, p2, v;
+      t, p1, p2, line, v;
   try {
     // Input is a blank-delimited line: lat1 lon1 lat2 lon2
     t = input;
@@ -210,12 +204,13 @@ function GeodesicInverse(input) {
       throw new Error("Need 4 input items");
     p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
     p2 = GeographicLib.DMS.DecodeLatLon(t[2], t[3]);
-    v = geod.Inverse(p1.lat, p1.lon, p2.lat, p2.lon);
+    line = geod.InverseLine(p1.lat, p1.lon, p2.lat, p2.lon);
     result.status = "OK";
+    v = line.ArcPosition(line.a13);
     result.p1 = formatpoint(v.lat1, v.lon1, v.azi1, true, 0);
     result.p2 = formatpoint(v.lat2, v.lon2, v.azi2, true, 0);
-    result.s12 = v.s12.toFixed(0);
-    draw(v);
+    result.s12 = line.s13.toFixed(0);
+    draw(line, v.lat2, v.lon2);
   }
   catch (e) {
     result.status = "ERROR: " + e.message;
@@ -229,7 +224,7 @@ function GeodesicInverse(input) {
 function GeodesicDirect(input) {
   "use strict";
   var result = {},
-      t, p1, azi1, s12, v;
+      t, p1, p2, azi1, s12, line, v;
   try {
     // Input is a blank-delimited line: lat1 lon1 azi1 s12
     t = input;
@@ -239,12 +234,13 @@ function GeodesicDirect(input) {
     p1 = GeographicLib.DMS.DecodeLatLon(t[0], t[1]);
     azi1 = GeographicLib.DMS.DecodeAzimuth(t[2]);
     s12 = parseFloat(t[3]);
-    v =  geod.Direct(p1.lat, p1.lon, azi1, s12);
+    line =  geod.DirectLine(p1.lat, p1.lon, azi1, s12);
     result.status = "OK";
+    v = line.ArcPosition(line.a13);
     result.p1 = formatpoint(v.lat1, v.lon1, v.azi1, true, 0);
     result.p2 = formatpoint(v.lat2, v.lon2, v.azi2, true, 0);
-    result.s12 = v.s12.toFixed(0);
-    draw(v);
+    result.s12 = line.s13.toFixed(0);
+    draw(line, v.lat2, v.lon2);
   }
   catch (e) {
     result.status = "ERROR: " + e.message;
@@ -255,27 +251,26 @@ function GeodesicDirect(input) {
   return result;
 };
 
-function draw(v) {
+function draw(line, lat2, lon2) {
   "use strict";
-  var points = geod.DirectPath(v.lat1, v.lon1, v.azi1, v.s12,
-                               100000, 100),
-      i, k, path;
+  var points = geod.Path(line, 100000, 100),
+      i, k, path, v;
   clearPaths();
 
   path = geodesic.getPath();
   for (k = 0; k < points.length; ++k)
     path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
-  points = geod.Circle(v.lat1, v.lon1, v.azi1, v.s12, 72);
+  points = geod.Circle(line.lat1, line.lon1, line.azi1, line.s13, 72);
   path = circle.getPath();
   for (k = 0; k < points.length; ++k)
     path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
   for (i = 0; i < 4; ++i) {
-    points = geod.Envelope(v.lat1, v.lon1, 72, i+1);
+    points = geod.Envelope(line.lat1, line.lon1, 72, i+1);
     path = envelope[i].getPath();
     for (k = 0; k < points.length; ++k)
       path.push(new google.maps.LatLng(points[k].lat, points[k].lon));
   }
-  map.panTo(new google.maps.LatLng(v.lat2, v.lon2));
+  map.panTo(new google.maps.LatLng(lat2, lon2));
 };
 
 function clearPaths() {
diff --git a/js/src/DMS.js b/js/src/DMS.js
index 3b8864d..31f6b24 100644
--- a/js/src/DMS.js
+++ b/js/src/DMS.js
@@ -290,7 +290,7 @@ GeographicLib.DMS = {};
     var t, sign, p0, p1;
     if (s.length < 3)
       return 0;
-    t = s.toUpperCase().replace(/0+$/,"");
+    t = s.toUpperCase().replace(/0+$/, "");
     sign = t.charAt(0) === '-' ? -1 : 1;
     p0 = t.charAt(0) === '-' || t.charAt(0) === '+' ? 1 : 0;
     p1 = t.length - 1;
diff --git a/js/src/Geodesic.js b/js/src/Geodesic.js
index 8616c02..283840c 100644
--- a/js/src/Geodesic.js
+++ b/js/src/Geodesic.js
@@ -9,10 +9,10 @@
  *
  *    Charles F. F. Karney,
  *    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
- *    https://dx.doi.org/10.1007/s00190-012-0578-z
+ *    https://doi.org/10.1007/s00190-012-0578-z
  *    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
  *
- * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  */
@@ -317,9 +317,9 @@ GeographicLib.PolygonArea = {};
       Math.sqrt( Math.max(0.001, Math.abs(this.f)) *
                  Math.min(1.0, 1 - this.f/2) / 2 );
     if (!(isFinite(this.a) && this.a > 0))
-      throw new Error("Major radius is not positive");
+      throw new Error("Equatorial radius is not positive");
     if (!(isFinite(this._b) && this._b > 0))
-      throw new Error("Minor radius is not positive");
+      throw new Error("Polar semi-axis is not positive");
     this._A3x = new Array(nA3x_);
     this._C3x = new Array(nC3x_);
     this._C4x = new Array(nC4x_);
@@ -642,7 +642,7 @@ GeographicLib.PolygonArea = {};
         // strip near cut
         if (this.f >= 0) {
           vals.salp1 = Math.min(1, -x);
-          vals.calp1 = - Math.sqrt(1 - m.sq(vals.salp1));
+          vals.calp1 = -Math.sqrt(1 - m.sq(vals.salp1));
         } else {
           vals.calp1 = Math.max(x > -tol1_ ? 0 : -1, x);
           vals.salp1 = Math.sqrt(1 - m.sq(vals.calp1));
@@ -709,7 +709,7 @@ GeographicLib.PolygonArea = {};
                                            diffp, C1a, C2a, C3a) {
     var vals = {},
         t, salp0, calp0,
-        somg1, comg1, somg2, comg2, B312, eta, k2, nvals;
+        somg1, comg1, somg2, comg2, somg12, comg12, B312, eta, k2, nvals;
     if (sbet1 === 0 && calp1 === 0)
       // Break degeneracy of equatorial line.  This case has already been
       // handled.
@@ -751,25 +751,26 @@ GeographicLib.PolygonArea = {};
 
     // sig12 = sig2 - sig1, limit to [0, pi]
     vals.sig12 = Math.atan2(Math.max(0, vals.csig1 * vals.ssig2 -
-                                     vals.ssig1 * vals.csig2),
-                            vals.csig1 * vals.csig2 + vals.ssig1 * vals.ssig2);
+                                        vals.ssig1 * vals.csig2),
+                                        vals.csig1 * vals.csig2 +
+                                        vals.ssig1 * vals.ssig2);
 
     // omg12 = omg2 - omg1, limit to [0, pi]
-    vals.somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
-    vals.comg12 =             comg1 * comg2 + somg1 * somg2;
+    somg12 = Math.max(0, comg1 * somg2 - somg1 * comg2);
+    comg12 =             comg1 * comg2 + somg1 * somg2;
     // eta = omg12 - lam120
-    eta = Math.atan2(vals.somg12 * clam120 - vals.comg12 * slam120,
-                     vals.comg12 * clam120 + vals.somg12 * slam120);
+    eta = Math.atan2(somg12 * clam120 - comg12 * slam120,
+                     comg12 * clam120 + somg12 * slam120);
     k2 = m.sq(calp0) * this._ep2;
     vals.eps = k2 / (2 * (1 + Math.sqrt(1 + k2)) + k2);
     this.C3f(vals.eps, C3a);
     B312 = (g.SinCosSeries(true, vals.ssig2, vals.csig2, C3a) -
             g.SinCosSeries(true, vals.ssig1, vals.csig1, C3a));
-    vals.lam12 = eta - this.f * this.A3f(vals.eps) *
-      salp0 * (vals.sig12 + B312);
+    vals.domg12 =  -this.f * this.A3f(vals.eps) * salp0 * (vals.sig12 + B312);
+    vals.lam12 = eta + vals.domg12;
     if (diffp) {
       if (vals.calp2 === 0)
-        vals.dlam12 = - 2 * this._f1 * dn1 / sbet1;
+        vals.dlam12 = -2 * this._f1 * dn1 / sbet1;
       else {
         nvals = this.Lengths(vals.eps, vals.sig12,
                              vals.ssig1, vals.csig1, dn1,
@@ -818,7 +819,7 @@ GeographicLib.PolygonArea = {};
         numit, salp1a, calp1a, salp1b, calp1b,
         tripn, tripb, v, dv, dalp1, sdalp1, cdalp1, nsalp1,
         lengthmask, salp0, calp0, alp12, k2, A4, C4a, B41, B42,
-        somg12, comg12, domg12, dbet1, dbet2, salp12, calp12;
+        somg12, comg12, domg12, dbet1, dbet2, salp12, calp12, sdomg12, cdomg12;
     // Compute longitude difference (AngDiff does this carefully).  Result is
     // in [-180, 180] but -180 is only for west-going geodesics.  180 is for
     // east-going and meridional geodesics.
@@ -918,7 +919,7 @@ GeographicLib.PolygonArea = {};
 
       // sig12 = sig2 - sig1
       sig12 = Math.atan2(Math.max(0, csig1 * ssig2 - ssig1 * csig2),
-                         csig1 * csig2 + ssig1 * ssig2);
+                                     csig1 * csig2 + ssig1 * ssig2);
       nvals = this.Lengths(this._n, sig12,
                            ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2,
                            outmask | g.DISTANCE | g.REDUCEDLENGTH,
@@ -1018,8 +1019,7 @@ GeographicLib.PolygonArea = {};
           ssig2 = nvals.ssig2;
           csig2 = nvals.csig2;
           eps = nvals.eps;
-          somg12 = nvals.somg12;
-          comg12 = nvals.comg12;
+          domg12 = nvals.domg12;
           dv = nvals.dlam12;
 
           // 2 * tol0 is approximately 1 ulp for a number in [0, pi].
@@ -1028,7 +1028,7 @@ GeographicLib.PolygonArea = {};
             break;
           // Update bracketing values
           if (v > 0 && (numit < maxit1_ || calp1/salp1 > calp1b/salp1b)) {
-              salp1b = salp1; calp1b = calp1;
+            salp1b = salp1; calp1b = calp1;
           } else if (v < 0 &&
                      (numit < maxit1_ || calp1/salp1 < calp1a/salp1a)) {
             salp1a = salp1; calp1a = calp1;
@@ -1081,6 +1081,12 @@ GeographicLib.PolygonArea = {};
         m12x *= this._b;
         s12x *= this._b;
         vals.a12 = sig12 / m.degree;
+        if (outmask & g.AREA) {
+          // omg12 = lam12 - domg12
+          sdomg12 = Math.sin(domg12); cdomg12 = Math.cos(domg12);
+          somg12 = slam12 * cdomg12 - clam12 * sdomg12;
+          comg12 = clam12 * cdomg12 + slam12 * sdomg12;
+        }
       }
     }
 
@@ -1114,19 +1120,15 @@ GeographicLib.PolygonArea = {};
       } else
         // Avoid problems with indeterminate sig1, sig2 on equator
         vals.S12 = 0;
-      if (!meridian) {
-        if (somg12 > 1) {
-          somg12 = Math.sin(omg12); comg12 = Math.cos(omg12);
-        } else {
-          t = m.hypot(somg12, comg12); somg12 /= t; comg12 /= t;
-        }
+      if (!meridian && somg12 > 1) {
+        somg12 = Math.sin(omg12); comg12 = Math.cos(omg12);
       }
       if (!meridian &&
-          omg12 > -0.7071 &&      // Long difference not too big
+          comg12 > -0.7071 &&      // Long difference not too big
           sbet2 - sbet1 < 1.75) { // Lat difference not too big
-          // Use tan(Gamma/2) = tan(omg12/2)
-          // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2))
-          // with tan(x/2) = sin(x)/(1+cos(x))
+        // Use tan(Gamma/2) = tan(omg12/2)
+        // * (tan(bet1/2)+tan(bet2/2))/(1+tan(bet1/2)*tan(bet2/2))
+        // with tan(x/2) = sin(x)/(1+cos(x))
         domg12 = 1 + comg12; dbet1 = 1 + cbet1; dbet2 = 1 + cbet2;
         alp12 = 2 * Math.atan2( somg12 * (sbet1*dbet2 + sbet2*dbet1),
                                 domg12 * (sbet1*sbet2 + dbet1*dbet2) );
@@ -1191,12 +1193,12 @@ GeographicLib.PolygonArea = {};
    *   parameter, see {@tutorial 2-interface}, "The outmask and caps
    *   parameters".
    */
-  g.Geodesic.prototype.GenDirect = function (lat1, lon1, azi1,
-                                             arcmode, s12_a12, outmask) {
+  g.Geodesic.prototype.GenDirect = function(lat1, lon1, azi1,
+                                            arcmode, s12_a12, outmask) {
     var line;
     if (!outmask) outmask = g.STANDARD;
     else if (outmask === g.LONG_UNROLL) outmask |= g.STANDARD;
-                              // Automatically supply DISTANCE_IN if necessary
+    // Automatically supply DISTANCE_IN if necessary
     if (!arcmode) outmask |= g.DISTANCE_IN;
     line = new l.GeodesicLine(this, lat1, lon1, azi1, outmask);
     return line.GenPosition(arcmode, s12_a12, outmask);
@@ -1215,7 +1217,7 @@ GeographicLib.PolygonArea = {};
    *   always set.  For details on the outmask parameter, see {@tutorial
    *   2-interface}, "The outmask and caps parameters".
    */
-  g.Geodesic.prototype.Direct = function (lat1, lon1, azi1, s12, outmask) {
+  g.Geodesic.prototype.Direct = function(lat1, lon1, azi1, s12, outmask) {
     return this.GenDirect(lat1, lon1, azi1, false, s12, outmask);
   };
 
@@ -1232,7 +1234,7 @@ GeographicLib.PolygonArea = {};
    *   always set.  For details on the outmask parameter, see {@tutorial
    *   2-interface}, "The outmask and caps parameters".
    */
-  g.Geodesic.prototype.ArcDirect = function (lat1, lon1, azi1, a12, outmask) {
+  g.Geodesic.prototype.ArcDirect = function(lat1, lon1, azi1, a12, outmask) {
     return this.GenDirect(lat1, lon1, azi1, true, a12, outmask);
   };
 
@@ -1251,7 +1253,7 @@ GeographicLib.PolygonArea = {};
    * @description For details on the caps parameter, see {@tutorial
    *   2-interface}, "The outmask and caps parameters".
    */
-  g.Geodesic.prototype.Line = function (lat1, lon1, azi1, caps) {
+  g.Geodesic.prototype.Line = function(lat1, lon1, azi1, caps) {
     return new l.GeodesicLine(this, lat1, lon1, azi1, caps);
   };
 
@@ -1275,7 +1277,7 @@ GeographicLib.PolygonArea = {};
    *   parameter, see {@tutorial 2-interface}, "The outmask and caps
    *   parameters".
    */
-  g.Geodesic.prototype.DirectLine = function (lat1, lon1, azi1, s12, caps) {
+  g.Geodesic.prototype.DirectLine = function(lat1, lon1, azi1, s12, caps) {
     return this.GenDirectLine(lat1, lon1, azi1, false, s12, caps);
   };
 
@@ -1299,7 +1301,7 @@ GeographicLib.PolygonArea = {};
    *   parameter, see {@tutorial 2-interface}, "The outmask and caps
    *   parameters".
    */
-  g.Geodesic.prototype.ArcDirectLine = function (lat1, lon1, azi1, a12, caps) {
+  g.Geodesic.prototype.ArcDirectLine = function(lat1, lon1, azi1, a12, caps) {
     return this.GenDirectLine(lat1, lon1, azi1, true, a12, caps);
   };
 
@@ -1326,8 +1328,8 @@ GeographicLib.PolygonArea = {};
    *   parameter, see {@tutorial 2-interface}, "The outmask and caps
    *   parameters".
    */
-  g.Geodesic.prototype.GenDirectLine = function (lat1, lon1, azi1,
-                                                 arcmode, s12_a12, caps) {
+  g.Geodesic.prototype.GenDirectLine = function(lat1, lon1, azi1,
+                                                arcmode, s12_a12, caps) {
     var t;
     if (!caps) caps = g.STANDARD | g.DISTANCE_IN;
     // Automatically supply DISTANCE_IN if necessary
@@ -1354,7 +1356,7 @@ GeographicLib.PolygonArea = {};
    *   parameter, see {@tutorial 2-interface}, "The outmask and caps
    *   parameters".
    */
-  g.Geodesic.prototype.InverseLine = function (lat1, lon1, lat2, lon2, caps) {
+  g.Geodesic.prototype.InverseLine = function(lat1, lon1, lat2, lon2, caps) {
     var r, t, azi1;
     if (!caps) caps = g.STANDARD | g.DISTANCE_IN;
     r = this.InverseInt(lat1, lon1, lat2, lon2, g.ARC);
@@ -1375,7 +1377,7 @@ GeographicLib.PolygonArea = {};
    *   {@link module:GeographicLib/PolygonArea.PolygonArea
    *   PolygonArea} object
    */
-  g.Geodesic.prototype.Polygon = function (polyline) {
+  g.Geodesic.prototype.Polygon = function(polyline) {
     return new p.PolygonArea(this, polyline);
   };
 
diff --git a/js/src/GeodesicLine.js b/js/src/GeodesicLine.js
index 6cfaad9..c91aeb8 100644
--- a/js/src/GeodesicLine.js
+++ b/js/src/GeodesicLine.js
@@ -9,7 +9,7 @@
  *
  *    Charles F. F. Karney,
  *    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
- *    https://dx.doi.org/10.1007/s00190-012-0578-z
+ *    https://doi.org/10.1007/s00190-012-0578-z
  *    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
  *
  * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
@@ -202,10 +202,10 @@
       s = Math.sin(tau12);
       c = Math.cos(tau12);
       // tau2 = tau1 + tau12
-      B12 = - g.SinCosSeries(true,
-                             this._stau1 * c + this._ctau1 * s,
-                             this._ctau1 * c - this._stau1 * s,
-                             this._C1pa);
+      B12 = -g.SinCosSeries(true,
+                            this._stau1 * c + this._ctau1 * s,
+                            this._ctau1 * c - this._stau1 * s,
+                            this._C1pa);
       sig12 = tau12 - (B12 - this._B11);
       ssig12 = Math.sin(sig12); csig12 = Math.cos(sig12);
       if (Math.abs(this.f) > 0.01) {
diff --git a/js/src/Math.js b/js/src/Math.js
index 019d316..eff90da 100644
--- a/js/src/Math.js
+++ b/js/src/Math.js
@@ -65,12 +65,12 @@ GeographicLib.Accumulator = {};
    * @property {number} minor the minor version number.
    * @property {number} patch the patch number.
    */
-  c.version = { major: 1, minor: 46, patch: 0 };
+  c.version = { major: 1, minor: 47, patch: 0 };
   /**
    * @constant
    * @summary version string
    */
-  c.version_string = "1.46";
+  c.version_string = "1.47";
 })(GeographicLib.Constants);
 
 (function(
@@ -255,7 +255,7 @@ GeographicLib.Accumulator = {};
   m.AngDiff = function(x, y) {
     // Compute y - x and reduce to [-180,180] accurately.
     var r = m.sum(m.AngNormalize(x), m.AngNormalize(-y)),
-        d = - m.AngNormalize(r.s),
+        d = -m.AngNormalize(r.s),
         t = r.t;
     return m.sum(d === 180 && t < 0 ? -180 : d, -t);
   };
@@ -278,10 +278,10 @@ GeographicLib.Accumulator = {};
     // Possibly could call the gnu extension sincos
     s = Math.sin(r); c = Math.cos(r);
     switch (q & 3) {
-    case  0: sinx =     s; cosx =     c; break;
-    case  1: sinx =     c; cosx = 0 - s; break;
-    case  2: sinx = 0 - s; cosx = 0 - c; break;
-    default: sinx = 0 - c; cosx =     s; break; // case 3
+      case 0:  sinx =     s; cosx =     c; break;
+      case 1:  sinx =     c; cosx = 0 - s; break;
+      case 2:  sinx = 0 - s; cosx = 0 - c; break;
+      default: sinx = 0 - c; cosx =     s; break; // case 3
     }
     return {s: sinx, c: cosx};
   };
@@ -310,9 +310,9 @@ GeographicLib.Accumulator = {};
       //   case 0: ang = 0 + ang; break;
       //
       // and handle mpfr as in AngRound.
-    case 1: ang = (y > 0 ? 180 : -180) - ang; break;
-    case 2: ang =  90 - ang; break;
-    case 3: ang = -90 + ang; break;
+      case 1: ang = (y > 0 ? 180 : -180) - ang; break;
+      case 2: ang =  90 - ang; break;
+      case 3: ang = -90 + ang; break;
     }
     return ang;
   };
diff --git a/js/src/PolygonArea.js b/js/src/PolygonArea.js
index 40c2506..ea0b9aa 100644
--- a/js/src/PolygonArea.js
+++ b/js/src/PolygonArea.js
@@ -9,7 +9,7 @@
  *
  *    Charles F. F. Karney,
  *    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);
- *    https://dx.doi.org/10.1007/s00190-012-0578-z
+ *    https://doi.org/10.1007/s00190-012-0578-z
  *    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
  *
  * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
diff --git a/js/test/geodesictest.js b/js/test/geodesictest.js
index 5e12acd..2dc67ac 100644
--- a/js/test/geodesictest.js
+++ b/js/test/geodesictest.js
@@ -505,6 +505,21 @@ describe("GeographicLib", function() {
       assert.approx(dir.azi2, 0, 0.5e-5);
     });
 
+    it("GeodSolve74", function() {
+      // Check fix for inaccurate areas, bug introduced in v1.46, fixed
+      // 2015-10-16.
+      var geod = g.WGS84,
+          inv = geod.Inverse(54.1589, 15.3872, 54.1591, 15.3877, g.ALL);
+      assert.approx(inv.azi1, 55.723110355, 5e-9);
+      assert.approx(inv.azi2, 55.723515675, 5e-9);
+      assert.approx(inv.s12,  39.527686385, 5e-9);
+      assert.approx(inv.a12,   0.000355495, 5e-9);
+      assert.approx(inv.m12,  39.527686385, 5e-9);
+      assert.approx(inv.M12,   0.999999995, 5e-9);
+      assert.approx(inv.M21,   0.999999995, 5e-9);
+      assert.approx(inv.S12, 286698586.30197, 5e-4);
+    });
+
   });
 
   describe("Planimeter", function () {
diff --git a/legacy/C/00README.txt b/legacy/C/00README.txt
index 71bad0e..29e1b27 100644
--- a/legacy/C/00README.txt
+++ b/legacy/C/00README.txt
@@ -3,7 +3,7 @@ This is a C implementation of the geodesic algorithms described in
   C. F. F. Karney,
   Algorithms for geodesics,
   J. Geodesy 87, 43-55 (2013);
-  https://dx.doi.org/10.1007/s00190-012-0578-z
+  https://doi.org/10.1007/s00190-012-0578-z
   Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 
 For documentation, see
diff --git a/legacy/C/CMakeLists.txt b/legacy/C/CMakeLists.txt
index 2c619cb..bd25fde 100644
--- a/legacy/C/CMakeLists.txt
+++ b/legacy/C/CMakeLists.txt
@@ -9,7 +9,7 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
 endif ()
 
 # Make the compiler more picky.
-if (MSCV)
+if (MSVC)
   set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
 else ()
   set (CMAKE_C_FLAGS
diff --git a/legacy/C/geodesic.c b/legacy/C/geodesic.c
index 8d9c928..3f4a651 100644
--- a/legacy/C/geodesic.c
+++ b/legacy/C/geodesic.c
@@ -13,12 +13,12 @@
  *   C. F. F. Karney,
  *   Algorithms for geodesics,
  *   J. Geodesy <b>87</b>, 43--55 (2013);
- *   https://dx.doi.org/10.1007/s00190-012-0578-z
+ *   https://doi.org/10.1007/s00190-012-0578-z
  *   Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
  *
  * See the comments in geodesic.h for documentation.
  *
- * Copyright (c) Charles Karney (2012-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2012-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  */
@@ -187,8 +187,9 @@ static real AngDiff(real x, real y, real* e) {
 
 static real AngRound(real x) {
   const real z = 1/(real)(16);
+  volatile real y;
   if (x == 0) return 0;
-  volatile real y = fabs(x);
+  y = fabs(x);
   /* The compiler mustn't "simplify" z - (z - y) to y */
   y = y < z ? z - (z - y) : y;
   return x < 0 ? -y : y;
@@ -273,7 +274,7 @@ static real Lambda12(const struct geod_geodesic* g,
                      real* pssig1, real* pcsig1,
                      real* pssig2, real* pcsig2,
                      real* peps,
-                     real* psomg12, real* pcomg12,
+                     real* pgomg12,
                      boolx diffp, real* pdlam12,
                      /* Scratch area of the right size */
                      real Ca[]);
@@ -413,8 +414,8 @@ static void geod_lineinit_int(struct geod_geodesicline* l,
 void geod_lineinit(struct geod_geodesicline* l,
                    const struct geod_geodesic* g,
                    real lat1, real lon1, real azi1, unsigned caps) {
-  azi1 = AngNormalize(azi1);
   real salp1, calp1;
+  azi1 = AngNormalize(azi1);
   /* Guard against underflow in salp0 */
   sincosdx(AngRound(azi1), &salp1, &calp1);
   geod_lineinit_int(l, g, lat1, lon1, azi1, salp1, calp1, caps);
@@ -785,7 +786,7 @@ static real geod_geninverse_int(const struct geod_geodesic* g,
 
     /* sig12 = sig2 - sig1 */
     sig12 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2),
-                  csig1 * csig2 + ssig1 * ssig2);
+                                  csig1 * csig2 + ssig1 * ssig2);
     Lengths(g, g->n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
             cbet1, cbet2, &s12x, &m12x, 0,
             outmask & GEOD_GEODESICSCALE ? &M12 : 0,
@@ -857,7 +858,7 @@ static real geod_geninverse_int(const struct geod_geodesic* g,
        * value of alp1 is then further from the solution) or if the new
        * estimate of alp1 lies outside (0,pi); in this case, the new starting
        * guess is taken to be (alp1a + alp1b) / 2. */
-      real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0;
+      real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0;
       unsigned numit = 0;
       /* Bracketing range */
       real salp1a = tiny, calp1a = 1, salp1b = tiny, calp1b = -1;
@@ -869,7 +870,7 @@ static real geod_geninverse_int(const struct geod_geodesic* g,
           v = Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
                         slam12, clam12,
                         &salp2, &calp2, &sig12, &ssig1, &csig1, &ssig2, &csig2,
-                        &eps, &somg12, &comg12, numit < maxit1, &dv, Ca);
+                        &eps, &domg12, numit < maxit1, &dv, Ca);
         /* 2 * tol0 is approximately 1 ulp for a number in [0, pi]. */
         /* Reversed test to allow escape with NaNs */
         if (tripb || !(fabs(v) >= (tripn ? 8 : 1) * tol0)) break;
@@ -917,6 +918,12 @@ static real geod_geninverse_int(const struct geod_geodesic* g,
       m12x *= g->b;
       s12x *= g->b;
       a12 = sig12 / degree;
+      if (outmask & GEOD_AREA) {
+        /* omg12 = lam12 - domg12 */
+        real sdomg12 = sin(domg12), cdomg12 = cos(domg12);
+        somg12 = slam12 * cdomg12 - clam12 * sdomg12;
+        comg12 = clam12 * cdomg12 + slam12 * sdomg12;
+      }
     }
   }
 
@@ -952,11 +959,8 @@ static real geod_geninverse_int(const struct geod_geodesic* g,
       /* Avoid problems with indeterminate sig1, sig2 on equator */
       S12 = 0;
 
-    if (!meridian) {
-      if (somg12 > 1) {
-        somg12 = sin(omg12); comg12 = cos(omg12);
-      } else
-        norm2(&somg12, &comg12);
+    if (!meridian && somg12 > 1) {
+      somg12 = sin(omg12); comg12 = cos(omg12);
     }
 
     if (!meridian &&
@@ -1384,15 +1388,15 @@ real Lambda12(const struct geod_geodesic* g,
               real* pssig1, real* pcsig1,
               real* pssig2, real* pcsig2,
               real* peps,
-              real* psomg12, real* pcomg12,
+              real* pdomg12,
               boolx diffp, real* pdlam12,
               /* Scratch area of the right size */
               real Ca[]) {
   real salp2 = 0, calp2 = 0, sig12 = 0,
     ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0,
-    somg12 = 0, comg12 = 0, dlam12 = 0;
+    domg12 = 0, dlam12 = 0;
   real salp0, calp0;
-  real somg1, comg1, somg2, comg2, lam12;
+  real somg1, comg1, somg2, comg2, somg12, comg12, lam12;
   real B312, eta, k2;
 
   if (sbet1 == 0 && calp1 == 0)
@@ -1435,7 +1439,7 @@ real Lambda12(const struct geod_geodesic* g,
 
   /* sig12 = sig2 - sig1, limit to [0, pi] */
   sig12 = atan2(maxx((real)(0), csig1 * ssig2 - ssig1 * csig2),
-                csig1 * csig2 + ssig1 * ssig2);
+                                csig1 * csig2 + ssig1 * ssig2);
 
   /* omg12 = omg2 - omg1, limit to [0, pi] */
   somg12 = maxx((real)(0), comg1 * somg2 - somg1 * comg2);
@@ -1448,7 +1452,8 @@ real Lambda12(const struct geod_geodesic* g,
   C3f(g, eps, Ca);
   B312 = (SinCosSeries(TRUE, ssig2, csig2, Ca, nC3-1) -
           SinCosSeries(TRUE, ssig1, csig1, Ca, nC3-1));
-  lam12 = eta - g->f * A3f(g, eps) * salp0 * (sig12 + B312);
+  domg12 = -g->f * A3f(g, eps) * salp0 * (sig12 + B312);
+  lam12 = eta + domg12;
 
   if (diffp) {
     if (calp2 == 0)
@@ -1468,8 +1473,7 @@ real Lambda12(const struct geod_geodesic* g,
   *pssig2 = ssig2;
   *pcsig2 = csig2;
   *peps = eps;
-  *psomg12 = somg12;
-  *pcomg12 = comg12;
+  *pdomg12 = domg12;
   if (diffp)
     *pdlam12 = dlam12;
 
diff --git a/legacy/C/geodesic.h b/legacy/C/geodesic.h
index 80ffac9..32abdb3 100644
--- a/legacy/C/geodesic.h
+++ b/legacy/C/geodesic.h
@@ -4,10 +4,10 @@
  *
  * This an implementation in C of the geodesic algorithms described in
  * - C. F. F. Karney,
- *   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   Algorithms for geodesics</a>,
  *   J. Geodesy <b>87</b>, 43--55 (2013);
- *   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+ *   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
  *   10.1007/s00190-012-0578-z</a>;
  *   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
  *   geod-addenda.html</a>.
@@ -112,7 +112,7 @@
  * http://geographiclib.sourceforge.net/
  *
  * This library was distributed with
- * <a href="../index.html">GeographicLib</a> 1.46.
+ * <a href="../index.html">GeographicLib</a> 1.47.
  **********************************************************************/
 
 #if !defined(GEODESIC_H)
@@ -127,7 +127,7 @@
  * The minor version of the geodesic library.  (This tracks the version of
  * GeographicLib.)
  **********************************************************************/
-#define GEODESIC_VERSION_MINOR 46
+#define GEODESIC_VERSION_MINOR 47
 /**
  * The patch level of the geodesic library.  (This tracks the version of
  * GeographicLib.)
diff --git a/legacy/C/geodtest.c b/legacy/C/geodtest.c
index 990a213..c94683f 100644
--- a/legacy/C/geodtest.c
+++ b/legacy/C/geodtest.c
@@ -4,7 +4,7 @@
  *
  * Run these tests by configuring with cmake and running "make test".
  *
- * Copyright (c) Charles Karney (2015-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2015-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -630,6 +630,26 @@ void polylength(const struct geod_geodesic* g, double points[][2], int N,
   geod_polygon_compute(g, &p, 0, 1, 0, perimeter);
 }
 
+int GeodSolve74() {
+  /* Check fix for inaccurate areas, bug introduced in v1.46, fixed
+     2015-10-16. */
+  double a12, s12, azi1, azi2, m12, M12, M21, S12;
+  struct geod_geodesic g;
+  int result = 0;
+  geod_init(&g, wgs84_a, wgs84_f);
+  a12 = geod_geninverse(&g, 54.1589, 15.3872, 54.1591, 15.3877,
+                        &s12, &azi1, &azi2, &m12, &M12, &M21, &S12);
+  result += assertEquals(azi1, 55.723110355, 5e-9);
+  result += assertEquals(azi2, 55.723515675, 5e-9);
+  result += assertEquals(s12,  39.527686385, 5e-9);
+  result += assertEquals(a12,   0.000355495, 5e-9);
+  result += assertEquals(m12,  39.527686385, 5e-9);
+  result += assertEquals(M12,   0.999999995, 5e-9);
+  result += assertEquals(M21,   0.999999995, 5e-9);
+  result += assertEquals(S12, 286698586.30197, 5e-4);
+  return result;
+}
+
 int Planimeter0() {
   /* Check fix for pole-encircling bug found 2011-03-16 */
   double pa[4][2] = {{89, 0}, {89, 90}, {89, 180}, {89, 270}};
@@ -757,6 +777,7 @@ int main() {
   if ((i = GeodSolve67())) {++n; printf("GeodSolve67 fail: %d\n", i);}
   if ((i = GeodSolve71())) {++n; printf("GeodSolve71 fail: %d\n", i);}
   if ((i = GeodSolve73())) {++n; printf("GeodSolve73 fail: %d\n", i);}
+  if ((i = GeodSolve74())) {++n; printf("GeodSolve74 fail: %d\n", i);}
   if ((i = Planimeter0())) {++n; printf("Planimeter0 fail: %d\n", i);}
   if ((i = Planimeter5())) {++n; printf("Planimeter5 fail: %d\n", i);}
   if ((i = Planimeter6())) {++n; printf("Planimeter6 fail: %d\n", i);}
diff --git a/legacy/Fortran/00README.txt b/legacy/Fortran/00README.txt
index c56c5a5..2f49e9c 100644
--- a/legacy/Fortran/00README.txt
+++ b/legacy/Fortran/00README.txt
@@ -3,7 +3,7 @@ This is a Fortran implementation of the geodesic algorithms described in
   C. F. F. Karney,
   Algorithms for geodesics,
   J. Geodesy 87, 43-55 (2013);
-  https://dx.doi.org/10.1007/s00190-012-0578-z
+  https://doi.org/10.1007/s00190-012-0578-z
   Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 
 For documentation, see
diff --git a/legacy/Fortran/geodesic.for b/legacy/Fortran/geodesic.for
index 186243f..5aacf2c 100644
--- a/legacy/Fortran/geodesic.for
+++ b/legacy/Fortran/geodesic.for
@@ -7,10 +7,10 @@
 *! This is a Fortran implementation of the geodesic algorithms described
 *! in
 *! - C. F. F. Karney,
-*!   <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+*!   <a href="https://doi.org/10.1007/s00190-012-0578-z">
 *!   Algorithms for geodesics</a>,
 *!   J. Geodesy <b>87</b>, 43--55 (2013);
-*!   DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">
+*!   DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">
 *!   10.1007/s00190-012-0578-z</a>;
 *!   addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">
 *!   geod-addenda.html</a>.
@@ -113,12 +113,12 @@
 *! restructuring the internals of the Fortran code since this may make
 *! porting fixes from the C++ code more difficult.
 *!
-*! Copyright (c) Charles Karney (2012-2016) <charles at karney.com> and
+*! Copyright (c) Charles Karney (2012-2017) <charles at karney.com> and
 *! licensed under the MIT/X11 License.  For more information, see
 *! http://geographiclib.sourceforge.net/
 *!
 *! This library was distributed with
-*! <a href="../index.html">GeographicLib</a> 1.46.
+*! <a href="../index.html">GeographicLib</a> 1.47.
 
 *> Solve the direct geodesic problem
 *!
@@ -555,7 +555,7 @@
      +    salp1a, calp1a, salp1b, calp1b,
      +    dalp1, sdalp1, cdalp1, nsalp1, alp12, somg12, comg12, domg12,
      +    sig12, v, dv, dnm, dummy,
-     +    A4, B41, B42, s12x, m12x, a12x
+     +    A4, B41, B42, s12x, m12x, a12x, sdomg12, cdomg12
 
       double precision dblmin, dbleps, pi, degree, tiny,
      +    tol0, tol1, tol2, tolb, xthrsh
@@ -706,7 +706,7 @@
 
 * sig12 = sig2 - sig1
         sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2),
-     +      csig1 * csig2 + ssig1 * ssig2)
+     +                               csig1 * csig2 + ssig1 * ssig2)
         call Lengs(n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
      +      cbet1, cbet2, lmask,
      +      s12x, m12x, dummy, MM12, MM21, ep2, Ca)
@@ -736,6 +736,7 @@
       omg12 = 0
 * somg12 > 1 marks that it needs to be calculated
       somg12 = 2
+      comg12 = 0
       if (.not. merid .and. sbet1 .eq. 0 .and.
      +    (f .le. 0 .or. lon12s .ge. f * 180)) then
 
@@ -798,7 +799,7 @@
             v = Lam12f(sbet1, cbet1, dn1, sbet2, cbet2, dn2,
      +          salp1, calp1, slam12, clam12, f, A3x, C3x, salp2, calp2,
      +          sig12, ssig1, csig1, ssig2, csig2,
-     +          eps, somg12, comg12, numit .lt. maxit1, dv, Ca)
+     +          eps, domg12, numit .lt. maxit1, dv, Ca)
 * Reversed test to allow escape with NaNs
             if (tripn) then
               dummy = 8
@@ -855,6 +856,12 @@
           m12x = m12x * b
           s12x = s12x * b
           a12x = sig12 / degree
+          if (areap) then
+            sdomg12 = sin(domg12)
+            cdomg12 = cos(domg12)
+            somg12 = slam12 * cdomg12 - clam12 * sdomg12
+            comg12 = clam12 * cdomg12 + slam12 * sdomg12
+          end if
         end if
       end if
 
@@ -887,13 +894,9 @@
           SS12 = 0
         end if
 
-        if (.not. merid) then
-          if (somg12 .gt. 1) then
-            somg12 = sin(omg12)
-            comg12 = cos(omg12)
-          else
-            call norm2(somg12, comg12)
-          end if
+        if (.not. merid .and. somg12 .gt. 1) then
+          somg12 = sin(omg12)
+          comg12 = cos(omg12)
         end if
 
         if (.not. merid .and. comg12 .ge. 0.7071d0
@@ -1036,7 +1039,7 @@
       integer major, minor, patch
 
       major = 1
-      minor = 46
+      minor = 47
       patch = 0
 
       return
@@ -1072,7 +1075,7 @@
 * is used.  The larger value is used here to avoid complaints about a
 * IEEE_UNDERFLOW_FLAG IEEE_DENORMAL signal.  This is triggered when
 * invers is called with points at opposite poles.
-      tiny = 0.5d0**((1022+2)/3)
+      tiny = 0.5d0**((1022+1)/3)
       tol0 = dbleps
 * Increase multiplier in defn of tol1 from 100 to 200 to fix inverse
 * case 52.784459512564 0 -52.784459512563990912 179.634407464943777557
@@ -1449,14 +1452,14 @@
       double precision function Lam12f(sbet1, cbet1, dn1,
      +    sbet2, cbet2, dn2, salp1, calp1, slm120, clm120, f, A3x, C3x,
      +    salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps,
-     +    somg12, comg12, diffp, dlam12, Ca)
+     +    domg12, diffp, dlam12, Ca)
 * input
       double precision sbet1, cbet1, dn1, sbet2, cbet2, dn2,
      +    salp1, calp1, slm120, clm120, f, A3x(*), C3x(*)
       logical diffp
 * output
       double precision salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-     +    eps, somg12, comg12
+     +    eps, domg12
 * optional output
       double precision dlam12
 * temporary
@@ -1468,7 +1471,8 @@
       double precision hypotx, A3f, TrgSum
 
       double precision f1, e2, ep2, salp0, calp0,
-     +    somg1, comg1, somg2, comg2, lam12, eta, B312, k2, dummy
+     +    somg1, comg1, somg2, comg2, somg12, comg12,
+     +    lam12, eta, B312, k2, dummy
 
       double precision dblmin, dbleps, pi, degree, tiny,
      +    tol0, tol1, tol2, tolb, xthrsh
@@ -1532,7 +1536,7 @@
 
 * sig12 = sig2 - sig1, limit to [0, pi]
       sig12 = atan2(0d0 + max(0d0, csig1 * ssig2 - ssig1 * csig2),
-     +    csig1 * csig2 + ssig1 * ssig2)
+     +                             csig1 * csig2 + ssig1 * ssig2)
 
 * omg12 = omg2 - omg1, limit to [0, pi]
       somg12 = 0d0 + max(0d0, comg1 * somg2 - somg1 * comg2)
@@ -1545,7 +1549,8 @@
       call C3f(eps, C3x, Ca)
       B312 = (TrgSum(.true., ssig2, csig2, Ca, nC3-1) -
      +    TrgSum(.true., ssig1, csig1, Ca, nC3-1))
-      lam12 = eta - f * A3f(eps, A3x) * salp0 * (sig12 + B312)
+      domg12 = -f * A3f(eps, A3x) * salp0 * (sig12 + B312)
+      lam12 = eta + domg12
 
       if (diffp) then
         if (calp2 .eq. 0) then
diff --git a/legacy/Fortran/geodtest.for b/legacy/Fortran/geodtest.for
index bf461df..f40cc28 100644
--- a/legacy/Fortran/geodtest.for
+++ b/legacy/Fortran/geodtest.for
@@ -3,7 +3,7 @@
 *!
 *! Run these tests by configuring with cmake and running "make test".
 *!
-*! Copyright (c) Charles Karney (2015-2016) <charles at karney.com> and
+*! Copyright (c) Charles Karney (2015-2017) <charles at karney.com> and
 *! licensed under the MIT/X11 License.  For more information, see
 *! http://geographiclib.sourceforge.net/
 
@@ -181,7 +181,7 @@
 * WGS84 values
       a = 6378137d0
       f = 1/298.257223563d0
-      omask = 1+2+4+8
+      omask = 1 + 2 + 4 + 8
       r = 0
 
       do i = 1,20
@@ -227,7 +227,7 @@
 * WGS84 values
       a = 6378137d0
       f = 1/298.257223563d0
-      omask = 1+2+4+8
+      omask = 1 + 2 + 4 + 8
       flags = 2
       r = 0
 
@@ -274,8 +274,8 @@
 * WGS84 values
       a = 6378137d0
       f = 1/298.257223563d0
-      omask = 1+2+4+8
-      flags = 1+2
+      omask = 1 + 2 + 4 + 8
+      flags = 1 + 2
       r = 0
 
       do i = 1,20
@@ -836,6 +836,33 @@
       return
       end
 
+      integer function tstg74()
+* Check fix for inaccurate areas, bug introduced in v1.46, fixed
+* 2015-10-16.
+      double precision azi1, azi2, s12, a12, m12, MM12, MM21, SS12
+      double precision a, f
+      integer r, assert, omask
+      include 'geodesic.inc'
+
+* WGS84 values
+      a = 6378137d0
+      f = 1/298.257223563d0
+      omask = 1 + 2 + 4 + 8
+      r = 0
+      call invers(a, f, 54.1589d0, 15.3872d0, 54.1591d0, 15.3877d0,
+     +    s12, azi1, azi2, omask, a12, m12, MM12, MM21, SS12)
+      r = r + assert(azi1, 55.723110355d0, 5d-9);
+      r = r + assert(azi2, 55.723515675d0, 5d-9);
+      r = r + assert(s12,  39.527686385d0, 5d-9);
+      r = r + assert(a12,   0.000355495d0, 5d-9);
+      r = r + assert(m12,  39.527686385d0, 5d-9);
+      r = r + assert(MM12,  0.999999995d0, 5d-9);
+      r = r + assert(MM21,  0.999999995d0, 5d-9);
+      r = r + assert(SS12, 286698586.30197d0, 5d-4);
+      tstg74 = r
+      return
+      end
+
       integer function tstp0()
 * Check fix for pole-encircling bug found 2011-03-16
       double precision lata(4), lona(4)
@@ -981,7 +1008,7 @@
       integer tstinv, tstdir, tstarc,
      +    tstg0, tstg1, tstg2, tstg5, tstg6, tstg9, tstg10, tstg11,
      +    tstg12, tstg14, tstg15, tstg17, tstg26, tstg28, tstg33,
-     +    tstg55, tstg59, tstg61, tstg73,
+     +    tstg55, tstg59, tstg61, tstg73, tstg74,
      +    tstp0, tstp5, tstp6, tstp12, tstp13
 
       n = 0
@@ -1095,6 +1122,11 @@
         n = n + 1
         print *, 'tstg73 fail:', i
       end if
+      i = tstg74()
+      if (i .gt. 0) then
+        n = n + 1
+        print *, 'tstg74 fail:', i
+      end if
       i = tstp0()
       if (i .gt. 0) then
         n = n + 1
diff --git a/man/CartConvert.1 b/man/CartConvert.1
index 768990d..3dd428c 100644
--- a/man/CartConvert.1
+++ b/man/CartConvert.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "CARTCONVERT 1"
-.TH CARTCONVERT 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH CARTCONVERT 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -253,7 +249,7 @@ terminate; following lines will be converted.
 .IX Header "SEE ALSO"
 The algorithm for converting geocentric to geodetic coordinates is given
 in Appendix B of C. F. F. Karney, \fIGeodesics on an ellipsoid of
-revolution\fR, Feb. 2011; preprint <http://arxiv.org/abs/1102.1215>.
+revolution\fR, Feb. 2011; preprint <https://arxiv.org/abs/1102.1215>.
 .SH "AUTHOR"
 .IX Header "AUTHOR"
 \&\fBCartConvert\fR was written by Charles Karney.
diff --git a/man/CartConvert.1.html b/man/CartConvert.1.html
index 8bf014f..fdc6ee3 100644
--- a/man/CartConvert.1.html
+++ b/man/CartConvert.1.html
@@ -124,7 +124,7 @@
 
 <h1 id="SEE-ALSO">SEE ALSO</h1>
 
-<p>The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, <i>Geodesics on an ellipsoid of revolution</i>, Feb. 2011; preprint <a href="http://arxiv.org/abs/1102.1215">http://arxiv.org/abs/1102.1215</a>.</p>
+<p>The algorithm for converting geocentric to geodetic coordinates is given in Appendix B of C. F. F. Karney, <i>Geodesics on an ellipsoid of revolution</i>, Feb. 2011; preprint <a href="https://arxiv.org/abs/1102.1215">https://arxiv.org/abs/1102.1215</a>.</p>
 
 <h1 id="AUTHOR">AUTHOR</h1>
 
diff --git a/man/CartConvert.pod b/man/CartConvert.pod
index 4560a93..a0e7c41 100644
--- a/man/CartConvert.pod
+++ b/man/CartConvert.pod
@@ -134,7 +134,7 @@ terminate; following lines will be converted.
 
 The algorithm for converting geocentric to geodetic coordinates is given
 in Appendix B of C. F. F. Karney, I<Geodesics on an ellipsoid of
-revolution>, Feb. 2011; preprint L<http://arxiv.org/abs/1102.1215>.
+revolution>, Feb. 2011; preprint L<https://arxiv.org/abs/1102.1215>.
 
 =head1 AUTHOR
 
diff --git a/man/CartConvert.usage b/man/CartConvert.usage
index d2863d9..92e6d9c 100644
--- a/man/CartConvert.usage
+++ b/man/CartConvert.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    CartConvert --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/CartConvert.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/CartConvert.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -121,7 +121,7 @@ int usage(int retval, bool brief) {
 "SEE ALSO\n"
 "       The algorithm for converting geocentric to geodetic coordinates is\n"
 "       given in Appendix B of C. F. F. Karney, Geodesics on an ellipsoid of\n"
-"       revolution, Feb. 2011; preprint <http://arxiv.org/abs/1102.1215>.\n"
+"       revolution, Feb. 2011; preprint <https://arxiv.org/abs/1102.1215>.\n"
 "\n"
 "AUTHOR\n"
 "       CartConvert was written by Charles Karney.\n"
diff --git a/man/ConicProj.1 b/man/ConicProj.1
index ffddddf..61713fd 100644
--- a/man/ConicProj.1
+++ b/man/ConicProj.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "CONICPROJ 1"
-.TH CONICPROJ 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH CONICPROJ 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/man/ConicProj.usage b/man/ConicProj.usage
index dce2fcb..fbf9f55 100644
--- a/man/ConicProj.usage
+++ b/man/ConicProj.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    ConicProj --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/ConicProj.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/ConicProj.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
diff --git a/man/GeoConvert.1 b/man/GeoConvert.1
index d97f0d4..cd23187 100644
--- a/man/GeoConvert.1
+++ b/man/GeoConvert.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "GEOCONVERT 1"
-.TH GEOCONVERT 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH GEOCONVERT 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -222,7 +218,7 @@ as degrees clockwise from true north.
 .IP "\fB\-z\fR \fIzone\fR" 4
 .IX Item "-z zone"
 set the zone to \fIzone\fR for output.  Use either 0 < \fIzone\fR <=
-60 for a \s-1UTM\s0 zone or \fIzone\fR = 0 for \s-1UPS. \s0 Alternatively use a
+60 for a \s-1UTM\s0 zone or \fIzone\fR = 0 for \s-1UPS.\s0  Alternatively use a
 \&\fIzone\fR+\fIhemisphere\fR designation, e.g., 38n.  See \*(L"\s-1ZONE\*(R"\s0.
 .IP "\fB\-s\fR" 4
 .IX Item "-s"
@@ -295,17 +291,18 @@ file name of \*(L"\-\*(R" stands for standard output.
 .SH "PRECISION"
 .IX Header "PRECISION"
 \&\fIprec\fR gives precision of the output with \fIprec\fR = 0 giving 1 m
-precision, \fIprec\fR = 3 giving 1 mm precision, etc.  \fIprec\fR is the number
-of digits after the decimal point for \s-1UTM/UPS. \s0 The number of digits per
-coordinate for \s-1MGRS\s0 is 5 + \fIprec\fR.  For decimal degrees, the number of
-digits after the decimal point is 5 + \fIprec\fR.  For \s-1DMS \s0(degree, minute,
-seconds) output, the number of digits after the decimal point in the
-seconds components is 1 + \fIprec\fR; if this is negative then use minutes
-(\fIprec\fR = \-2 or \-3) or degrees (\fIprec\fR <= \-4) as the least significant
-component.  Print convergence, resp. scale, with 5 + \fIprec\fR, resp. 7 +
-\&\fIprec\fR, digits after the decimal point.  The minimum value of \fIprec\fR is
-\&\-5 and the maximum is 9 for \s-1UTM/UPS, 9\s0 for decimal degrees, 10 for \s-1DMS,
-6\s0 for \s-1MGRS,\s0 and 8 for convergence and scale.
+precision, \fIprec\fR = 3 giving 1 mm precision, etc.  \fIprec\fR is the
+number of digits after the decimal point for \s-1UTM/UPS.\s0  For \s-1MGRS,\s0 The
+number of digits per coordinate is 5 + \fIprec\fR; <prec> = \-6 results in
+just the grid zone.  For decimal degrees, the number of digits after the
+decimal point is 5 + \fIprec\fR.  For \s-1DMS\s0 (degree, minute, seconds) output,
+the number of digits after the decimal point in the seconds components
+is 1 + \fIprec\fR; if this is negative then use minutes (\fIprec\fR = \-2 or
+\&\-3) or degrees (\fIprec\fR <= \-4) as the least significant component.
+Print convergence, resp. scale, with 5 + \fIprec\fR, resp. 7 + \fIprec\fR,
+digits after the decimal point.  The minimum value of \fIprec\fR is \-5 (\-6
+for \s-1MGRS\s0) and the maximum is 9 for \s-1UTM/UPS, 9\s0 for decimal degrees, 10
+for \s-1DMS, 6\s0 for \s-1MGRS,\s0 and 8 for convergence and scale.
 .SH "GEOGRAPHIC COORDINATES"
 .IX Header "GEOGRAPHIC COORDINATES"
 The utility accepts geographic coordinates, latitude and longitude, in a
@@ -414,7 +411,7 @@ selecting \s-1UTM\s0 vs \s-1UPS\s0 and for assigning the \s-1UTM\s0 zone (with t
 Svalbard exceptions).  If the input is \fB\s-1UTM/UPS\s0\fR or \fB\s-1MGRS\s0\fR, then the
 choice between \s-1UTM\s0 and \s-1UPS\s0 and the \s-1UTM\s0 zone mirrors the input.  The \fB\-z\fR
 \&\fIzone\fR, \fB\-s\fR, and \fB\-t\fR options allow these rules to be overridden
-with \fIzone\fR = 0 being used to indicate \s-1UPS. \s0 For example, the point
+with \fIzone\fR = 0 being used to indicate \s-1UPS.\s0  For example, the point
 .PP
 .Vb 1
 \&   79.9S 6.1E
@@ -515,9 +512,9 @@ An online version of this utility is availbable at
 .PP
 The algorithms for the transverse Mercator projection are described in
 C. F. F. Karney, \fITransverse Mercator with an accuracy of a few
-nanometers\fR, J. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI
-\&\s0<https://dx.doi.org/10.1007/s00190\-011\-0445\-3>; preprint
-<http://arxiv.org/abs/1002.1417>.
+nanometers\fR, J. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0
+<https://doi.org/10.1007/s00190\-011\-0445\-3>; preprint
+<https://arxiv.org/abs/1002.1417>.
 .SH "AUTHOR"
 .IX Header "AUTHOR"
 \&\fBGeoConvert\fR was written by Charles Karney.
diff --git a/man/GeoConvert.1.html b/man/GeoConvert.1.html
index f5b1490..521575d 100644
--- a/man/GeoConvert.1.html
+++ b/man/GeoConvert.1.html
@@ -205,7 +205,7 @@
 
 <h1 id="PRECISION">PRECISION</h1>
 
-<p><i>prec</i> gives precision of the output with <i>prec</i> = 0 giving 1 m precision, <i>prec</i> = 3 giving 1 mm precision, etc. <i>prec</i> is the number of digits after the decimal point for UTM/UPS. The number of digits per coordinate for MGRS is 5 + <i>prec</i>. For decimal degrees, the number of digits after the decimal point is 5 + <i>prec</i>. For DMS (degree, minute, seconds) output, the number of digits after the decimal point in the seconds components is 1 + <i>prec</i>; if  [...]
+<p><i>prec</i> gives precision of the output with <i>prec</i> = 0 giving 1 m precision, <i>prec</i> = 3 giving 1 mm precision, etc. <i>prec</i> is the number of digits after the decimal point for UTM/UPS. For MGRS, The number of digits per coordinate is 5 + <i>prec</i>; <prec> = -6 results in just the grid zone. For decimal degrees, the number of digits after the decimal point is 5 + <i>prec</i>. For DMS (degree, minute, seconds) output, the number of digits after the decimal point [...]
 
 <h1 id="GEOGRAPHIC-COORDINATES">GEOGRAPHIC COORDINATES</h1>
 
@@ -361,7 +361,7 @@
 
 <p>An online version of this utility is availbable at <a href="http://geographiclib.sourceforge.net/cgi-bin/GeoConvert">http://geographiclib.sourceforge.net/cgi-bin/GeoConvert</a>.</p>
 
-<p>The algorithms for the transverse Mercator projection are described in C. F. F. Karney, <i>Transverse Mercator with an accuracy of a few nanometers</i>, J. Geodesy <b>85</b>(8), 475-485 (Aug. 2011); DOI <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">https://dx.doi.org/10.1007/s00190-011-0445-3</a>; preprint <a href="http://arxiv.org/abs/1002.1417">http://arxiv.org/abs/1002.1417</a>.</p>
+<p>The algorithms for the transverse Mercator projection are described in C. F. F. Karney, <i>Transverse Mercator with an accuracy of a few nanometers</i>, J. Geodesy <b>85</b>(8), 475-485 (Aug. 2011); DOI <a href="https://doi.org/10.1007/s00190-011-0445-3">https://doi.org/10.1007/s00190-011-0445-3</a>; preprint <a href="https://arxiv.org/abs/1002.1417">https://arxiv.org/abs/1002.1417</a>.</p>
 
 <h1 id="AUTHOR">AUTHOR</h1>
 
diff --git a/man/GeoConvert.pod b/man/GeoConvert.pod
index 18ffaa8..c0721e8 100644
--- a/man/GeoConvert.pod
+++ b/man/GeoConvert.pod
@@ -187,17 +187,18 @@ file name of "-" stands for standard output.
 =head1 PRECISION
 
 I<prec> gives precision of the output with I<prec> = 0 giving 1 m
-precision, I<prec> = 3 giving 1 mm precision, etc.  I<prec> is the number
-of digits after the decimal point for UTM/UPS.  The number of digits per
-coordinate for MGRS is 5 + I<prec>.  For decimal degrees, the number of
-digits after the decimal point is 5 + I<prec>.  For DMS (degree, minute,
-seconds) output, the number of digits after the decimal point in the
-seconds components is 1 + I<prec>; if this is negative then use minutes
-(I<prec> = -2 or -3) or degrees (I<prec> E<lt>= -4) as the least significant
-component.  Print convergence, resp. scale, with 5 + I<prec>, resp. 7 +
-I<prec>, digits after the decimal point.  The minimum value of I<prec> is
--5 and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS,
-6 for MGRS, and 8 for convergence and scale.
+precision, I<prec> = 3 giving 1 mm precision, etc.  I<prec> is the
+number of digits after the decimal point for UTM/UPS.  For MGRS, The
+number of digits per coordinate is 5 + I<prec>; <prec> = -6 results in
+just the grid zone.  For decimal degrees, the number of digits after the
+decimal point is 5 + I<prec>.  For DMS (degree, minute, seconds) output,
+the number of digits after the decimal point in the seconds components
+is 1 + I<prec>; if this is negative then use minutes (I<prec> = -2 or
+-3) or degrees (I<prec> E<lt>= -4) as the least significant component.
+Print convergence, resp. scale, with 5 + I<prec>, resp. 7 + I<prec>,
+digits after the decimal point.  The minimum value of I<prec> is -5 (-6
+for MGRS) and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10
+for DMS, 6 for MGRS, and 8 for convergence and scale.
 
 =head1 GEOGRAPHIC COORDINATES
 
@@ -406,8 +407,8 @@ L<http://geographiclib.sourceforge.net/cgi-bin/GeoConvert>.
 The algorithms for the transverse Mercator projection are described in
 C. F. F. Karney, I<Transverse Mercator with an accuracy of a few
 nanometers>, J. Geodesy B<85>(8), 475-485 (Aug. 2011); DOI
-L<https://dx.doi.org/10.1007/s00190-011-0445-3>; preprint
-L<http://arxiv.org/abs/1002.1417>.
+L<https://doi.org/10.1007/s00190-011-0445-3>; preprint
+L<https://arxiv.org/abs/1002.1417>.
 
 =head1 AUTHOR
 
diff --git a/man/GeoConvert.usage b/man/GeoConvert.usage
index 48c4af4..30a988e 100644
--- a/man/GeoConvert.usage
+++ b/man/GeoConvert.usage
@@ -10,7 +10,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    GeoConvert --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/GeoConvert.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/GeoConvert.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -152,16 +152,17 @@ int usage(int retval, bool brief) {
 "PRECISION\n"
 "       prec gives precision of the output with prec = 0 giving 1 m precision,\n"
 "       prec = 3 giving 1 mm precision, etc.  prec is the number of digits\n"
-"       after the decimal point for UTM/UPS.  The number of digits per\n"
-"       coordinate for MGRS is 5 + prec.  For decimal degrees, the number of\n"
-"       digits after the decimal point is 5 + prec.  For DMS (degree, minute,\n"
-"       seconds) output, the number of digits after the decimal point in the\n"
-"       seconds components is 1 + prec; if this is negative then use minutes\n"
-"       (prec = -2 or -3) or degrees (prec <= -4) as the least significant\n"
-"       component.  Print convergence, resp. scale, with 5 + prec, resp. 7 +\n"
-"       prec, digits after the decimal point.  The minimum value of prec is -5\n"
-"       and the maximum is 9 for UTM/UPS, 9 for decimal degrees, 10 for DMS, 6\n"
-"       for MGRS, and 8 for convergence and scale.\n"
+"       after the decimal point for UTM/UPS.  For MGRS, The number of digits\n"
+"       per coordinate is 5 + prec; <prec> = -6 results in just the grid zone.\n"
+"       For decimal degrees, the number of digits after the decimal point is 5\n"
+"       + prec.  For DMS (degree, minute, seconds) output, the number of digits\n"
+"       after the decimal point in the seconds components is 1 + prec; if this\n"
+"       is negative then use minutes (prec = -2 or -3) or degrees (prec <= -4)\n"
+"       as the least significant component.  Print convergence, resp. scale,\n"
+"       with 5 + prec, resp. 7 + prec, digits after the decimal point.  The\n"
+"       minimum value of prec is -5 (-6 for MGRS) and the maximum is 9 for\n"
+"       UTM/UPS, 9 for decimal degrees, 10 for DMS, 6 for MGRS, and 8 for\n"
+"       convergence and scale.\n"
 "\n"
 "GEOGRAPHIC COORDINATES\n"
 "       The utility accepts geographic coordinates, latitude and longitude, in\n"
@@ -343,8 +344,8 @@ int usage(int retval, bool brief) {
 "       The algorithms for the transverse Mercator projection are described in\n"
 "       C. F. F. Karney, Transverse Mercator with an accuracy of a few\n"
 "       nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI\n"
-"       <https://dx.doi.org/10.1007/s00190-011-0445-3>; preprint\n"
-"       <http://arxiv.org/abs/1002.1417>.\n"
+"       <https://doi.org/10.1007/s00190-011-0445-3>; preprint\n"
+"       <https://arxiv.org/abs/1002.1417>.\n"
 "\n"
 "AUTHOR\n"
 "       GeoConvert was written by Charles Karney.\n"
diff --git a/man/GeodSolve.1 b/man/GeodSolve.1
index 4032930..6997a0a 100644
--- a/man/GeodSolve.1
+++ b/man/GeodSolve.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "GEODSOLVE 1"
-.TH GEODSOLVE 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH GEODSOLVE 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -358,7 +354,7 @@ the geodesic quadrilateral with corners (\fIlat1\fR,\fIlon1\fR), (0,\fIlon1\fR),
 precision, \fIprec\fR = 3 giving 1 mm precision, etc.  \fIprec\fR is the
 number of digits after the decimal point for lengths.  For decimal
 degrees, the number of digits after the decimal point is \fIprec\fR + 5.
-For \s-1DMS \s0(degree, minute, seconds) output, the number of digits after the
+For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the
 decimal point in the seconds component is \fIprec\fR + 1.  The minimum
 value of \fIprec\fR is 0 and the maximum is 10.
 .SH "ERRORS"
@@ -371,7 +367,7 @@ following lines will be converted.
 .IX Header "ACCURACY"
 Using the (default) series solution, GeodSolve is accurate to about 15
 nm (15 nanometers) for the \s-1WGS84\s0 ellipsoid.  The approximate maximum
-error (expressed as a distance) for an ellipsoid with the same major
+error (expressed as a distance) for an ellipsoid with the same equatorial
 radius as the \s-1WGS84\s0 ellipsoid and different values of the flattening is
 .PP
 .Vb 6
@@ -472,8 +468,8 @@ An online version of this utility is availbable at
 <http://geographiclib.sourceforge.net/cgi\-bin/GeodSolve>.
 .PP
 The algorithms are described in C. F. F. Karney,
-\&\fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI:
-\&\s0<https://dx.doi.org/10.1007/s00190\-012\-0578\-z>;
+\&\fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI:\s0
+<https://doi.org/10.1007/s00190\-012\-0578\-z>;
 addenda: <http://geographiclib.sourceforge.net/geod\-addenda.html>.
 .PP
 The Wikipedia page, Geodesics on an ellipsoid,
diff --git a/man/GeodSolve.1.html b/man/GeodSolve.1.html
index 7ff18d6..cb36660 100644
--- a/man/GeodSolve.1.html
+++ b/man/GeodSolve.1.html
@@ -221,7 +221,7 @@
 
 <h1 id="ACCURACY">ACCURACY</h1>
 
-<p>Using the (default) series solution, GeodSolve is accurate to about 15 nm (15 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with the same major radius as the WGS84 ellipsoid and different values of the flattening is</p>
+<p>Using the (default) series solution, GeodSolve is accurate to about 15 nm (15 nanometers) for the WGS84 ellipsoid. The approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening is</p>
 
 <pre><code>   |f|     error
    0.01    25 nm
@@ -313,7 +313,7 @@
 
 <p>An online version of this utility is availbable at <a href="http://geographiclib.sourceforge.net/cgi-bin/GeodSolve">http://geographiclib.sourceforge.net/cgi-bin/GeodSolve</a>.</p>
 
-<p>The algorithms are described in C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI: <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">https://dx.doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
+<p>The algorithms are described in C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI: <a href="https://doi.org/10.1007/s00190-012-0578-z">https://doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
 
 <p>The Wikipedia page, Geodesics on an ellipsoid, <a href="https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid">https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid</a>.</p>
 
diff --git a/man/GeodSolve.pod b/man/GeodSolve.pod
index 36bd27e..a6e1af6 100644
--- a/man/GeodSolve.pod
+++ b/man/GeodSolve.pod
@@ -275,7 +275,7 @@ following lines will be converted.
 
 Using the (default) series solution, GeodSolve is accurate to about 15
 nm (15 nanometers) for the WGS84 ellipsoid.  The approximate maximum
-error (expressed as a distance) for an ellipsoid with the same major
+error (expressed as a distance) for an ellipsoid with the same equatorial
 radius as the WGS84 ellipsoid and different values of the flattening is
 
    |f|     error
@@ -380,7 +380,7 @@ L<http://geographiclib.sourceforge.net/cgi-bin/GeodSolve>.
 
 The algorithms are described in C. F. F. Karney,
 I<Algorithms for geodesics>, J. Geodesy 87, 43-55 (2013); DOI:
-L<https://dx.doi.org/10.1007/s00190-012-0578-z>;
+L<https://doi.org/10.1007/s00190-012-0578-z>;
 addenda: L<http://geographiclib.sourceforge.net/geod-addenda.html>.
 
 The Wikipedia page, Geodesics on an ellipsoid,
diff --git a/man/GeodSolve.usage b/man/GeodSolve.usage
index df7da00..d8afbdf 100644
--- a/man/GeodSolve.usage
+++ b/man/GeodSolve.usage
@@ -10,7 +10,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    GeodSolve --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/GeodSolve.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/GeodSolve.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -225,8 +225,9 @@ int usage(int retval, bool brief) {
 "ACCURACY\n"
 "       Using the (default) series solution, GeodSolve is accurate to about 15\n"
 "       nm (15 nanometers) for the WGS84 ellipsoid.  The approximate maximum\n"
-"       error (expressed as a distance) for an ellipsoid with the same major\n"
-"       radius as the WGS84 ellipsoid and different values of the flattening is\n"
+"       error (expressed as a distance) for an ellipsoid with the same\n"
+"       equatorial radius as the WGS84 ellipsoid and different values of the\n"
+"       flattening is\n"
 "\n"
 "          |f|     error\n"
 "          0.01    25 nm\n"
@@ -318,7 +319,7 @@ int usage(int retval, bool brief) {
 "\n"
 "       The algorithms are described in C. F. F. Karney, Algorithms for\n"
 "       geodesics, J. Geodesy 87, 43-55 (2013); DOI:\n"
-"       <https://dx.doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
+"       <https://doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
 "       <http://geographiclib.sourceforge.net/geod-addenda.html>.\n"
 "\n"
 "       The Wikipedia page, Geodesics on an ellipsoid,\n"
diff --git a/man/GeodesicProj.1 b/man/GeodesicProj.1
index 34a6636..3682fa3 100644
--- a/man/GeodesicProj.1
+++ b/man/GeodesicProj.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "GEODESICPROJ 1"
-.TH GEODESICPROJ 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH GEODESICPROJ 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -264,8 +260,8 @@ terminate; following lines will be converted.
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
 The ellipsoidal gnomonic projection is derived in Section 8 of
-C. F. F. Karney, \fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI
-\&\s0<https://dx.doi.org/10.1007/s00190\-012\-0578\-z>;
+C. F. F. Karney, \fIAlgorithms for geodesics\fR, J. Geodesy 87, 43\-55 (2013); \s-1DOI\s0
+<https://doi.org/10.1007/s00190\-012\-0578\-z>;
 addenda: <http://geographiclib.sourceforge.net/geod\-addenda.html>.
 .SH "AUTHOR"
 .IX Header "AUTHOR"
diff --git a/man/GeodesicProj.1.html b/man/GeodesicProj.1.html
index 2801adc..eda2538 100644
--- a/man/GeodesicProj.1.html
+++ b/man/GeodesicProj.1.html
@@ -134,7 +134,7 @@
 
 <h1 id="SEE-ALSO">SEE ALSO</h1>
 
-<p>The ellipsoidal gnomonic projection is derived in Section 8 of C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">https://dx.doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
+<p>The ellipsoidal gnomonic projection is derived in Section 8 of C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI <a href="https://doi.org/10.1007/s00190-012-0578-z">https://doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
 
 <h1 id="AUTHOR">AUTHOR</h1>
 
diff --git a/man/GeodesicProj.pod b/man/GeodesicProj.pod
index 22011b9..ba359b5 100644
--- a/man/GeodesicProj.pod
+++ b/man/GeodesicProj.pod
@@ -148,7 +148,7 @@ terminate; following lines will be converted.
 
 The ellipsoidal gnomonic projection is derived in Section 8 of
 C. F. F. Karney, I<Algorithms for geodesics>, J. Geodesy 87, 43-55 (2013); DOI
-L<https://dx.doi.org/10.1007/s00190-012-0578-z>;
+L<https://doi.org/10.1007/s00190-012-0578-z>;
 addenda: L<http://geographiclib.sourceforge.net/geod-addenda.html>.
 
 =head1 AUTHOR
diff --git a/man/GeodesicProj.usage b/man/GeodesicProj.usage
index b577fd2..87972c0 100644
--- a/man/GeodesicProj.usage
+++ b/man/GeodesicProj.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    GeodesicProj --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/GeodesicProj.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/GeodesicProj.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -132,7 +132,7 @@ int usage(int retval, bool brief) {
 "SEE ALSO\n"
 "       The ellipsoidal gnomonic projection is derived in Section 8 of C. F. F.\n"
 "       Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013); DOI\n"
-"       <https://dx.doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
+"       <https://doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
 "       <http://geographiclib.sourceforge.net/geod-addenda.html>.\n"
 "\n"
 "AUTHOR\n"
diff --git a/man/GeoidEval.1 b/man/GeoidEval.1
index 429a426..4927c21 100644
--- a/man/GeoidEval.1
+++ b/man/GeoidEval.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "GEOIDEVAL 1"
-.TH GEOIDEVAL 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH GEOIDEVAL 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -320,7 +316,7 @@ If many heights are to be computed, use \fB\-c\fR \fIsouth\fR \fIwest\fR \fInort
 \&\fIeast\fR to notify \fBGeoidEval\fR to read a rectangle of data into memory;
 heights within the this rectangle can then be computed without any disk
 access.  If \fB\-a\fR is specified all the geoid data is read; in the case
-of \f(CW\*(C`egm2008\-1\*(C'\fR, this requires about 0.5 \s-1GB\s0 of \s-1RAM. \s0 The evaluation of
+of \f(CW\*(C`egm2008\-1\*(C'\fR, this requires about 0.5 \s-1GB\s0 of \s-1RAM.\s0  The evaluation of
 heights outside the cached area causes the necessary data to be read
 from disk.  Use the \fB\-v\fR option to verify the size of the cache.
 .PP
diff --git a/man/GeoidEval.usage b/man/GeoidEval.usage
index b811ff7..26ea013 100644
--- a/man/GeoidEval.usage
+++ b/man/GeoidEval.usage
@@ -10,7 +10,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    GeoidEval --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/GeoidEval.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/GeoidEval.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
diff --git a/man/Gravity.1 b/man/Gravity.1
index 8b314da..95275bb 100644
--- a/man/Gravity.1
+++ b/man/Gravity.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "GRAVITY 1"
-.TH GRAVITY 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH GRAVITY 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/man/Gravity.usage b/man/Gravity.usage
index fccda88..3d0f396 100644
--- a/man/Gravity.usage
+++ b/man/Gravity.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    Gravity --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/Gravity.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/Gravity.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
diff --git a/man/MagneticField.1 b/man/MagneticField.1
index 9e548e4..a81bd73 100644
--- a/man/MagneticField.1
+++ b/man/MagneticField.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "MAGNETICFIELD 1"
-.TH MAGNETICFIELD 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH MAGNETICFIELD 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
diff --git a/man/MagneticField.usage b/man/MagneticField.usage
index a689cce..ca183f5 100644
--- a/man/MagneticField.usage
+++ b/man/MagneticField.usage
@@ -10,7 +10,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    MagneticField --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/MagneticField.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/MagneticField.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
diff --git a/man/Makefile.in b/man/Makefile.in
index 475e720..3a43418 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -230,6 +230,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = pod2man --center="GeographicLib Utilities" \
 	--release="$(PACKAGE_STRING)"
@@ -282,6 +285,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/man/Planimeter.1 b/man/Planimeter.1
index e8dd102..747da70 100644
--- a/man/Planimeter.1
+++ b/man/Planimeter.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "PLANIMETER 1"
-.TH PLANIMETER 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH PLANIMETER 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -322,7 +318,7 @@ An online version of this utility is availbable at
 The algorithm for the area of geodesic polygon is
 given in Section 6 of C. F. F. Karney, \fIAlgorithms for geodesics\fR,
 J. Geodesy 87, 43\-55 (2013);
-\&\s-1DOI \s0<https://dx.doi.org/10.1007/s00190\-012\-0578\-z>;
+\&\s-1DOI\s0 <https://doi.org/10.1007/s00190\-012\-0578\-z>;
 addenda: <http://geographiclib.sourceforge.net/geod\-addenda.html>.
 .SH "AUTHOR"
 .IX Header "AUTHOR"
diff --git a/man/Planimeter.1.html b/man/Planimeter.1.html
index 178c46c..b7206af 100644
--- a/man/Planimeter.1.html
+++ b/man/Planimeter.1.html
@@ -183,7 +183,7 @@
 
 <p>An online version of this utility is availbable at <a href="http://geographiclib.sourceforge.net/cgi-bin/Planimeter">http://geographiclib.sourceforge.net/cgi-bin/Planimeter</a>.</p>
 
-<p>The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI <a href="https://dx.doi.org/10.1007/s00190-012-0578-z">https://dx.doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
+<p>The algorithm for the area of geodesic polygon is given in Section 6 of C. F. F. Karney, <i>Algorithms for geodesics</i>, J. Geodesy 87, 43-55 (2013); DOI <a href="https://doi.org/10.1007/s00190-012-0578-z">https://doi.org/10.1007/s00190-012-0578-z</a>; addenda: <a href="http://geographiclib.sourceforge.net/geod-addenda.html">http://geographiclib.sourceforge.net/geod-addenda.html</a>.</p>
 
 <h1 id="AUTHOR">AUTHOR</h1>
 
diff --git a/man/Planimeter.pod b/man/Planimeter.pod
index a3d85ca..8f27e54 100644
--- a/man/Planimeter.pod
+++ b/man/Planimeter.pod
@@ -205,7 +205,7 @@ L<http://geographiclib.sourceforge.net/cgi-bin/Planimeter>.
 The algorithm for the area of geodesic polygon is
 given in Section 6 of C. F. F. Karney, I<Algorithms for geodesics>,
 J. Geodesy 87, 43-55 (2013);
-DOI L<https://dx.doi.org/10.1007/s00190-012-0578-z>;
+DOI L<https://doi.org/10.1007/s00190-012-0578-z>;
 addenda: L<http://geographiclib.sourceforge.net/geod-addenda.html>.
 
 =head1 AUTHOR
diff --git a/man/Planimeter.usage b/man/Planimeter.usage
index d0bc091..469ff03 100644
--- a/man/Planimeter.usage
+++ b/man/Planimeter.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    Planimeter --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/Planimeter.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/Planimeter.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -183,7 +183,7 @@ int usage(int retval, bool brief) {
 "\n"
 "       The algorithm for the area of geodesic polygon is given in Section 6 of\n"
 "       C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43-55 (2013);\n"
-"       DOI <https://dx.doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
+"       DOI <https://doi.org/10.1007/s00190-012-0578-z>; addenda:\n"
 "       <http://geographiclib.sourceforge.net/geod-addenda.html>.\n"
 "\n"
 "AUTHOR\n"
diff --git a/man/RhumbSolve.1 b/man/RhumbSolve.1
index 7f81313..b739c94 100644
--- a/man/RhumbSolve.1
+++ b/man/RhumbSolve.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RHUMBSOLVE 1"
-.TH RHUMBSOLVE 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH RHUMBSOLVE 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -282,7 +278,7 @@ COORDINATES\*(C'\fR section of \fIGeoConvert\fR\|(1).
 precision, \fIprec\fR = 3 giving 1 mm precision, etc.  \fIprec\fR is the
 number of digits after the decimal point for lengths.  For decimal
 degrees, the number of digits after the decimal point is \fIprec\fR + 5.
-For \s-1DMS \s0(degree, minute, seconds) output, the number of digits after the
+For \s-1DMS\s0 (degree, minute, seconds) output, the number of digits after the
 decimal point in the seconds component is \fIprec\fR + 1.  The minimum
 value of \fIprec\fR is 0 and the maximum is 10.
 .SH "ERRORS"
@@ -326,17 +322,17 @@ Waypoints on the route at intervals of 2000km:
 \&   for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |
 \&   RhumbSolve \-L 40:38:23N 073:46:44W 103:34:58.2 \-: \-p 0
 \&
-\&   40:38:23.0N 073:46:44.0W
-\&   36:24:30.3N 051:28:26.4W
-\&   32:10:26.8N 030:20:57.3W
-\&   27:56:13.2N 010:10:54.2W
-\&   23:41:50.1N 009:12:45.5E
-\&   19:27:18.7N 027:59:22.1E
-\&   15:12:40.2N 046:17:01.1E
-\&   10:57:55.9N 064:12:52.8E
-\&   06:43:07.3N 081:53:28.8E
-\&   02:28:16.2N 099:24:54.5E
-\&   01:46:36.0S 116:52:59.7E
+\&   40:38:23.0N 073:46:44.0W 0
+\&   36:24:30.3N 051:28:26.4W 9817078307821
+\&   32:10:26.8N 030:20:57.3W 18224745682005
+\&   27:56:13.2N 010:10:54.2W 25358020327741
+\&   23:41:50.1N 009:12:45.5E 31321269267102
+\&   19:27:18.7N 027:59:22.1E 36195163180159
+\&   15:12:40.2N 046:17:01.1E 40041499143669
+\&   10:57:55.9N 064:12:52.8E 42906570007050
+\&   06:43:07.3N 081:53:28.8E 44823504180200
+\&   02:28:16.2N 099:24:54.5E 45813843358737
+\&   01:46:36.0S 116:52:59.7E 45888525219677
 .Ve
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
diff --git a/man/RhumbSolve.1.html b/man/RhumbSolve.1.html
index 1c4ce74..854702f 100644
--- a/man/RhumbSolve.1.html
+++ b/man/RhumbSolve.1.html
@@ -176,17 +176,17 @@
 <pre><code>   for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |
    RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0
 
-   40:38:23.0N 073:46:44.0W
-   36:24:30.3N 051:28:26.4W
-   32:10:26.8N 030:20:57.3W
-   27:56:13.2N 010:10:54.2W
-   23:41:50.1N 009:12:45.5E
-   19:27:18.7N 027:59:22.1E
-   15:12:40.2N 046:17:01.1E
-   10:57:55.9N 064:12:52.8E
-   06:43:07.3N 081:53:28.8E
-   02:28:16.2N 099:24:54.5E
-   01:46:36.0S 116:52:59.7E</code></pre>
+   40:38:23.0N 073:46:44.0W 0
+   36:24:30.3N 051:28:26.4W 9817078307821
+   32:10:26.8N 030:20:57.3W 18224745682005
+   27:56:13.2N 010:10:54.2W 25358020327741
+   23:41:50.1N 009:12:45.5E 31321269267102
+   19:27:18.7N 027:59:22.1E 36195163180159
+   15:12:40.2N 046:17:01.1E 40041499143669
+   10:57:55.9N 064:12:52.8E 42906570007050
+   06:43:07.3N 081:53:28.8E 44823504180200
+   02:28:16.2N 099:24:54.5E 45813843358737
+   01:46:36.0S 116:52:59.7E 45888525219677</code></pre>
 
 <h1 id="SEE-ALSO">SEE ALSO</h1>
 
diff --git a/man/RhumbSolve.pod b/man/RhumbSolve.pod
index c59c001..6ade5bd 100644
--- a/man/RhumbSolve.pod
+++ b/man/RhumbSolve.pod
@@ -221,17 +221,17 @@ Waypoints on the route at intervals of 2000km:
    for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |
    RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0
 
-   40:38:23.0N 073:46:44.0W
-   36:24:30.3N 051:28:26.4W
-   32:10:26.8N 030:20:57.3W
-   27:56:13.2N 010:10:54.2W
-   23:41:50.1N 009:12:45.5E
-   19:27:18.7N 027:59:22.1E
-   15:12:40.2N 046:17:01.1E
-   10:57:55.9N 064:12:52.8E
-   06:43:07.3N 081:53:28.8E
-   02:28:16.2N 099:24:54.5E
-   01:46:36.0S 116:52:59.7E
+   40:38:23.0N 073:46:44.0W 0
+   36:24:30.3N 051:28:26.4W 9817078307821
+   32:10:26.8N 030:20:57.3W 18224745682005
+   27:56:13.2N 010:10:54.2W 25358020327741
+   23:41:50.1N 009:12:45.5E 31321269267102
+   19:27:18.7N 027:59:22.1E 36195163180159
+   15:12:40.2N 046:17:01.1E 40041499143669
+   10:57:55.9N 064:12:52.8E 42906570007050
+   06:43:07.3N 081:53:28.8E 44823504180200
+   02:28:16.2N 099:24:54.5E 45813843358737
+   01:46:36.0S 116:52:59.7E 45888525219677
 
 =head1 SEE ALSO
 
diff --git a/man/RhumbSolve.usage b/man/RhumbSolve.usage
index 7a078a5..ecfdc23 100644
--- a/man/RhumbSolve.usage
+++ b/man/RhumbSolve.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    RhumbSolve --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/RhumbSolve.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/RhumbSolve.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -185,17 +185,17 @@ int usage(int retval, bool brief) {
 "          for ((i = 0; i <= 20; i += 2)); do echo ${i}000000;done |\n"
 "          RhumbSolve -L 40:38:23N 073:46:44W 103:34:58.2 -: -p 0\n"
 "\n"
-"          40:38:23.0N 073:46:44.0W\n"
-"          36:24:30.3N 051:28:26.4W\n"
-"          32:10:26.8N 030:20:57.3W\n"
-"          27:56:13.2N 010:10:54.2W\n"
-"          23:41:50.1N 009:12:45.5E\n"
-"          19:27:18.7N 027:59:22.1E\n"
-"          15:12:40.2N 046:17:01.1E\n"
-"          10:57:55.9N 064:12:52.8E\n"
-"          06:43:07.3N 081:53:28.8E\n"
-"          02:28:16.2N 099:24:54.5E\n"
-"          01:46:36.0S 116:52:59.7E\n"
+"          40:38:23.0N 073:46:44.0W 0\n"
+"          36:24:30.3N 051:28:26.4W 9817078307821\n"
+"          32:10:26.8N 030:20:57.3W 18224745682005\n"
+"          27:56:13.2N 010:10:54.2W 25358020327741\n"
+"          23:41:50.1N 009:12:45.5E 31321269267102\n"
+"          19:27:18.7N 027:59:22.1E 36195163180159\n"
+"          15:12:40.2N 046:17:01.1E 40041499143669\n"
+"          10:57:55.9N 064:12:52.8E 42906570007050\n"
+"          06:43:07.3N 081:53:28.8E 44823504180200\n"
+"          02:28:16.2N 099:24:54.5E 45813843358737\n"
+"          01:46:36.0S 116:52:59.7E 45888525219677\n"
 "\n"
 "SEE ALSO\n"
 "       GeoConvert(1), GeodSolve(1), TransverseMercatorProj(1).\n"
diff --git a/man/TransverseMercatorProj.1 b/man/TransverseMercatorProj.1
index 651b861..f787e60 100644
--- a/man/TransverseMercatorProj.1
+++ b/man/TransverseMercatorProj.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.31)
+.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -46,7 +46,7 @@
 .ie \n(.g .ds Aq \(aq
 .el       .ds Aq '
 .\"
-.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" If the F register is >0, we'll generate index entries on stderr for
 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{
-.    if \nF \{
-.        de IX
-.        tm Index:\\$1\t\\n%\t"\\$2"
+.if !\nF .nr F 0
+.if \nF>0 \{\
+.    de IX
+.    tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.        if !\nF==2 \{
-.            nr % 0
-.            nr F 2
-.        \}
+.    if !\nF==2 \{\
+.        nr % 0
+.        nr F 2
 .    \}
 .\}
-.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "TRANSVERSEMERCATORPROJ 1"
-.TH TRANSVERSEMERCATORPROJ 1 "2016-02-14" "GeographicLib 1.46" "GeographicLib Utilities"
+.TH TRANSVERSEMERCATORPROJ 1 "2017-02-15" "GeographicLib 1.47" "GeographicLib Utilities"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -271,9 +267,9 @@ terminate; following lines will be converted.
 .IX Header "SEE ALSO"
 The algorithms for the transverse Mercator projection are described in
 C. F. F. Karney, \fITransverse Mercator with an accuracy of a few
-nanometers\fR, J. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI
-\&\s0<https://dx.doi.org/10.1007/s00190\-011\-0445\-3>; preprint
-<http://arxiv.org/abs/1002.1417>.  The explanation of the extended
+nanometers\fR, J. Geodesy \fB85\fR(8), 475\-485 (Aug. 2011); \s-1DOI\s0
+<https://doi.org/10.1007/s00190\-011\-0445\-3>; preprint
+<https://arxiv.org/abs/1002.1417>.  The explanation of the extended
 domain of the projection with the \fB\-t\fR option is given in Section 5 of
 this paper.
 .SH "HISTORY"
diff --git a/man/TransverseMercatorProj.1.html b/man/TransverseMercatorProj.1.html
index 18535a3..9b72b46 100644
--- a/man/TransverseMercatorProj.1.html
+++ b/man/TransverseMercatorProj.1.html
@@ -148,7 +148,7 @@
 
 <h1 id="SEE-ALSO">SEE ALSO</h1>
 
-<p>The algorithms for the transverse Mercator projection are described in C. F. F. Karney, <i>Transverse Mercator with an accuracy of a few nanometers</i>, J. Geodesy <b>85</b>(8), 475-485 (Aug. 2011); DOI <a href="https://dx.doi.org/10.1007/s00190-011-0445-3">https://dx.doi.org/10.1007/s00190-011-0445-3</a>; preprint <a href="http://arxiv.org/abs/1002.1417">http://arxiv.org/abs/1002.1417</a>. The explanation of the extended domain of the projection with the <b>-t</b> option is given in  [...]
+<p>The algorithms for the transverse Mercator projection are described in C. F. F. Karney, <i>Transverse Mercator with an accuracy of a few nanometers</i>, J. Geodesy <b>85</b>(8), 475-485 (Aug. 2011); DOI <a href="https://doi.org/10.1007/s00190-011-0445-3">https://doi.org/10.1007/s00190-011-0445-3</a>; preprint <a href="https://arxiv.org/abs/1002.1417">https://arxiv.org/abs/1002.1417</a>. The explanation of the extended domain of the projection with the <b>-t</b> option is given in Sect [...]
 
 <h1 id="HISTORY">HISTORY</h1>
 
diff --git a/man/TransverseMercatorProj.pod b/man/TransverseMercatorProj.pod
index d14e2c7..5ab9160 100644
--- a/man/TransverseMercatorProj.pod
+++ b/man/TransverseMercatorProj.pod
@@ -158,8 +158,8 @@ B<TransverseMercatorProj> was written by Charles Karney.
 The algorithms for the transverse Mercator projection are described in
 C. F. F. Karney, I<Transverse Mercator with an accuracy of a few
 nanometers>, J. Geodesy B<85>(8), 475-485 (Aug. 2011); DOI
-L<https://dx.doi.org/10.1007/s00190-011-0445-3>; preprint
-L<http://arxiv.org/abs/1002.1417>.  The explanation of the extended
+L<https://doi.org/10.1007/s00190-011-0445-3>; preprint
+L<https://arxiv.org/abs/1002.1417>.  The explanation of the extended
 domain of the projection with the B<-t> option is given in Section 5 of
 this paper.
 
diff --git a/man/TransverseMercatorProj.usage b/man/TransverseMercatorProj.usage
index ed45ce5..c5d007c 100644
--- a/man/TransverseMercatorProj.usage
+++ b/man/TransverseMercatorProj.usage
@@ -9,7 +9,7 @@ int usage(int retval, bool brief) {
 "For full documentation type:\n"
 "    TransverseMercatorProj --help\n"
 "or visit:\n"
-"    http://geographiclib.sourceforge.net/1.46/TransverseMercatorProj.1.html\n";
+"    http://geographiclib.sourceforge.net/1.47/TransverseMercatorProj.1.html\n";
   else
     ( retval ? std::cerr : std::cout ) << "Man page:\n"
 "NAME\n"
@@ -136,8 +136,8 @@ int usage(int retval, bool brief) {
 "       The algorithms for the transverse Mercator projection are described in\n"
 "       C. F. F. Karney, Transverse Mercator with an accuracy of a few\n"
 "       nanometers, J. Geodesy 85(8), 475-485 (Aug. 2011); DOI\n"
-"       <https://dx.doi.org/10.1007/s00190-011-0445-3>; preprint\n"
-"       <http://arxiv.org/abs/1002.1417>.  The explanation of the extended\n"
+"       <https://doi.org/10.1007/s00190-011-0445-3>; preprint\n"
+"       <https://arxiv.org/abs/1002.1417>.  The explanation of the extended\n"
 "       domain of the projection with the -t option is given in Section 5 of\n"
 "       this paper.\n"
 "\n"
diff --git a/matlab/Makefile.in b/matlab/Makefile.in
index 53ba6a4..bcf5ec6 100644
--- a/matlab/Makefile.in
+++ b/matlab/Makefile.in
@@ -198,6 +198,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -248,6 +251,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/matlab/geographiclib-legacy/geocentricforward.m b/matlab/geographiclib-legacy/geocentricforward.m
index dab49c0..3fa1a6b 100644
--- a/matlab/geographiclib-legacy/geocentricforward.m
+++ b/matlab/geographiclib-legacy/geocentricforward.m
@@ -22,9 +22,13 @@ function [geocentric, rot] = geocentricforward(geodetic, a, f)
 %           a unit vector in local cartesian coordinates (east, north, up)
 %           by M transforms the vector to geocentric coordinates.
 %
+%   a = equatorial radius (meters)
+%   f = flattening (0 means a sphere)
+%   If a and f are omitted, the WGS84 values are used.
+%
 %   See also GEOCENT_FWD.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 2)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/geocentricreverse.m b/matlab/geographiclib-legacy/geocentricreverse.m
index 6e05829..fe1c60f 100644
--- a/matlab/geographiclib-legacy/geocentricreverse.m
+++ b/matlab/geographiclib-legacy/geocentricreverse.m
@@ -23,13 +23,13 @@ function [geodetic, rot] = geocentricreverse(geocentric, a, f)
 %           transforms the vector to local cartesian coordinates
 %           (east, north, up).
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
 %   See also GEOCENT_INV.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 2)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/geodesicdirect.m b/matlab/geographiclib-legacy/geodesicdirect.m
index 5aac8ec..102fde9 100644
--- a/matlab/geographiclib-legacy/geodesicdirect.m
+++ b/matlab/geographiclib-legacy/geodesicdirect.m
@@ -25,13 +25,13 @@ function [latlong, aux] = geodesicdirect(geodesic, a, f)
 %       geodesic scale 2 to 1 = aux(:,4)
 %       area under geodesic = aux(:,5) in meters^2
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
 %   See also GEODRECKON.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 2)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/geodesicinverse.m b/matlab/geographiclib-legacy/geodesicinverse.m
index ef9d687..cac1991 100644
--- a/matlab/geographiclib-legacy/geodesicinverse.m
+++ b/matlab/geographiclib-legacy/geodesicinverse.m
@@ -25,13 +25,13 @@ function [geodesic, aux] = geodesicinverse(latlong, a, f)
 %       geodesic scale 2 to 1 = aux(:,4)
 %       area under geodesic = aux(:,5) in meters^2
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
 %   See also GEODDISTANCE.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 2)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/geodesicline.m b/matlab/geographiclib-legacy/geodesicline.m
index 2d7ed42..602c6f6 100644
--- a/matlab/geographiclib-legacy/geodesicline.m
+++ b/matlab/geographiclib-legacy/geodesicline.m
@@ -24,7 +24,7 @@ function [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f)
 %       geodesic scale 2 to 1 = aux(:,4)
 %       area under geodesic = aux(:,5) in meters^2
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
@@ -34,7 +34,7 @@ function [latlong, aux] = geodesicline(lat1, lon1, azi1, distances, a, f)
 %
 %   See also GEODRECKON.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 5)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/localcartesianforward.m b/matlab/geographiclib-legacy/localcartesianforward.m
index 34cddc1..286e6e8 100644
--- a/matlab/geographiclib-legacy/localcartesianforward.m
+++ b/matlab/geographiclib-legacy/localcartesianforward.m
@@ -27,13 +27,13 @@ function [cartesian, rot] = localcartesianforward(origin, geodetic, a, f)
 %           by M transforms the vector to local cartesian coordinates at
 %           (lat0, lon0, h0)
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
 %   See also LOCCART_FWD.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 3)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/localcartesianreverse.m b/matlab/geographiclib-legacy/localcartesianreverse.m
index 65d1f25..2b475ec 100644
--- a/matlab/geographiclib-legacy/localcartesianreverse.m
+++ b/matlab/geographiclib-legacy/localcartesianreverse.m
@@ -27,13 +27,13 @@ function [geodetic, rot] = localcartesianreverse(origin, cartesian, a, f)
 %           h0) by the transpose of M transforms the vector to local
 %           cartesian coordinates at (lat, lon, h).
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
 %   See also LOCCART_INV.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 3)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib-legacy/polygonarea.m b/matlab/geographiclib-legacy/polygonarea.m
index 387202d..0448900 100644
--- a/matlab/geographiclib-legacy/polygonarea.m
+++ b/matlab/geographiclib-legacy/polygonarea.m
@@ -15,7 +15,7 @@ function [area, perimeter] = polygonarea(latlong, a, f)
 %   area is the area in meters^2
 %   perimeter is the perimeter in meters
 %
-%   a = major radius (meters)
+%   a = equatorial radius (meters)
 %   f = flattening (0 means a sphere)
 %   If a and f are omitted, the WGS84 values are used.
 %
@@ -27,7 +27,7 @@ function [area, perimeter] = polygonarea(latlong, a, f)
 %
 %   See also GEODAREA.
 
-% Copyright (c) Charles Karney (2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
 
   if (nargin < 2)
     ellipsoid = defaultellipsoid;
diff --git a/matlab/geographiclib/Contents.m b/matlab/geographiclib/Contents.m
index a5f82b6..293d550 100644
--- a/matlab/geographiclib/Contents.m
+++ b/matlab/geographiclib/Contents.m
@@ -1,5 +1,5 @@
 % GeographicLib toolbox
-% Version 1.46 2016-02-15
+% Version 1.47 2017-02-15
 %
 %   This toolbox provides native MATLAB implementations of a subset of the
 %   C++ library, GeographicLib.  Key components of this toolbox are
@@ -90,4 +90,4 @@
 %   projdoc          - Projections for an ellipsoid
 %   gedoc            - Great ellipses on an ellipsoid of revolution
 
-% Copyright (c) Charles Karney (2015-2016) <charles at karney.com>.
+% Copyright (c) Charles Karney (2015-2017) <charles at karney.com>.
diff --git a/matlab/geographiclib/defaultellipsoid.m b/matlab/geographiclib/defaultellipsoid.m
index 8ff072b..b16068b 100644
--- a/matlab/geographiclib/defaultellipsoid.m
+++ b/matlab/geographiclib/defaultellipsoid.m
@@ -9,8 +9,12 @@ function ellipsoid = defaultellipsoid
 %
 %   See also ECC2FLAT, FLAT2ECC.
 
-  a = 6378137;
-  f = 1/298.257223563;
-  e = flat2ecc(f);
-  ellipsoid = [a, e];
+  persistent ell
+  if isempty(ell)
+    a = 6378137;
+    f = 1/298.257223563;
+    e = flat2ecc(f);
+    ell = [a, e];
+  end
+  ellipsoid = ell;
 end
diff --git a/matlab/geographiclib/eqdazim_fwd.m b/matlab/geographiclib/eqdazim_fwd.m
index 4d945cb..5e4371e 100644
--- a/matlab/geographiclib/eqdazim_fwd.m
+++ b/matlab/geographiclib/eqdazim_fwd.m
@@ -26,7 +26,7 @@ function [x, y, azi, rk] = eqdazim_fwd(lat0, lon0, lat, lon, ellipsoid)
 %   Section 14 of
 %
 %     C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011),
-%     http://arxiv.org/abs/1102.1215
+%     https://arxiv.org/abs/1102.1215
 %     Errata: http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata
 %
 %   describes how to use this projection in the determination of maritime
diff --git a/matlab/geographiclib/eqdazim_inv.m b/matlab/geographiclib/eqdazim_inv.m
index 41f3360..3fed29d 100644
--- a/matlab/geographiclib/eqdazim_inv.m
+++ b/matlab/geographiclib/eqdazim_inv.m
@@ -26,7 +26,7 @@ function [lat, lon, azi, rk] = eqdazim_inv(lat0, lon0, x, y, ellipsoid)
 %   Section 14 of
 %
 %     C. F. F. Karney, Geodesics on an ellipsoid of revolution (2011),
-%     http://arxiv.org/abs/1102.1215
+%     https://arxiv.org/abs/1102.1215
 %     Errata: http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata
 %
 %   describes how to use this projection in the determination of maritime
diff --git a/matlab/geographiclib/gedoc.m b/matlab/geographiclib/gedoc.m
index dbdcb28..965afb1 100644
--- a/matlab/geographiclib/gedoc.m
+++ b/matlab/geographiclib/gedoc.m
@@ -77,7 +77,7 @@ function gedoc
 %   Larger values of e can be used with a corresponding drop in accuracy.
 %   The following table gives the approximate maximum error in gedistance
 %   and gereckon (expressed as a distance) for an ellipsoid with the same
-%   major radius as the WGS84 ellipsoid and different values of the
+%   equatorial radius as the WGS84 ellipsoid and different values of the
 %   flattening (nm means nanometer and um means micrometer).
 %
 %        |f|     error
@@ -114,7 +114,7 @@ function gedoc
 %   See also GEDISTANCE, GERECKON, DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC,
 %     GEODDISTANCE, GEODRECKON.
 
-% Copyright (c) Charles Karney (2014-2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2014-2017) <charles at karney.com>.
 
   help gedoc
 end
diff --git a/matlab/geographiclib/geodarea.m b/matlab/geographiclib/geodarea.m
index 3ffebc3..f828e8f 100644
--- a/matlab/geographiclib/geodarea.m
+++ b/matlab/geographiclib/geodarea.m
@@ -27,7 +27,7 @@ function [A, P, N] = geodarea(lats, lons, ellipsoid)
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   See also GEODDOC, GEODDISTANCE, GEODRECKON, POLYGONAREA,
diff --git a/matlab/geographiclib/geoddistance.m b/matlab/geographiclib/geoddistance.m
index 0417728..3a9e1fe 100644
--- a/matlab/geographiclib/geoddistance.m
+++ b/matlab/geographiclib/geoddistance.m
@@ -26,7 +26,7 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   This function duplicates some of the functionality of the distance
@@ -42,7 +42,7 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
 %   See also GEODDOC, GEODRECKON, GEODAREA, GEODESICINVERSE,
 %     DEFAULTELLIPSOID.
 
-% Copyright (c) Charles Karney (2012-2016) <charles at karney.com>.
+% Copyright (c) Charles Karney (2012-2017) <charles at karney.com>.
 %
 % This is a straightforward transcription of the C++ implementation in
 % GeographicLib and the C++ source should be consulted for additional
@@ -133,7 +133,8 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
 
   sig12 = Z; ssig1 = Z; csig1 = Z; ssig2 = Z; csig2 = Z;
   calp1 = Z; salp1 = Z; calp2 = Z; salp2 = Z;
-  s12 = Z; m12 = Z; M12 = Z; M21 = Z; omg12 = Z; somg12 = 2+Z; comg12 = Z;
+  s12 = Z; m12 = Z; M12 = Z; M21 = Z;
+  omg12 = Z; somg12 = 2+Z; comg12 = Z; domg12 = Z;
 
   m = lat1 == -90 | slam12 == 0;
 
@@ -199,8 +200,7 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
         numit(g) = k;
         [v(g), dv(g), ...
          salp2(g), calp2(g), sig12(g), ...
-         ssig1(g), csig1(g), ssig2(g), csig2(g), epsi(g), ...
-         somg12(g), comg12(g)] = ...
+         ssig1(g), csig1(g), ssig2(g), csig2(g), epsi(g), domg12(g)] = ...
             Lambda12(sbet1(g), cbet1(g), dn1(g), ...
                      sbet2(g), cbet2(g), dn2(g), ...
                      salp1(g), calp1(g), slam12(g), clam12(g), f, A3x, C3x);
@@ -254,6 +254,11 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
 
       m12(g) = m12(g) * b;
       s12(g) = s12(g) * b;
+      if areap
+        sdomg12 = sin(domg12(g)); cdomg12 = cos(domg12(g));
+        somg12(g) = slam12(g) .* cdomg12 - clam12(g) .* sdomg12;
+        comg12(g) = clam12(g) .* cdomg12 + slam12(g) .* sdomg12;
+      end
     end
   end
 
@@ -277,7 +282,6 @@ function [s12, azi1, azi2, S12, m12, M12, M21, a12] = geoddistance ...
     S12(calp0 == 0 | salp0 == 0) = 0;
 
     l = ~m & somg12 > 1;
-    [somg12, comg12] = norm2(somg12, comg12);
     somg12(l) = sin(omg12(l)); comg12(l) = cos(omg12(l));
 
     l = ~m & comg12 > -0.7071 & sbet2 - sbet1 < 1.75;
@@ -467,7 +471,7 @@ end
 
 function [lam12, dlam12, ...
           salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, epsi, ...
-          somg12, comg12] = ...
+          domg12] = ...
     Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1, ...
              slam120, clam120, f, A3x, C3x)
 %LAMBDA12  Solve the hybrid problem
@@ -508,7 +512,8 @@ function [lam12, dlam12, ...
   Ca = C3f(epsi, C3x);
   B312 = SinCosSeries(true, ssig2, csig2, Ca) - ...
          SinCosSeries(true, ssig1, csig1, Ca);
-  lam12 = eta - f * A3f(epsi, A3x) .* salp0 .* (sig12 + B312);
+  domg12 = -f * A3f(epsi, A3x) .* salp0 .* (sig12 + B312);
+  lam12 = eta + domg12;
 
   [~, dlam12] = ...
       Lengths(epsi, sig12, ...
diff --git a/matlab/geographiclib/geoddoc.m b/matlab/geographiclib/geoddoc.m
index 4e70889..3004955 100644
--- a/matlab/geographiclib/geoddoc.m
+++ b/matlab/geographiclib/geoddoc.m
@@ -7,7 +7,7 @@ function geoddoc
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   which, in turn, is based on the classic solution of the geodesic
@@ -102,8 +102,8 @@ function geoddoc
 %    Larger values of e can be used with a corresponding drop in accuracy.
 %    The following table gives the approximate maximum error in
 %    geoddistance and geodreckon (expressed as a distance) for an ellipsoid
-%    with the same major radius as the WGS84 ellipsoid and different values
-%    of the flattening (nm means nanometer and um means micrometer).
+%    with the same equatorial radius as the WGS84 ellipsoid and different
+%    values of the flattening (nm means nanometer and um means micrometer).
 %
 %         |f|     error
 %         0.01    25 nm
@@ -166,7 +166,7 @@ function geoddoc
 %     DEFAULTELLIPSOID, ECC2FLAT, FLAT2ECC,
 %     GEODESICDIRECT, GEODESICLINE, GEODESICINVERSE, POLYGONAREA.
 
-% Copyright (c) Charles Karney (2012-2015) <charles at karney.com>.
+% Copyright (c) Charles Karney (2012-2017) <charles at karney.com>.
 
   help geoddoc
 end
diff --git a/matlab/geographiclib/geodreckon.m b/matlab/geographiclib/geodreckon.m
index 635ef6f..258e0e8 100644
--- a/matlab/geographiclib/geodreckon.m
+++ b/matlab/geographiclib/geodreckon.m
@@ -50,7 +50,7 @@ function [lat2, lon2, azi2, S12, m12, M12, M21, a12_s12] = geodreckon ...
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   This function duplicates some of the functionality of the RECKON
diff --git a/matlab/geographiclib/geographiclib_test.m b/matlab/geographiclib/geographiclib_test.m
index f1b3b43..e16f347 100644
--- a/matlab/geographiclib/geographiclib_test.m
+++ b/matlab/geographiclib/geographiclib_test.m
@@ -27,6 +27,7 @@ function geographiclib_test
   i = GeodSolve59; if i, n=n+1; fprintf('GeodSolve59 fail: %d\n', i); end
   i = GeodSolve61; if i, n=n+1; fprintf('GeodSolve61 fail: %d\n', i); end
   i = GeodSolve73; if i, n=n+1; fprintf('GeodSolve73 fail: %d\n', i); end
+  i = GeodSolve74; if i, n=n+1; fprintf('GeodSolve74 fail: %d\n', i); end
   i = Planimeter0; if i, n=n+1; fprintf('Planimeter0 fail: %d\n', i); end
   i = Planimeter5; if i, n=n+1; fprintf('Planimeter5 fail: %d\n', i); end
   i = Planimeter6; if i, n=n+1; fprintf('Planimeter6 fail: %d\n', i); end
@@ -433,6 +434,22 @@ function n = GeodSolve73
   n = n + assertEquals(azi2, 0, 0.5e-5);
 end
 
+function n = GeodSolve74
+% Check fix for inaccurate areas, bug introduced in v1.46, fixed
+% 2015-10-16.
+  n = 0;
+  [s12, azi1, azi2, S12, m12, M12, M21, a12] = ...
+      geoddistance(54.1589, 15.3872, 54.1591, 15.3877);
+  n = n + assertEquals(azi1, 55.723110355, 5e-9);
+  n = n + assertEquals(azi2, 55.723515675, 5e-9);
+  n = n + assertEquals(s12,  39.527686385, 5e-9);
+  n = n + assertEquals(a12,   0.000355495, 5e-9);
+  n = n + assertEquals(m12,  39.527686385, 5e-9);
+  n = n + assertEquals(M12,   0.999999995, 5e-9);
+  n = n + assertEquals(M21,   0.999999995, 5e-9);
+  n = n + assertEquals(S12, 286698586.30197, 5e-4);
+end
+
 function n = Planimeter0
 % Check fix for pole-encircling bug found 2011-03-16
   n = 0;
diff --git a/matlab/geographiclib/gnomonic_fwd.m b/matlab/geographiclib/gnomonic_fwd.m
index 85226ed..44ebc61 100644
--- a/matlab/geographiclib/gnomonic_fwd.m
+++ b/matlab/geographiclib/gnomonic_fwd.m
@@ -34,7 +34,7 @@ function [x, y, azi, rk] = gnomonic_fwd(lat0, lon0, lat, lon, ellipsoid)
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   which also includes methods for solving the "intersection" and
diff --git a/matlab/geographiclib/gnomonic_inv.m b/matlab/geographiclib/gnomonic_inv.m
index cf76983..ee5c783 100644
--- a/matlab/geographiclib/gnomonic_inv.m
+++ b/matlab/geographiclib/gnomonic_inv.m
@@ -35,7 +35,7 @@ function [lat, lon, azi, rk] = gnomonic_inv(lat0, lon0, x, y, ellipsoid)
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   which also includes methods for solving the "intersection" and
diff --git a/matlab/geographiclib/private/copysignx.m b/matlab/geographiclib/private/copysignx.m
index 6fa27a0..e8f81f0 100644
--- a/matlab/geographiclib/private/copysignx.m
+++ b/matlab/geographiclib/private/copysignx.m
@@ -11,8 +11,8 @@ function z = copysignx(x, y)
   if octavep
     z = abs(x) .* (1 - 2 * signbit(y));
   else
-    z = abs(x);
-    l = y < 0 | (y == 0 & 1/y < 0);
+    z = abs(x + 0*y);
+    l = z > -1 & (y < 0 | (y == 0 & 1./y < 0));
     z(l) = -z(l);
   end
 end
diff --git a/matlab/geographiclib/projdoc.m b/matlab/geographiclib/projdoc.m
index c3b0776..d8bdaa8 100644
--- a/matlab/geographiclib/projdoc.m
+++ b/matlab/geographiclib/projdoc.m
@@ -26,7 +26,7 @@ function projdoc
 %
 %     C. F. F. Karney, Algorithms for geodesics,
 %     J. Geodesy 87, 43-55 (2013);
-%     https://dx.doi.org/10.1007/s00190-012-0578-z
+%     https://doi.org/10.1007/s00190-012-0578-z
 %     Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 %
 %   The parameters of the ellipsoid are specified by the optional ellipsoid
diff --git a/maxima/geod.mac b/maxima/geod.mac
index 5cd8325..a7b336f 100644
--- a/maxima/geod.mac
+++ b/maxima/geod.mac
@@ -9,7 +9,7 @@ References:
 
    Charles F. F. Karney,
    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
-   https://dx.doi.org/10.1007/s00190-012-0578-z
+   https://doi.org/10.1007/s00190-012-0578-z
    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 
 There are 4 sections in this file
diff --git a/maxima/geodesic.mac b/maxima/geodesic.mac
index 5ec2fe5..dd76ef9 100644
--- a/maxima/geodesic.mac
+++ b/maxima/geodesic.mac
@@ -1,7 +1,7 @@
 /*
 Solve the direct and inverse geodesic problems accurately.
 
-Copyright (c) Charles Karney (2013-2016) <charles at karney.com> and
+Copyright (c) Charles Karney (2013-2017) <charles at karney.com> and
 licensed under the MIT/X11 License.  For more information, see
 http://geographiclib.sourceforge.net/
 
@@ -9,7 +9,7 @@ References:
 
    Charles F. F. Karney,
    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
-   https://dx.doi.org/10.1007/s00190-012-0578-z
+   https://doi.org/10.1007/s00190-012-0578-z
    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 
 This program solves the geodesic problem either using series expansions
@@ -101,7 +101,7 @@ documented at
 */
 
 /* The corresponding version of GeographicLib */
-geod_version:[1,46,0]$
+geod_version:[1,47,0]$
 
 /* Load series created by geod.mac (NEED TO UNCOMMENT THE LAST LINE OF
 geod.mac TO GENERATE THIS FILE). */
@@ -174,8 +174,8 @@ C4coeff(n):=
 
 sq(x):=x^2$
 hypotx(x, y):=sqrt(x * x + y * y)$
-copysign(x, y):=abs(x) *
-(if y < 0b0 or (y == 0b0 and atan2(y, -1b0) < 0b0) then -1 else 1)$
+/* doesn't handle -0.0 */
+copysign(x, y):=abs(x) * (if y < 0b0 then -1 else 1)$
 /*
 pow(x,y):=x^y$
 cbrtx(x) := block([y:pow(abs(x), 1/3b0)],
@@ -671,7 +671,7 @@ geod_geninverse(g, lat1, lon1, lat2, lon2):=block(
       estimate of alp1 lies outside (0,pi); in this case, the new starting
       guess is taken to be (alp1a + alp1b) / 2. */
       [ssig1 : 0b0, csig1 : 0b0, ssig2 : 0b0, csig2 : 0b0, eps : 0b0,
-      numit : 0,
+      domg12 : 0b0, numit : 0,
       /* Bracketing range */
       salp1a : tiny, calp1a : 1b0, salp1b : tiny, calp1b : -1b0,
       tripn : false, tripb : false, contflag, dv, v],
@@ -686,8 +686,8 @@ geod_geninverse(g, lat1, lon1, lat2, lon2):=block(
           v : r[1],
           salp2:r[2], calp2:r[3], sig12:r[4],
           ssig1:r[5], csig1:r[6], ssig2:r[7], csig2:r[8],
-          if exact then E:r[9] else eps:r[9], somg12:r[10], comg12:r[11],
-          dv:r[12]),
+          if exact then E:r[9] else eps:r[9], domg12:r[10],
+          dv:r[11]),
         /* 2 * tol0 is approximately 1 ulp for a number in [0, pi]. */
         /* Reversed test to allow escape with NaNs */
         if tripb or not(abs(v) >= (if tripn then 8 else 1) * tol0) then
@@ -732,7 +732,10 @@ geod_geninverse(g, lat1, lon1, lat2, lon2):=block(
         s12x:r[1], m12x:r[2], M12:r[4], M21:r[5]),
       m12x : m12x * g[g_b],
       s12x : s12x * g[g_b],
-      a12 : sig12 / degree ) ),
+      a12 : sig12 / degree,
+      block([sdomg12 : sin(domg12), cdomg12 : cos(domg12)],
+        somg12 : slam12 * cdomg12 - clam12 * sdomg12,
+        comg12 : clam12 * cdomg12 + slam12 * sdomg12) ) ),
   s12 : 0b0 + s12x,           /* Convert -0 to 0 */
   m12 : 0b0 + m12x,           /* Convert -0 to 0 */
   block(
@@ -756,9 +759,8 @@ geod_geninverse(g, lat1, lon1, lat2, lon2):=block(
       B42 : SinCosSeries(false, ssig2, csig2, Ca),
       S12 : A4 * (B42 - B41))
     else S12 : 0, /* Avoid problems with indeterminate sig1, sig2 on equator */
-    if not meridian then (
-      if somg12 > 1 then (somg12 : sin(omg12), comg12 : cos(omg12))
-      else block([t:norm2(somg12, comg12)], somg12:t[1], comg12:t[2])),
+    if not meridian and somg12 > 1 then
+      (somg12 : sin(omg12), comg12 : cos(omg12)),
     if not meridian and
     /* omg12 < 3/4 * pi */
     comg12 > -0.7071b0 and   /* Long difference not too big */
@@ -1026,13 +1028,13 @@ InverseStart(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2,
   )$
 
 /* Return [lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-(E or eps), (omg12 or domg12), dlam12]
+(E or eps), domg12, dlam12]
 */
 Lambda12(g, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
          slam120, clam120, diffp):=
 block([salp2 : 0b0, calp2 : 0b0, sig12 : 0b0,
   ssig1 : 0b0, csig1 : 0b0, ssig2 : 0b0, csig2 : 0b0, eps : 0b0, E : [],
-  somg12 : 0b0, comg12 : 0b0, dlam12 : 0b0,
+  domg12 : 0b0, somg12 : 0b0, comg12 : 0b0, dlam12 : 0b0,
   salp0, calp0,
   somg1, comg1, somg2, comg2, cchi1, cchi2, lam12,
   B312, k2, Ca, eta],
@@ -1081,17 +1083,19 @@ block([salp2 : 0b0, calp2 : 0b0, sig12 : 0b0,
   somg12 : 0b0 + max(0b0, comg1 * somg2 - somg1 * comg2),
   comg12 :                comg1 * comg2 + somg1 * somg2,
   k2 : sq(calp0) * g[g_ep2],
-  if exact then block([schi12,cchi12],
+  if exact then block([schi12, cchi12, deta12],
     E : Ef(-k2, -g[g_ep2]),
     schi12 : 0b0 + max(0b0, cchi1 * somg2 - somg1 * cchi2),
     cchi12 :                cchi1 * cchi2 + somg1 * somg2,
     /* eta = chi12 - lam120 */
     eta : atan2(schi12 * clam120 - cchi12 * slam120,
                 cchi12 * clam120 + schi12 * slam120),
-    lam12 : eta -
-      g[g_e2]/g[g_f1] * salp0 * E[e_hc] / (pi/2) *
+    deta12 : -g[g_e2]/g[g_f1] * salp0 * E[e_hc] / (pi/2) *
       (sig12 + deltah(ssig2, csig2, dn2, E[e_k2], E[e_alpha2], E[e_hc]) -
-       deltah(ssig1, csig1, dn1, E[e_k2], E[e_alpha2], E[e_hc]) ) )
+       deltah(ssig1, csig1, dn1, E[e_k2], E[e_alpha2], E[e_hc]) ),
+    lam12 : eta + deta12,
+    domg12 : deta12 + atan2(schi12 * comg12 - cchi12 * somg12,
+                            cchi12 * comg12 + schi12 * somg12))
   else ( /* eta = omg12 - lam120 */
     eta : atan2(somg12 * clam120 - comg12 * slam120,
                 comg12 * clam120 + somg12 * slam120),
@@ -1099,7 +1103,8 @@ block([salp2 : 0b0, calp2 : 0b0, sig12 : 0b0,
     Ca : C3f(g, eps),
     B312 : (SinCosSeries(true, ssig2, csig2, Ca) -
       SinCosSeries(true, ssig1, csig1, Ca)),
-    lam12 : eta - g[g_f] * A3f(g, eps) * salp0 * (sig12 + B312)),
+    domg12 : -g[g_f] * A3f(g, eps) * salp0 * (sig12 + B312),
+    lam12 : eta + domg12),
   if diffp then (
     if calp2 = 0b0 then
     dlam12 : - 2 * g[g_f1] * dn1 / sbet1
@@ -1109,7 +1114,7 @@ block([salp2 : 0b0, calp2 : 0b0, sig12 : 0b0,
         dlam12:r[2]),
       dlam12 : dlam12 * g[g_f1] / (calp2 * cbet2))),
   [lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-  if exact then E else eps, somg12, comg12, dlam12])$
+  if exact then E else eps, domg12, dlam12])$
 
 A3f(g, eps):=block(
   /* Evaluate sum(A3x[k] * eps^k, k, 0, nA3x-1) by Horner's method */
diff --git a/maxima/tm.mac b/maxima/tm.mac
index 037f4cd..d0bfe7e 100644
--- a/maxima/tm.mac
+++ b/maxima/tm.mac
@@ -2,7 +2,7 @@
 
 Arbitrary precision Transverse Mercator Projection
 
-Copyright (c) Charles Karney (2009-2010) <charles at karney.com> and
+Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and
 licensed under the MIT/X11 License.  For more information, see
 http://geographiclib.sourceforge.net/
 
@@ -12,15 +12,15 @@ Reference:
    Transverse Mercator with an accuracy of a few nanometers,
    J. Geodesy 85(8), 475-485 (Aug. 2011).
    DOI 10.1007/s00190-011-0445-3
-   preprint http://arxiv.org/abs/1002.1417
+   preprint https://arxiv.org/abs/1002.1417
    resource page http://geographiclib.sourceforge.net/tm.html
 
 The parameters for the transformation are set by
 
-setparams(a,invf,k0)$
-    sets the major radius, inverse flattening, and central scale
+setparams(a,f,k0)$
+    sets the equatorial radius, inverse flattening, and central scale
     factor. The default is
-      setparams(6378137b0, 298.257223563b0, 0.9996b0)$
+      setparams(6378137b0, 1/298.257223563b0, 0.9996b0)$
     appropriate for UTM applications.
 
 tm(lat,lon);
@@ -78,7 +78,7 @@ pi:bfloat(%pi)$
 degree:pi/180$
 ratprint:false$
 debugprint:false$
-setparams(a1,invf,k1):=(a:bfloat(a1),f:1/bfloat(invf),k0:bfloat(k1),
+setparams(a1,f1,k1):=(a:bfloat(a1),f:bfloat(f1),k0:bfloat(k1),
   e2:f*(2-f),
   e:sqrt(e2),
   kcu:kc(e2),
@@ -87,9 +87,9 @@ setparams(a1,invf,k1):=(a:bfloat(a1),f:1/bfloat(invf),k0:bfloat(k1),
   ecv:ec(1-e2),
   n:f/(2-f),
   'done)$
-setparams(6378137b0, 298.257223563b0, 0.9996b0)$  /* WGS 84 */
-/* setparams(6378388b0, 297b0, 0.9996b0)$ International */
-/* setparams(1/ec(0.01b0), 30*sqrt(11b0)+100, 1b0)$ testing, eps = 0.1*/
+setparams(6378137b0, 1/298.257223563b0, 0.9996b0)$  /* WGS 84 */
+/* setparams(6378388b0, 1/297b0, 0.9996b0)$ International */
+/* setparams(1/ec(0.01b0), 1/(30*sqrt(11b0)+100), 1b0)$ testing, eps = 0.1*/
 
 /*
 Interpret x_y(y) as x <- y, i.e., "transform quantity y to quantity x"
diff --git a/maxima/tmseries.mac b/maxima/tmseries.mac
index fae4a55..4c31c42 100644
--- a/maxima/tmseries.mac
+++ b/maxima/tmseries.mac
@@ -11,7 +11,7 @@ Reference:
    Transverse Mercator with an accuracy of a few nanometers,
    J. Geodesy 85(8), 475-485 (Aug. 2011).
    DOI 10.1007/s00190-011-0445-3
-   preprint http://arxiv.org/abs/1002.1417
+   preprint https://arxiv.org/abs/1002.1417
    resource page http://geographiclib.sourceforge.net/tm.html
 
 Compute coefficient for forward and inverse trigonometric series for
diff --git a/python/MANIFEST.in b/python/MANIFEST.in
index 2459fc2..9561fb1 100644
--- a/python/MANIFEST.in
+++ b/python/MANIFEST.in
@@ -1 +1 @@
-# empty!
+include README.rst
diff --git a/python/Makefile.in b/python/Makefile.in
index 2318dd5..fd26c64 100644
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -198,6 +198,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -248,6 +251,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/python/README.rst b/python/README.rst
index 77db72b..bd45034 100644
--- a/python/README.rst
+++ b/python/README.rst
@@ -1,7 +1,7 @@
 This implements
-`algorithms for geodesics <https://dx.doi.org/10.1007/s00190-012-0578-z>`_
+`algorithms for geodesics <https://doi.org/10.1007/s00190-012-0578-z>`_
 (Karney, 2013) for solving the direct and inverse problems for an
 ellipsoid of revolution.
 
 Documentation is available at
-`<http://geographiclib.sourceforge.net/1.46/python/>`_.
+`<http://geographiclib.sourceforge.net/1.47/python/>`_.
diff --git a/python/doc/conf.py b/python/doc/conf.py
index b6accde..91ed73c 100644
--- a/python/doc/conf.py
+++ b/python/doc/conf.py
@@ -14,6 +14,7 @@
 
 import sys
 import os
+import sphinx
 sys.path.insert(0, os.path.abspath('..'))
 import geographiclib
 import geographiclib.geodesic
@@ -109,7 +110,7 @@ pygments_style = 'sphinx'
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+html_theme = 'default' if sphinx.__version__ < '1.3' else 'classic'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
diff --git a/python/doc/geodesics.rst b/python/doc/geodesics.rst
index f4ed55c..e35d25c 100644
--- a/python/doc/geodesics.rst
+++ b/python/doc/geodesics.rst
@@ -170,12 +170,12 @@ References
 
 * F. W. Bessel,
   `The calculation of longitude and latitude from geodesic measurements (1825)
-  <http://arxiv.org/abs/0908.1824>`_,
+  <https://arxiv.org/abs/0908.1824>`_,
   Astron. Nachr. **331**\ (8), 852–861 (2010),
   translated by C. F. F. Karney and R. E. Deakin.
 * F. R. Helmert,
   `Mathematical and Physical Theories of Higher Geodesy, Vol 1
-  <https://dx.doi.org/10.5281/zenodo.32050>`_,
+  <https://doi.org/10.5281/zenodo.32050>`_,
   (Teubner, Leipzig, 1880), Chaps. 5–7.
 * T. Vincenty,
   `Direct and inverse solutions of geodesics on the ellipsoid with
@@ -184,16 +184,16 @@ References
   Survey Review **23**\ (176), 88–93 (1975).
 * J. Danielsen,
   `The area under the geodesic
-  <https://dx.doi.org/10.1179/003962689791474267>`_,
+  <https://doi.org/10.1179/003962689791474267>`_,
   Survey Review **30**\ (232), 61–66 (1989).
 * C. F. F. Karney,
   `Algorithms for geodesics
-  <https://dx.doi.org/10.1007/s00190-012-0578-z>`_,
+  <https://doi.org/10.1007/s00190-012-0578-z>`_,
   J. Geodesy **87**\ (1) 43–55 (2013);
   `addenda <http://geographiclib.sourceforge.net/geod-addenda.html>`_.
 * C. F. F. Karney,
   `Geodesics on an ellipsoid of revolution
-  <http://arxiv.org/abs/1102.1215v1>`_,
+  <https://arxiv.org/abs/1102.1215v1>`_,
   Feb. 2011;
   `errata
   <http://geographiclib.sourceforge.net/geod-addenda.html#geod-errata>`_.
diff --git a/python/doc/index.rst b/python/doc/index.rst
index 2e2c11b..00f866e 100644
--- a/python/doc/index.rst
+++ b/python/doc/index.rst
@@ -45,8 +45,8 @@ and install it with
 
 .. code-block:: sh
 
-  tar xpfz geographiclib-1.46.tar.gz
-  cd geographiclib-1.46
+  tar xpfz geographiclib-1.47.tar.gz
+  cd geographiclib-1.47
   python setup.py install
 
 It's a good idea to run the unit tests to verify that the installation
@@ -98,6 +98,12 @@ GeographicLib in various languages
 Change log
 ----------
 
+* Version 1.47 (released 2017-02-15)
+
+  * Fix the packaging, incorporating the patches in version 1.46.3.
+  * Improve accuracy of area calculation (fixing a flaw introduced in
+    version 1.46)
+
 * Version 1.46 (released 2016-02-15)
 
   * Add Geodesic.DirectLine, Geodesic.ArcDirectLine,
diff --git a/python/doc/interface.rst b/python/doc/interface.rst
index 6a912c0..b546b12 100644
--- a/python/doc/interface.rst
+++ b/python/doc/interface.rst
@@ -106,15 +106,15 @@ Restrictions on the parameters
 * Longitudes and azimuths are unrestricted; internally these are
   exactly reduced to the range [−180°, 180°); but see also the
   LONG_UNROLL bit.
-* The equatorial radius a and the polar semi-axis b must both be
+* The equatorial radius *a* and the polar semi-axis *b* must both be
   positive and finite (this implies that −∞ < *f* < 1).
 * The flattening *f* should satisfy *f* ∈ [−1/50,1/50] in order to retain
   full accuracy. This condition holds for most applications in geodesy.
 
 Reasonably accurate results can be obtained for −0.2 ≤ *f* ≤ 0.2. Here
 is a table of the approximate maximum error (expressed as a distance)
-for an ellipsoid with the same major radius as the WGS84 ellipsoid and
-different values of the flattening.
+for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid
+and different values of the flattening.
 
 ======== =======
 abs(*f*) error
diff --git a/python/geographiclib/__init__.py b/python/geographiclib/__init__.py
index 4e3507b..6dd1a7b 100644
--- a/python/geographiclib/__init__.py
+++ b/python/geographiclib/__init__.py
@@ -1,7 +1,7 @@
 """geographiclib: geodesic routines from GeographicLib"""
 
-__version_info__ = (1, 46, 0)
+__version_info__ = (1, 47, 0)
 """GeographicLib version as a tuple"""
 
-__version__ = "1.46"
+__version__ = "1.47"
 """GeographicLib version as a string"""
diff --git a/python/geographiclib/geodesic.py b/python/geographiclib/geodesic.py
index 1034d96..a6555e8 100644
--- a/python/geographiclib/geodesic.py
+++ b/python/geographiclib/geodesic.py
@@ -69,10 +69,10 @@ The public attributes for this class are
 #
 #    Charles F. F. Karney,
 #    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
-#    https://dx.doi.org/10.1007/s00190-012-0578-z
+#    https://doi.org/10.1007/s00190-012-0578-z
 #    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 #
-# Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
+# Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
 # under the MIT/X11 License.  For more information, see
 # http://geographiclib.sourceforge.net/
 ######################################################################
@@ -309,9 +309,9 @@ class Geodesic(object):
     self._etol2 = 0.1 * Geodesic.tol2_ / math.sqrt( max(0.001, abs(self.f)) *
                                                     min(1.0, 1-self.f/2) / 2 )
     if not(Math.isfinite(self.a) and self.a > 0):
-      raise ValueError("Major radius is not positive")
+      raise ValueError("Equatorial radius is not positive")
     if not(Math.isfinite(self._b) and self._b > 0):
-      raise ValueError("Minor radius is not positive")
+      raise ValueError("Polar semi-axis is not positive")
     self._A3x = list(range(Geodesic.nA3x_))
     self._C3x = list(range(Geodesic.nC3x_))
     self._C4x = list(range(Geodesic.nC4x_))
@@ -427,9 +427,9 @@ class Geodesic(object):
 
   # return s12b, m12b, m0, M12, M21
   def _Lengths(self, eps, sig12,
-              ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask,
-              # Scratch areas of the right size
-              C1a, C2a):
+               ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2, outmask,
+               # Scratch areas of the right size
+               C1a, C2a):
     """Private: return a bunch of lengths"""
     # Return s12b, m12b, m0, M12, M21, where
     # m12b = (reduced length)/_b; s12b = distance/_b,
@@ -482,8 +482,8 @@ class Geodesic(object):
   # return sig12, salp1, calp1, salp2, calp2, dnm
   def _InverseStart(self, sbet1, cbet1, dn1, sbet2, cbet2, dn2,
                     lam12, slam12, clam12,
-                   # Scratch areas of the right size
-                   C1a, C2a):
+                    # Scratch areas of the right size
+                    C1a, C2a):
     """Private: Find a starting value for Newton's method."""
     # Return a starting point for Newton's method in salp1 and calp1 (function
     # value is -1).  If Newton's method doesn't need to be used, return also
@@ -623,11 +623,11 @@ class Geodesic(object):
     return sig12, salp1, calp1, salp2, calp2, dnm
 
   # return lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps,
-  # somg12, comg12, dlam12
+  # domg12, dlam12
   def _Lambda12(self, sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
                 slam120, clam120, diffp,
-               # Scratch areas of the right size
-               C1a, C2a, C3a):
+                # Scratch areas of the right size
+                C1a, C2a, C3a):
     """Private: Solve hybrid problem"""
     if sbet1 == 0 and calp1 == 0:
       # Break degeneracy of equatorial line.  This case has already been
@@ -668,7 +668,7 @@ class Geodesic(object):
 
     # sig12 = sig2 - sig1, limit to [0, pi]
     sig12 = math.atan2(max(0.0, csig1 * ssig2 - ssig1 * csig2),
-                       csig1 * csig2 + ssig1 * ssig2)
+                                csig1 * csig2 + ssig1 * ssig2)
 
     # omg12 = omg2 - omg1, limit to [0, pi]
     somg12 = max(0.0, comg1 * somg2 - somg1 * comg2)
@@ -683,7 +683,8 @@ class Geodesic(object):
     self._C3f(eps, C3a)
     B312 = (Geodesic._SinCosSeries(True, ssig2, csig2, C3a) -
             Geodesic._SinCosSeries(True, ssig1, csig1, C3a))
-    lam12 = eta - self.f * self._A3f(eps) * salp0 * (sig12 + B312)
+    domg12 =  -self.f * self._A3f(eps) * salp0 * (sig12 + B312)
+    lam12 = eta + domg12
 
     if diffp:
       if calp2 == 0:
@@ -697,7 +698,7 @@ class Geodesic(object):
       dlam12 = Math.nan
 
     return (lam12, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2, eps,
-            somg12, comg12, dlam12)
+            domg12, dlam12)
 
   # return a12, s12, salp1, calp1, salp2, calp2, m12, M12, M21, S12
   def _GenInverse(self, lat1, lon1, lat2, lon2, outmask):
@@ -795,7 +796,7 @@ class Geodesic(object):
 
       # sig12 = sig2 - sig1
       sig12 = math.atan2(max(0.0, csig1 * ssig2 - ssig1 * csig2),
-                         csig1 * csig2 + ssig1 * ssig2)
+                                  csig1 * csig2 + ssig1 * ssig2)
 
       s12x, m12x, dummy, M12, M21 = self._Lengths(
         self._n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2,
@@ -820,7 +821,7 @@ class Geodesic(object):
     # end if meridian:
 
     # somg12 > 1 marks that it needs to be calculated
-    somg12 = 2.0; omg12 = 0.0
+    somg12 = 2.0; comg12 = 0.0; omg12 = 0.0
     if (not meridian and
         sbet1 == 0 and   # and sbet2 == 0
         # Mimic the way Lambda12 works with calp1 = 0
@@ -876,7 +877,7 @@ class Geodesic(object):
           # the WGS84 test set: mean = 1.47, sd = 1.25, max = 16
           # WGS84 and random input: mean = 2.85, sd = 0.60
           (v, salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-           eps, somg12, comg12, dv) = self._Lambda12(
+           eps, domg12, dv) = self._Lambda12(
              sbet1, cbet1, dn1, sbet2, cbet2, dn2,
              salp1, calp1, slam12, clam12, numit < Geodesic.maxit1_,
              C1a, C2a, C3a)
@@ -932,6 +933,12 @@ class Geodesic(object):
         m12x *= self._b
         s12x *= self._b
         a12 = math.degrees(sig12)
+        if outmask & Geodesic.AREA:
+          # omg12 = lam12 - domg12
+          sdomg12 = math.sin(domg12); cdomg12 = math.cos(domg12)
+          somg12 = slam12 * cdomg12 - clam12 * sdomg12
+          comg12 = clam12 * cdomg12 + slam12 * sdomg12
+
     # end elif not meridian
 
     if outmask & Geodesic.DISTANCE:
@@ -964,11 +971,8 @@ class Geodesic(object):
         # Avoid problems with indeterminate sig1, sig2 on equator
         S12 = 0.0
 
-      if not meridian:
-        if somg12 > 1:
-          somg12 = math.sin(omg12); comg12 = math.cos(omg12)
-        else:
-          somg12, comg12 = Math.norm(somg12, comg12)
+      if not meridian and somg12 > 1:
+        somg12 = math.sin(omg12); comg12 = math.cos(omg12)
 
       if (not meridian and
           # omg12 < 3/4 * pi
diff --git a/python/geographiclib/geodesicline.py b/python/geographiclib/geodesicline.py
index ac44406..4e72544 100644
--- a/python/geographiclib/geodesicline.py
+++ b/python/geographiclib/geodesicline.py
@@ -48,7 +48,7 @@ The public attributes for this class are
 #
 #    Charles F. F. Karney,
 #    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
-#    https://dx.doi.org/10.1007/s00190-012-0578-z
+#    https://doi.org/10.1007/s00190-012-0578-z
 #    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 #
 # Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
diff --git a/python/geographiclib/polygonarea.py b/python/geographiclib/polygonarea.py
index b0f9385..9377c63 100644
--- a/python/geographiclib/polygonarea.py
+++ b/python/geographiclib/polygonarea.py
@@ -36,7 +36,7 @@ The public attributes for this class are
 #
 #    Charles F. F. Karney,
 #    Algorithms for geodesics, J. Geodesy 87, 43-55 (2013),
-#    https://dx.doi.org/10.1007/s00190-012-0578-z
+#    https://doi.org/10.1007/s00190-012-0578-z
 #    Addenda: http://geographiclib.sourceforge.net/geod-addenda.html
 #
 # Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
diff --git a/python/geographiclib/test/test_geodesic.py b/python/geographiclib/test/test_geodesic.py
index 566f12d..16b4dcf 100644
--- a/python/geographiclib/test/test_geodesic.py
+++ b/python/geographiclib/test/test_geodesic.py
@@ -430,6 +430,20 @@ class GeodSolveTest(unittest.TestCase):
     self.assertAlmostEqual(dir["lon2"], -170, delta = 0.5e-5)
     self.assertAlmostEqual(dir["azi2"], 0, delta = 0.5e-5)
 
+  def test_GeodSolve74(self):
+    # Check fix for inaccurate areas, bug introduced in v1.46, fixed
+    # 2015-10-16.
+    inv = Geodesic.WGS84.Inverse(54.1589, 15.3872, 54.1591, 15.3877,
+                                 Geodesic.ALL)
+    self.assertAlmostEqual(inv["azi1"], 55.723110355, delta = 5e-9);
+    self.assertAlmostEqual(inv["azi2"], 55.723515675, delta = 5e-9);
+    self.assertAlmostEqual(inv["s12"],  39.527686385, delta = 5e-9);
+    self.assertAlmostEqual(inv["a12"],   0.000355495, delta = 5e-9);
+    self.assertAlmostEqual(inv["m12"],  39.527686385, delta = 5e-9);
+    self.assertAlmostEqual(inv["M12"],   0.999999995, delta = 5e-9);
+    self.assertAlmostEqual(inv["M21"],   0.999999995, delta = 5e-9);
+    self.assertAlmostEqual(inv["S12"], 286698586.30197, delta = 5e-4);
+
 class PlanimeterTest(unittest.TestCase):
 
   polygon = Geodesic.WGS84.Polygon(False)
diff --git a/python/setup.py b/python/setup.py
index 2baa5b2..ac82aba 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -38,7 +38,7 @@ class TestCommand(Command):
                                           ]))
 
 name = "geographiclib"
-version = "1.46"
+version = "1.47"
 
 setup(name = name,
       version = version,
diff --git a/src/AlbersEqualArea.cpp b/src/AlbersEqualArea.cpp
index 2839efc..22ca5f2 100644
--- a/src/AlbersEqualArea.cpp
+++ b/src/AlbersEqualArea.cpp
@@ -2,7 +2,7 @@
  * \file AlbersEqualArea.cpp
  * \brief Implementation for GeographicLib::AlbersEqualArea class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -34,9 +34,9 @@ namespace GeographicLib {
     , _qx(_qZ / ( 2 * _e2m ))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k0) && k0 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(abs(stdlat) <= 90))
@@ -63,9 +63,9 @@ namespace GeographicLib {
     , _qx(_qZ / ( 2 * _e2m ))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k1) && k1 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(abs(stdlat1) <= 90))
@@ -97,9 +97,9 @@ namespace GeographicLib {
     , _qx(_qZ / ( 2 * _e2m ))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k1) && k1 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(coslat1 >= 0))
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 215d242..5b3ead3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,10 +47,10 @@ else ()
     OUTPUT_NAME ${LIBNAME})
   if (APPLE AND GEOGRAPHICLIB_PRECISION EQUAL 5)
     if (GEOGRAPHICLIB_SHARED_LIB)
-      target_link_libraries (${PROJECT_SHARED_LIBRARIES} ${MPFR_LIBRARIES})
+      target_link_libraries (${PROJECT_SHARED_LIBRARIES} ${HIGHPREC_LIBRARIES})
     endif ()
     if (GEOGRAPHICLIB_STATIC_LIB)
-      target_link_libraries (${PROJECT_STATIC_LIBRARIES} ${MPFR_LIBRARIES})
+      target_link_libraries (${PROJECT_STATIC_LIBRARIES} ${HIGHPREC_LIBRARIES})
     endif ()
   endif ()
 endif ()
@@ -97,19 +97,25 @@ if (MSVC AND PACKAGE_DEBUG_LIBS)
 endif ()
 
 if (MSVC AND GEOGRAPHICLIB_SHARED_LIB)
-  if (NOT CMAKE_VERSION VERSION_LESS 3.0)
-    # Suppress 3.0 warnings about use of the LOCATION target property
-    cmake_policy (SET CMP0026 OLD)
+  if (NOT CMAKE_VERSION VERSION_LESS 3.1)
+    message (STATUS "Using TARGET_PDB_FILE")
+    install (FILES $<TARGET_PDB_FILE:${PROJECT_SHARED_LIBRARIES}>
+      DESTINATION bin OPTIONAL)
+  else ()
+    if (NOT CMAKE_VERSION VERSION_LESS 3.0)
+      # Suppress 3.0 warnings about use of the LOCATION target property
+      cmake_policy (SET CMP0026 OLD)
+    endif ()
+    # Install pdb file for shared library.
+    foreach (_c ${CMAKE_CONFIGURATION_TYPES})
+      string (TOUPPER ${_c} _C)
+      get_target_property (_P ${PROJECT_SHARED_LIBRARIES} LOCATION_${_C})
+      get_filename_component (_D ${_P} PATH)
+      get_filename_component (_N ${_P} NAME_WE)
+      set (_PDB ${_D}/${_N}.pdb)
+      install (FILES ${_PDB} DESTINATION bin CONFIGURATIONS ${_c} OPTIONAL)
+    endforeach ()
   endif ()
-  # Install pdb file for shared library.
-  foreach (_c ${CMAKE_CONFIGURATION_TYPES})
-    string (TOUPPER ${_c} _C)
-    get_target_property (_P ${PROJECT_SHARED_LIBRARIES} LOCATION_${_C})
-    get_filename_component (_D ${_P} PATH)
-    get_filename_component (_N ${_P} NAME_WE)
-    set (_PDB ${_D}/${_N}.pdb)
-    install (FILES ${_PDB} DESTINATION bin CONFIGURATIONS ${_c} OPTIONAL)
-  endforeach ()
 endif ()
 
 # Put the library into a folder in the IDE
diff --git a/src/EllipticFunction.cpp b/src/EllipticFunction.cpp
index 3c0650d..f85855b 100644
--- a/src/EllipticFunction.cpp
+++ b/src/EllipticFunction.cpp
@@ -2,7 +2,7 @@
  * \file EllipticFunction.cpp
  * \brief Implementation for GeographicLib::EllipticFunction class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -221,11 +221,42 @@ namespace GeographicLib {
 
   void EllipticFunction::Reset(real k2, real alpha2,
                                real kp2, real alphap2) {
+    // Accept nans here (needed for GeodesicExact)
+    if (k2 > 1)
+      throw GeographicErr("Parameter k2 is not in (-inf, 1]");
+    if (alpha2 > 1)
+      throw GeographicErr("Parameter alpha2 is not in (-inf, 1]");
+    if (kp2 < 0)
+      throw GeographicErr("Parameter kp2 is not in [0, inf)");
+    if (alphap2 < 0)
+      throw GeographicErr("Parameter alphap2 is not in [0, inf)");
     _k2 = k2;
     _kp2 = kp2;
     _alpha2 = alpha2;
     _alphap2 = alphap2;
     _eps = _k2/Math::sq(sqrt(_kp2) + 1);
+    // Values of complete elliptic integrals for k = 0,1 and alpha = 0,1
+    //         K     E     D
+    // k = 0:  pi/2  pi/2  pi/4
+    // k = 1:  inf   1     inf
+    //                    Pi    G     H
+    // k = 0, alpha = 0:  pi/2  pi/2  pi/4
+    // k = 1, alpha = 0:  inf   1     1
+    // k = 0, alpha = 1:  inf   inf   pi/2
+    // k = 1, alpha = 1:  inf   inf   inf
+    //
+    // Pi(0, k) = K(k)
+    // G(0, k) = E(k)
+    // H(0, k) = K(k) - D(k)
+    // Pi(0, k) = K(k)
+    // G(0, k) = E(k)
+    // H(0, k) = K(k) - D(k)
+    // Pi(alpha2, 0) = pi/(2*sqrt(1-alpha2))
+    // G(alpha2, 0) = pi/(2*sqrt(1-alpha2))
+    // H(alpha2, 0) = pi/(2*(1 + sqrt(1-alpha2)))
+    // Pi(alpha2, 1) = inf
+    // H(1, k) = K(k)
+    // G(alpha2, 1) = H(alpha2, 1) = RC(1, alphap2)
     if (_k2) {
       // Complete elliptic integral K(k), Carlson eq. 4.1
       // http://dlmf.nist.gov/19.25.E1
@@ -235,21 +266,38 @@ namespace GeographicLib {
       _Ec = _kp2 ? 2 * RG(_kp2, 1) : 1;
       // D(k) = (K(k) - E(k))/k^2, Carlson eq.4.3
       // http://dlmf.nist.gov/19.25.E1
-      _Dc = _kp2 ? RD(real(0), _kp2, 1) / 3 : Math::infinity();
+      _Dc = _kp2 ? RD(0, _kp2, 1) / 3 : Math::infinity();
     } else {
       _Kc = _Ec = Math::pi()/2; _Dc = _Kc/2;
     }
     if (_alpha2) {
       // http://dlmf.nist.gov/19.25.E2
-      real rj = _kp2 ? RJ(0, _kp2, 1, _alphap2) : Math::infinity();
+      real rj = (_kp2 != 0 && _alphap2 != 0) ? RJ(0, _kp2, 1, _alphap2) :
+        Math::infinity(),
+        // Only use rc if _kp2 = 0.
+        rc = _kp2 ? 0 : (_alphap2 ? RC(1, _alphap2) : Math::infinity());
       // Pi(alpha^2, k)
-      _Pic = _Kc + _alpha2 * rj / 3;
+      _Pic = _kp2 != 0 ? _Kc + _alpha2 * rj / 3 : Math::infinity();
       // G(alpha^2, k)
-      _Gc = _kp2 ? _Kc + (_alpha2 - _k2) * rj / 3 :  RC(1, _alphap2);
+      _Gc = _kp2 ? _Kc + (_alpha2 - _k2) * rj / 3 :  rc;
       // H(alpha^2, k)
-      _Hc = _kp2 ? _Kc - _alphap2 * rj / 3 : RC(1, _alphap2);
+      _Hc = _kp2 ? _Kc - (_alphap2 ? _alphap2 * rj : 0) / 3 : rc;
     } else {
-      _Pic = _Kc; _Gc = _Ec; _Hc = _Kc - _Dc;
+      _Pic = _Kc; _Gc = _Ec;
+      // Hc = Kc - Dc but this involves large cancellations if k2 is close to
+      // 1.  So write (for alpha2 = 0)
+      //   Hc = int(cos(phi)^2/sqrt(1-k2*sin(phi)^2),phi,0,pi/2)
+      //      = 1/sqrt(1-k2) * int(sin(phi)^2/sqrt(1-k2/kp2*sin(phi)^2,...)
+      //      = 1/kp * D(i*k/kp)
+      // and use D(k) = RD(0, kp2, 1) / 3
+      // so Hc = 1/kp * RD(0, 1/kp2, 1) / 3
+      //       = kp2 * RD(0, 1, kp2) / 3
+      // using http://dlmf.nist.gov/19.20.E18
+      // Equivalently
+      //   RF(x, 1) - RD(0, x, 1)/3 = x * RD(0, 1, x)/3 for x > 0
+      // For k2 = 1 and alpha2 = 0, we have
+      //   Hc = int(cos(phi),...) = 1
+      _Hc = _kp2 ? _kp2 * RD(0, 1, _kp2) / 3 : 1;
     }
   }
 
@@ -319,48 +367,46 @@ namespace GeographicLib {
   Math::real EllipticFunction::F(real sn, real cn, real dn) const {
     // Carlson, eq. 4.5 and
     // http://dlmf.nist.gov/19.25.E5
-    real fi = abs(sn) * RF(cn*cn, dn*dn, 1);
+    real cn2 = cn*cn, dn2 = dn*dn,
+      fi = cn2 ? abs(sn) * RF(cn2, dn2, 1) : K();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       fi = 2 * K() - fi;
-    if (sn < 0)
-      fi = -fi;
-    return fi;
+    return Math::copysign(fi, sn);
   }
 
   Math::real EllipticFunction::E(real sn, real cn, real dn) const {
     real
       cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn,
-      ei = ( _k2 <= 0 ?
-             // Carlson, eq. 4.6 and
-             // http://dlmf.nist.gov/19.25.E9
-             RF(cn2, dn2, 1) - _k2 * sn2 * RD(cn2, dn2, 1) / 3 :
-             ( _kp2 >= 0 ?
-               // http://dlmf.nist.gov/19.25.E10
-               _kp2 * RF(cn2, dn2, 1) +
-               _k2 * _kp2 * sn2 * RD(cn2, 1, dn2) / 3 +
-               _k2 * abs(cn) / dn :
-               // http://dlmf.nist.gov/19.25.E11
-               - _kp2 * sn2 * RD(dn2, 1, cn2) / 3 + dn / abs(cn) ) );
-    ei *= abs(sn);
+      ei = cn2 ? abs(sn) *( _k2 <= 0 ?
+                            // Carlson, eq. 4.6 and
+                            // http://dlmf.nist.gov/19.25.E9
+                            RF(cn2, dn2, 1) - _k2 * sn2 * RD(cn2, dn2, 1) / 3 :
+                            ( _kp2 >= 0 ?
+                              // http://dlmf.nist.gov/19.25.E10
+                              _kp2 * RF(cn2, dn2, 1) +
+                              _k2 * _kp2 * sn2 * RD(cn2, 1, dn2) / 3 +
+                              _k2 * abs(cn) / dn :
+                              // http://dlmf.nist.gov/19.25.E11
+                              - _kp2 * sn2 * RD(dn2, 1, cn2) / 3 +
+                              dn / abs(cn) ) ) :
+      E();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       ei = 2 * E() - ei;
-    if (sn < 0)
-      ei = -ei;
-    return ei;
+    return Math::copysign(ei, sn);
   }
 
   Math::real EllipticFunction::D(real sn, real cn, real dn) const {
     // Carlson, eq. 4.8 and
     // http://dlmf.nist.gov/19.25.E13
-    real di = abs(sn) * sn*sn * RD(cn*cn, dn*dn, 1) / 3;
+    real
+      cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn,
+      di = cn2 ? abs(sn) * sn2 * RD(cn2, dn2, 1) / 3 : D();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       di = 2 * D() - di;
-    if (sn < 0)
-      di = -di;
-    return di;
+    return Math::copysign(di, sn);
   }
 
   Math::real EllipticFunction::Pi(real sn, real cn, real dn) const {
@@ -368,42 +414,41 @@ namespace GeographicLib {
     // http://dlmf.nist.gov/19.25.E14
     real
       cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn,
-      pii = abs(sn) * (RF(cn2, dn2, 1) +
-                       _alpha2 * sn2 * RJ(cn2, dn2, 1, 1 - _alpha2 * sn2) / 3);
+      pii = cn2 ? abs(sn) * (RF(cn2, dn2, 1) +
+                             _alpha2 * sn2 *
+                             RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) :
+      Pi();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       pii = 2 * Pi() - pii;
-    if (sn < 0)
-      pii = -pii;
-    return pii;
+    return Math::copysign(pii, sn);
   }
 
   Math::real EllipticFunction::G(real sn, real cn, real dn) const {
     real
       cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn,
-      gi = abs(sn) * (RF(cn2, dn2, 1) +
-                      (_alpha2 - _k2) * sn2 *
-                      RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3);
+      gi = cn2 ? abs(sn) * (RF(cn2, dn2, 1) +
+                            (_alpha2 - _k2) * sn2 *
+                            RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) :
+      G();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       gi = 2 * G() - gi;
-    if (sn < 0)
-      gi = -gi;
-    return gi;
+    return Math::copysign(gi, sn);
   }
 
   Math::real EllipticFunction::H(real sn, real cn, real dn) const {
     real
       cn2 = cn*cn, dn2 = dn*dn, sn2 = sn*sn,
-      hi = abs(sn) * (RF(cn2, dn2, 1) -
-                      _alphap2 * sn2 *
-                      RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3);
+      // WARNING: large cancellation if k2 = 1, alpha2 = 0, and phi near pi/2
+      hi = cn2 ? abs(sn) * (RF(cn2, dn2, 1) -
+                            _alphap2 * sn2 *
+                            RJ(cn2, dn2, 1, cn2 + _alphap2 * sn2) / 3) :
+      H();
     // Enforce usual trig-like symmetries
     if (cn < 0)
       hi = 2 * H() - hi;
-    if (sn < 0)
-      hi = -hi;
-    return hi;
+    return Math::copysign(hi, sn);
   }
 
   Math::real EllipticFunction::deltaF(real sn, real cn, real dn) const {
@@ -418,8 +463,7 @@ namespace GeographicLib {
     return E(sn, cn, dn) * (Math::pi()/2) / E() - atan2(sn, cn);
   }
 
-  Math::real EllipticFunction::deltaPi(real sn, real cn, real dn)
-    const {
+  Math::real EllipticFunction::deltaPi(real sn, real cn, real dn) const {
     // Function is periodic with period pi
     if (cn < 0) { cn = -cn; sn = -sn; }
     return Pi(sn, cn, dn) * (Math::pi()/2) / Pi() - atan2(sn, cn);
@@ -444,13 +488,15 @@ namespace GeographicLib {
   }
 
   Math::real EllipticFunction::F(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaF(sn, cn, Delta(sn, cn)) + phi) * K() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? F(sn, cn, dn) :
+      (deltaF(sn, cn, dn) + phi) * K() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::E(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaE(sn, cn, Delta(sn, cn)) + phi) * E() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? E(sn, cn, dn) :
+      (deltaE(sn, cn, dn) + phi) * E() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::Ed(real ang) const {
@@ -462,40 +508,47 @@ namespace GeographicLib {
   }
 
   Math::real EllipticFunction::Pi(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaPi(sn, cn, Delta(sn, cn)) + phi) * Pi() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? Pi(sn, cn, dn) :
+      (deltaPi(sn, cn, dn) + phi) * Pi() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::D(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaD(sn, cn, Delta(sn, cn)) + phi) * D() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? D(sn, cn, dn) :
+      (deltaD(sn, cn, dn) + phi) * D() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::G(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaG(sn, cn, Delta(sn, cn)) + phi) * G() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? G(sn, cn, dn) :
+      (deltaG(sn, cn, dn) + phi) * G() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::H(real phi) const {
-    real sn = sin(phi), cn = cos(phi);
-    return (deltaH(sn, cn, Delta(sn, cn)) + phi) * H() / (Math::pi()/2);
+    real sn = sin(phi), cn = cos(phi), dn = Delta(sn, cn);
+    return abs(phi) < Math::pi() ? H(sn, cn, dn) :
+      (deltaH(sn, cn, dn) + phi) * H() / (Math::pi()/2);
   }
 
   Math::real EllipticFunction::Einv(real x) const {
     real tolJAC = sqrt(numeric_limits<real>::epsilon() * real(0.01));
-    real n = floor(x / (2 * _Ec) + 0.5);
+    real n = floor(x / (2 * _Ec) + real(0.5));
     x -= 2 * _Ec * n;           // x now in [-ec, ec)
     // Linear approximation
     real phi = Math::pi() * x / (2 * _Ec); // phi in [-pi/2, pi/2)
     // First order correction
     phi -= _eps * sin(2 * phi) / 2;
+    // For kp2 close to zero use asin(x/_Ec) or
+    // J. P. Boyd, Applied Math. and Computation 218, 7005-7013 (2012)
+    // https://doi.org/10.1016/j.amc.2011.12.021
     for (int i = 0; i < num_ || GEOGRAPHICLIB_PANIC; ++i) {
       real
         sn = sin(phi),
         cn = cos(phi),
         dn = Delta(sn, cn),
         err = (E(sn, cn, dn) - x)/dn;
-      phi = phi - err;
+      phi -= err;
       if (abs(err) < tolJAC)
         break;
     }
diff --git a/src/GeoCoords.cpp b/src/GeoCoords.cpp
index ba07366..f375ef7 100644
--- a/src/GeoCoords.cpp
+++ b/src/GeoCoords.cpp
@@ -2,7 +2,7 @@
  * \file GeoCoords.cpp
  * \brief Implementation for GeographicLib::GeoCoords class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -50,7 +50,7 @@ namespace GeographicLib {
                             + " (ex: 38n, 09s, n)");
       UTMUPS::DecodeZone(sa[zoneind], _zone, _northp);
       for (unsigned i = 0; i < 2; ++i)
-        (i ? _northing : _easting) = Utility::num<real>(sa[coordind + i]);
+        (i ? _northing : _easting) = Utility::val<real>(sa[coordind + i]);
       UTMUPS::Reverse(_zone, _northp, _easting, _northing,
                       _lat, _long, _gamma, _k);
       FixHemisphere();
diff --git a/src/Geocentric.cpp b/src/Geocentric.cpp
index ed7b165..1130a83 100644
--- a/src/Geocentric.cpp
+++ b/src/Geocentric.cpp
@@ -2,7 +2,7 @@
  * \file Geocentric.cpp
  * \brief Implementation for GeographicLib::Geocentric class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -23,9 +23,9 @@ namespace GeographicLib {
     , _maxrad(2 * _a / numeric_limits<real>::epsilon())
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
   }
 
   const Geocentric& Geocentric::WGS84() {
diff --git a/src/Geodesic.cpp b/src/Geodesic.cpp
index cf50e82..fdeb75f 100644
--- a/src/Geodesic.cpp
+++ b/src/Geodesic.cpp
@@ -2,7 +2,7 @@
  * \file Geodesic.cpp
  * \brief Implementation for GeographicLib::Geodesic class
  *
- * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -78,9 +78,9 @@ namespace GeographicLib {
              sqrt( max(real(0.001), abs(_f)) * min(real(1), 1 - _f/2) / 2 ))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_b) && _b > 0))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     A3coeff();
     C3coeff();
     C4coeff();
@@ -258,7 +258,7 @@ namespace GeographicLib {
 
       // sig12 = sig2 - sig1
       sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2),
-                    csig1 * csig2 + ssig1 * ssig2);
+                                 csig1 * csig2 + ssig1 * ssig2);
       {
         real dummy;
         Lengths(_n, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2, cbet1, cbet2,
@@ -334,7 +334,7 @@ namespace GeographicLib {
         // guess is taken to be (alp1a + alp1b) / 2.
         //
         // initial values to suppress warnings (if loop is executed 0 times)
-        real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0;
+        real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, eps = 0, domg12 = 0;
         unsigned numit = 0;
         // Bracketing range
         real salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1;
@@ -347,7 +347,7 @@ namespace GeographicLib {
           real v = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
                             slam12, clam12,
                             salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-                            eps, somg12, comg12, numit < maxit1_, dv, Ca);
+                            eps, domg12, numit < maxit1_, dv, Ca);
           // Reversed test to allow escape with NaNs
           if (tripb || !(abs(v) >= (tripn ? 8 : 1) * tol0_)) break;
           // Update bracketing values
@@ -399,6 +399,12 @@ namespace GeographicLib {
         m12x *= _b;
         s12x *= _b;
         a12 = sig12 / Math::degree();
+        if (outmask & AREA) {
+          // omg12 = lam12 - domg12
+          real sdomg12 = sin(domg12), cdomg12 = cos(domg12);
+          somg12 = slam12 * cdomg12 - clam12 * sdomg12;
+          comg12 = clam12 * cdomg12 + slam12 * sdomg12;
+        }
       }
     }
 
@@ -434,11 +440,8 @@ namespace GeographicLib {
         // Avoid problems with indeterminate sig1, sig2 on equator
         S12 = 0;
 
-      if (!meridian) {
-        if (somg12 > 1) {
-          somg12 = sin(omg12); comg12 = cos(omg12);
-        } else
-          Math::norm(somg12, comg12);
+      if (!meridian && somg12 > 1) {
+        somg12 = sin(omg12); comg12 = cos(omg12);
       }
 
       if (!meridian &&
@@ -810,7 +813,7 @@ namespace GeographicLib {
                                 real& sig12,
                                 real& ssig1, real& csig1,
                                 real& ssig2, real& csig2,
-                                real& eps, real& somg12, real& comg12,
+                                real& eps, real& domg12,
                                 bool diffp, real& dlam12,
                                 // Scratch area of the right size
                                 real Ca[]) const {
@@ -825,7 +828,7 @@ namespace GeographicLib {
       salp0 = salp1 * cbet1,
       calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0
 
-    real somg1, comg1, somg2, comg2, lam12;
+    real somg1, comg1, somg2, comg2, somg12, comg12, lam12;
     // tan(bet1) = tan(sig1) * cos(alp1)
     // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1)
     ssig1 = sbet1; somg1 = salp0 * sbet1;
@@ -857,7 +860,7 @@ namespace GeographicLib {
 
     // sig12 = sig2 - sig1, limit to [0, pi]
     sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2),
-                  csig1 * csig2 + ssig1 * ssig2);
+                               csig1 * csig2 + ssig1 * ssig2);
 
     // omg12 = omg2 - omg1, limit to [0, pi]
     somg12 = max(real(0), comg1 * somg2 - somg1 * comg2);
@@ -871,7 +874,8 @@ namespace GeographicLib {
     C3f(eps, Ca);
     B312 = (SinCosSeries(true, ssig2, csig2, Ca, nC3_-1) -
             SinCosSeries(true, ssig1, csig1, Ca, nC3_-1));
-    lam12 = eta - _f * A3f(eps) * salp0 * (sig12 + B312);
+    domg12 = -_f * A3f(eps) * salp0 * (sig12 + B312);
+    lam12 = eta + domg12;
 
     if (diffp) {
       if (calp2 == 0)
diff --git a/src/GeodesicExact.cpp b/src/GeodesicExact.cpp
index 919d077..b5019ab 100644
--- a/src/GeodesicExact.cpp
+++ b/src/GeodesicExact.cpp
@@ -2,7 +2,7 @@
  * \file GeodesicExact.cpp
  * \brief Implementation for GeographicLib::GeodesicExact class
  *
- * Copyright (c) Charles Karney (2012-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2012-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -84,9 +84,9 @@ namespace GeographicLib {
              sqrt( max(real(0.001), abs(_f)) * min(real(1), 1 - _f/2) / 2 ))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_b) && _b > 0))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     C4coeff();
   }
 
@@ -268,7 +268,7 @@ namespace GeographicLib {
 
       // sig12 = sig2 - sig1
       sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2),
-                    csig1 * csig2 + ssig1 * ssig2);
+                                 csig1 * csig2 + ssig1 * ssig2);
       {
         real dummy;
         Lengths(E, sig12, ssig1, csig1, dn1, ssig2, csig2, dn2,
@@ -343,7 +343,7 @@ namespace GeographicLib {
         // guess is taken to be (alp1a + alp1b) / 2.
         //
         // initial values to suppress warnings (if loop is executed 0 times)
-        real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0;
+        real ssig1 = 0, csig1 = 0, ssig2 = 0, csig2 = 0, domg12 = 0;
         unsigned numit = 0;
         // Bracketing range
         real salp1a = tiny_, calp1a = 1, salp1b = tiny_, calp1b = -1;
@@ -375,7 +375,7 @@ namespace GeographicLib {
           real v = Lambda12(sbet1, cbet1, dn1, sbet2, cbet2, dn2, salp1, calp1,
                             slam12, clam12,
                             salp2, calp2, sig12, ssig1, csig1, ssig2, csig2,
-                            E, somg12, comg12, numit < maxit1_, dv);
+                            E, domg12, numit < maxit1_, dv);
           // Reversed test to allow escape with NaNs
           if (tripb || !(abs(v) >= (tripn ? 8 : 1) * tol0_)) break;
           // Update bracketing values
@@ -423,6 +423,12 @@ namespace GeographicLib {
         m12x *= _b;
         s12x *= _b;
         a12 = sig12 / Math::degree();
+        if (outmask & AREA) {
+          // omg12 = lam12 - domg12
+          real sdomg12 = sin(domg12), cdomg12 = cos(domg12);
+          somg12 = slam12 * cdomg12 - clam12 * sdomg12;
+          comg12 = clam12 * cdomg12 + slam12 * sdomg12;
+        }
       }
     }
 
@@ -462,8 +468,7 @@ namespace GeographicLib {
       if (!meridian) {
         if (somg12 > 1) {
           somg12 = sin(omg12); comg12 = cos(omg12);
-        } else
-          Math::norm(somg12, comg12);
+        }
       }
 
       if (!meridian &&
@@ -822,7 +827,7 @@ namespace GeographicLib {
                                      real& ssig1, real& csig1,
                                      real& ssig2, real& csig2,
                                      EllipticFunction& E,
-                                     real& somg12, real& comg12,
+                                     real& domg12,
                                      bool diffp, real& dlam12) const
     {
 
@@ -836,7 +841,7 @@ namespace GeographicLib {
       salp0 = salp1 * cbet1,
       calp0 = Math::hypot(calp1, salp1 * sbet1); // calp0 > 0
 
-    real somg1, comg1, somg2, comg2, cchi1, cchi2, lam12;
+    real somg1, comg1, somg2, comg2, somg12, comg12, cchi1, cchi2, lam12;
     // tan(bet1) = tan(sig1) * cos(alp1)
     // tan(omg1) = sin(alp0) * tan(sig1) = tan(omg1)=tan(alp1)*sin(bet1)
     ssig1 = sbet1; somg1 = salp0 * sbet1;
@@ -874,7 +879,7 @@ namespace GeographicLib {
 
     // sig12 = sig2 - sig1, limit to [0, pi]
     sig12 = atan2(max(real(0), csig1 * ssig2 - ssig1 * csig2),
-                  csig1 * csig2 + ssig1 * ssig2);
+                               csig1 * csig2 + ssig1 * ssig2);
 
     // omg12 = omg2 - omg1, limit to [0, pi]
     somg12 = max(real(0), comg1 * somg2 - somg1 * comg2);
@@ -884,15 +889,16 @@ namespace GeographicLib {
     // chi12 = chi2 - chi1, limit to [0, pi]
     real
       schi12 = max(real(0), cchi1 * somg2 - somg1 * cchi2),
-      cchi12 = cchi1 * cchi2 + somg1 * somg2;
+      cchi12 =              cchi1 * cchi2 + somg1 * somg2;
     // eta = chi12 - lam120
     real eta = atan2(schi12 * clam120 - cchi12 * slam120,
                      cchi12 * clam120 + schi12 * slam120);
-
-    lam12 = eta -
-      _e2/_f1 * salp0 * E.H() / (Math::pi() / 2) *
+    real deta12 = -_e2/_f1 * salp0 * E.H() / (Math::pi() / 2) *
       (sig12 + (E.deltaH(ssig2, csig2, dn2) - E.deltaH(ssig1, csig1, dn1)));
-
+    lam12 = eta + deta12;
+    // domg12 = deta12 + chi12 - omg12
+    domg12 = deta12 + atan2(schi12 * comg12 - cchi12 * somg12,
+                            cchi12 * comg12 + schi12 * somg12);
     if (diffp) {
       if (calp2 == 0)
         dlam12 = - 2 * _f1 * dn1 / sbet1;
diff --git a/src/GeodesicExactC4.cpp b/src/GeodesicExactC4.cpp
index 7978c69..2a6ab9f 100644
--- a/src/GeodesicExactC4.cpp
+++ b/src/GeodesicExactC4.cpp
@@ -2,7 +2,7 @@
  * \file GeodesicExactC4.cpp
  * \brief Implementation for GeographicLib::GeodesicExact::rawC4coeff
  *
- * Copyright (c) Charles Karney (2014-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2014-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -35,92 +35,92 @@ namespace GeographicLib {
       // C4[0], coeff of eps^22, polynomial in n of order 1
       real(0x4f2fa0LL),real(0x13852eLL),real(0xcb8314033LL),
       // C4[0], coeff of eps^21, polynomial in n of order 2
-      real(0x1285360LL),real(-0x92a110LL),real(0x6d084fLL),
+      real(0x1285360LL),-real(0x92a110LL),real(0x6d084fLL),
       real(0x147638f7f9LL),
       // C4[0], coeff of eps^20, polynomial in n of order 3
-      real(0x33fcdea140LL),real(-0x21fe753a80LL),real(0x10cd7f3dc0LL),
+      real(0x33fcdea140LL),-real(0x21fe753a80LL),real(0x10cd7f3dc0LL),
       real(0x421366044LL),real(0x205dc0bcbd6d7LL),
       // C4[0], coeff of eps^19, polynomial in n of order 4
-      real(0x4114538e4c0LL),real(-0x2f55bac3db0LL),real(0x1ee26e63c60LL),
-      real(-0xf3f108c690LL),real(0xb50b862ee7LL),real(0x19244124e56e27LL),
+      real(0x4114538e4c0LL),-real(0x2f55bac3db0LL),real(0x1ee26e63c60LL),
+      -real(0xf3f108c690LL),real(0xb50b862ee7LL),real(0x19244124e56e27LL),
       // C4[0], coeff of eps^18, polynomial in n of order 5
-      real(0x303f35e1bc93a0LL),real(-0x24e1f056b1d580LL),
-      real(0x1ab9fe0d1d4d60LL),real(-0x1164c583e996c0LL),
+      real(0x303f35e1bc93a0LL),-real(0x24e1f056b1d580LL),
+      real(0x1ab9fe0d1d4d60LL),-real(0x1164c583e996c0LL),
       real(0x892da1e80cb20LL),real(0x2194519fdb596LL),
       reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^17, polynomial in n of order 6
-      real(0x4aad22c875ed20LL),real(-0x3a4801a1c6bad0LL),
-      real(0x2c487fb318d4c0LL),real(-0x1ff24d7cfd75b0LL),
-      real(0x14ba39245f1460LL),real(-0xa32e190328e90LL),
+      real(0x4aad22c875ed20LL),-real(0x3a4801a1c6bad0LL),
+      real(0x2c487fb318d4c0LL),-real(0x1ff24d7cfd75b0LL),
+      real(0x14ba39245f1460LL),-real(0xa32e190328e90LL),
       real(0x78c93074dfcffLL),reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^16, polynomial in n of order 7
-      real(0x33d84b92096e100LL),real(-0x286d35d824ffe00LL),
-      real(0x1f3d33e2e951300LL),real(-0x178f58435181400LL),
-      real(0x10e7992a3756500LL),real(-0xaed7fa8609aa00LL),
+      real(0x33d84b92096e100LL),-real(0x286d35d824ffe00LL),
+      real(0x1f3d33e2e951300LL),-real(0x178f58435181400LL),
+      real(0x10e7992a3756500LL),-real(0xaed7fa8609aa00LL),
       real(0x55d8ac87b09700LL),real(0x14e51e43945a10LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^15, polynomial in n of order 8
-      real(0x577cdb6aaee0d80LL),real(-0x4283c1e96325470LL),
-      real(0x32feef20b794020LL),real(-0x26ea2e388de1a50LL),
-      real(0x1d13f6131e5d6c0LL),real(-0x14b9aa66e270230LL),
-      real(0xd5657196ac0560LL),real(-0x6880b0118a9810LL),
+      real(0x577cdb6aaee0d80LL),-real(0x4283c1e96325470LL),
+      real(0x32feef20b794020LL),-real(0x26ea2e388de1a50LL),
+      real(0x1d13f6131e5d6c0LL),-real(0x14b9aa66e270230LL),
+      real(0xd5657196ac0560LL),-real(0x6880b0118a9810LL),
       real(0x4d0f1755168ee7LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^14, polynomial in n of order 9
-      real(0xa82410caed14920LL),real(-0x774e0539d2de300LL),
-      real(0x57ddc01c62bc8e0LL),real(-0x41de50dfff43e40LL),
-      real(0x31742450a1bdca0LL),real(-0x248524531975180LL),
-      real(0x19d013c6e35ec60LL),real(-0x1084c003a0434c0LL),
+      real(0xa82410caed14920LL),-real(0x774e0539d2de300LL),
+      real(0x57ddc01c62bc8e0LL),-real(0x41de50dfff43e40LL),
+      real(0x31742450a1bdca0LL),-real(0x248524531975180LL),
+      real(0x19d013c6e35ec60LL),-real(0x1084c003a0434c0LL),
       real(0x8103758ad86020LL),real(0x1f2409edf5e286LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^13, polynomial in n of order 10
-      real(0x1c6d2d6120015ca0LL),real(-0x104cedef383403b0LL),
-      real(0xab9dd58c3e3d880LL),real(-0x78a4e83e5604750LL),
-      real(0x57aa7cf5406e460LL),real(-0x4067a93ceeb2cf0LL),
-      real(0x2ed62190d975c40LL),real(-0x20c076adcb21890LL),
-      real(0x14cfa9cb9e01c20LL),real(-0xa1e25734956e30LL),
+      real(0x1c6d2d6120015ca0LL),-real(0x104cedef383403b0LL),
+      real(0xab9dd58c3e3d880LL),-real(0x78a4e83e5604750LL),
+      real(0x57aa7cf5406e460LL),-real(0x4067a93ceeb2cf0LL),
+      real(0x2ed62190d975c40LL),-real(0x20c076adcb21890LL),
+      real(0x14cfa9cb9e01c20LL),-real(0xa1e25734956e30LL),
       real(0x76afbfe4ae6c4dLL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^12, polynomial in n of order 11
-      real(0x500e39e18e75c40LL),real(-0xb866fe4aaa63680LL),
-      real(0x4337db32e526ac0LL),real(-0x264cce8c21af200LL),
-      real(0x18fb7ba247a4140LL),real(-0x115709558576d80LL),
-      real(0xc5be96cd3dcfc0LL),real(-0x8cdca1395db900LL),
-      real(0x611fe1a7e00640LL),real(-0x3d26e46827e480LL),
+      real(0x500e39e18e75c40LL),-real(0xb866fe4aaa63680LL),
+      real(0x4337db32e526ac0LL),-real(0x264cce8c21af200LL),
+      real(0x18fb7ba247a4140LL),-real(0x115709558576d80LL),
+      real(0xc5be96cd3dcfc0LL),-real(0x8cdca1395db900LL),
+      real(0x611fe1a7e00640LL),-real(0x3d26e46827e480LL),
       real(0x1d93970a8fd4c0LL),real(0x70bf87cc17354LL),
       reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^11, polynomial in n of order 12
-      real(-0x158a522ca96a9f40LL),real(0x14d4e49882e048f0LL),
-      real(0x51a6258bc6026a0LL),real(-0xc07af3677bdc6b0LL),
-      real(0x45ac09bc3b66080LL),real(-0x275e4ef59a8b450LL),
-      real(0x195f928e5402a60LL),real(-0x114aa7eeb31a3f0LL),
-      real(0xbf706c784da040LL),real(-0x817ec7d97ab990LL),
-      real(0x508b8ca80cde20LL),real(-0x26b120ea091930LL),
+      -real(0x158a522ca96a9f40LL),real(0x14d4e49882e048f0LL),
+      real(0x51a6258bc6026a0LL),-real(0xc07af3677bdc6b0LL),
+      real(0x45ac09bc3b66080LL),-real(0x275e4ef59a8b450LL),
+      real(0x195f928e5402a60LL),-real(0x114aa7eeb31a3f0LL),
+      real(0xbf706c784da040LL),-real(0x817ec7d97ab990LL),
+      real(0x508b8ca80cde20LL),-real(0x26b120ea091930LL),
       real(0x1c1ab3faf18ecdLL),reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^10, polynomial in n of order 13
       real(0x85cd94c7a43620LL),real(0x41534458719f180LL),
-      real(-0x1688b497e3eabf20LL),real(0x15fa3ad6bcd8bd40LL),
-      real(0x531c27984875fa0LL),real(-0xc9b33381ee39f00LL),
-      real(0x485a2b8a7ad1a60LL),real(-0x286be979df41b40LL),
-      real(0x199b6e19072f920LL),real(-0x10f769bc7a1af80LL),
-      real(0xb2b30e0b2b83e0LL),real(-0x6d4c30bc0953c0LL),
+      -real(0x1688b497e3eabf20LL),real(0x15fa3ad6bcd8bd40LL),
+      real(0x531c27984875fa0LL),-real(0xc9b33381ee39f00LL),
+      real(0x485a2b8a7ad1a60LL),-real(0x286be979df41b40LL),
+      real(0x199b6e19072f920LL),-real(0x10f769bc7a1af80LL),
+      real(0xb2b30e0b2b83e0LL),-real(0x6d4c30bc0953c0LL),
       real(0x3405b9397b42a0LL),real(0xc1ffd0ada51beLL),
       reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^9, polynomial in n of order 14
       real(0x77c3b2fb788360LL),real(0x12370e8b6ebba50LL),
       real(0x3ce89570a2d35c0LL),real(0x1ddd463aa5801f30LL),
       reale(-2653LL,0xf49e89f0f6020LL),reale(2613LL,0x24df88b461210LL),
-      real(0x24dea39341926e80LL),real(-0x5ce704fae2f44110LL),
-      real(0x20ecef343dc3cce0LL),real(-0x121947a4ab4bae30LL),
-      real(0xb2a76f84c78e740LL),real(-0x70dd3a5c9a20950LL),
-      real(0x43604f2667d29a0LL),real(-0x1fa7f2abdd82670LL),
+      real(0x24dea39341926e80LL),-real(0x5ce704fae2f44110LL),
+      real(0x20ecef343dc3cce0LL),-real(0x121947a4ab4bae30LL),
+      real(0xb2a76f84c78e740LL),-real(0x70dd3a5c9a20950LL),
+      real(0x43604f2667d29a0LL),-real(0x1fa7f2abdd82670LL),
       real(0x169d55eb03244c1LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^8, polynomial in n of order 15
       real(0x21331eec152c80LL),real(0x3c94fa87392d00LL),
       real(0x7bff534019c580LL),real(0x12eee208e5fe200LL),
       real(0x3f965ae4945ee80LL),real(0x1f56cb06e4e85700LL),
       reale(-2803LL,0xffb9171e60780LL),reale(2796LL,0xadb20bd4ec00LL),
-      real(0x251d0efe774e7080LL),real(-0x625b74d58e27ff00LL),
-      real(0x224674d7e8ab8980LL),real(-0x1260f3bdc69c0a00LL),
-      real(0xad7256a98d1b280LL),real(-0x63bd65ce944d500LL),
+      real(0x251d0efe774e7080LL),-real(0x625b74d58e27ff00LL),
+      real(0x224674d7e8ab8980LL),-real(0x1260f3bdc69c0a00LL),
+      real(0xad7256a98d1b280LL),-real(0x63bd65ce944d500LL),
       real(0x2df89c0cd0d4b80LL),real(0xa46618fc50ff08LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^7, polynomial in n of order 16
@@ -129,9 +129,9 @@ namespace GeographicLib {
       real(0x80a310c4f84640LL),real(0x13bcb7c20d40bd0LL),
       real(0x42a5540b0e391e0LL),real(0x210e40977bd376f0LL),
       reale(-2981LL,0x6b26210e33980LL),reale(3022LL,0x503caf61c4810LL),
-      real(0x24d397da2b859120LL),real(-0x68d822cc2f04ecd0LL),
-      real(0x23a043b28810ecc0LL),real(-0x125159fafe6e93b0LL),
-      real(0x9e1bc8a31f5a060LL),real(-0x46aed7b45d01890LL),
+      real(0x24d397da2b859120LL),-real(0x68d822cc2f04ecd0LL),
+      real(0x23a043b28810ecc0LL),-real(0x125159fafe6e93b0LL),
+      real(0x9e1bc8a31f5a060LL),-real(0x46aed7b45d01890LL),
       real(0x30c71f0f146542fLL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^6, polynomial in n of order 17
       real(0x5c9c64c833ea0LL),real(0x87cba49bc6200LL),real(0xcee016a8ff560LL),
@@ -140,18 +140,18 @@ namespace GeographicLib {
       real(0x14a4159e5b98140LL),real(0x462d226dee7d1a0LL),
       real(0x2316888f6f2f3100LL),reale(-3199LL,0xcb6e58663c860LL),
       reale(3311LL,0xbf8f265e6c0c0LL),real(0x2372de10575f2320LL),
-      real(-0x70af5543c56e4780LL),real(0x24bbd6e6395ee9e0LL),
-      real(-0x116009bab4325fc0LL),real(0x75b7dfa9c5a24a0LL),
+      -real(0x70af5543c56e4780LL),real(0x24bbd6e6395ee9e0LL),
+      -real(0x116009bab4325fc0LL),real(0x75b7dfa9c5a24a0LL),
       real(0x17de90e4beab49eLL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^5, polynomial in n of order 18
       real(0x6a525328e6e0LL),real(0x93f17033fb30LL),real(0xd36a04706f00LL),
       real(0x137db4aaadad0LL),real(0x1de17febed720LL),real(0x300ece09a4c70LL),
       real(0x5230537724340LL),real(0x98911a7bab410LL),real(0x13df6f0042d760LL),
       real(0x317f809c6f75b0LL),real(0xa9d28ba9acb780LL),
-      real(0x55d121ad9d8f550LL),real(-0x1efee1555125f860LL),
+      real(0x55d121ad9d8f550LL),-real(0x1efee1555125f860LL),
       real(0x21073529064696f0LL),real(0x486394f46ccebc0LL),
-      real(-0x11777145e6374170LL),real(0x54159fc268987e0LL),
-      real(-0x1fa4dd5835d2fd0LL),real(0x13d87fc86cca643LL),
+      -real(0x11777145e6374170LL),real(0x54159fc268987e0LL),
+      -real(0x1fa4dd5835d2fd0LL),real(0x13d87fc86cca643LL),
       reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^4, polynomial in n of order 19
       real(0x3804d31f10c0LL),real(0x4b2ec20ad280LL),real(0x66f0ea418040LL),
@@ -159,9 +159,9 @@ namespace GeographicLib {
       real(0x1dd70e331b740LL),real(0x306dd8a084700LL),real(0x53a0a0b201ec0LL),
       real(0x9cd7c33c89880LL),real(0x14a7b599a9ce40LL),
       real(0x340e256f2c5a00LL),real(0xb4e7d2cf7515c0LL),
-      real(0x5cc8e678862db80LL),real(-0x22304c48df63bac0LL),
+      real(0x5cc8e678862db80LL),-real(0x22304c48df63bac0LL),
       real(0x25f7d3a888bb6d00LL),real(0x3210c8a6905acc0LL),
-      real(-0x131873ea3222a180LL),real(0x4a33217f63b9c40LL),
+      -real(0x131873ea3222a180LL),real(0x4a33217f63b9c40LL),
       real(0xaa39109cb79b1cLL),reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^3, polynomial in n of order 20
       real(0x1d8a60744340LL),real(0x26a12f47d0f0LL),real(0x3353c9ffe420LL),
@@ -170,8 +170,8 @@ namespace GeographicLib {
       real(0x2fb033b96ea70LL),real(0x5384f3e45a7a0LL),real(0x9f10eb531c1d0LL),
       real(0x154d17c994d480LL),real(0x36ab828088cb30LL),
       real(0xc1d47f99841160LL),real(0x65b5717bb21c290LL),
-      real(-0x269fd1ef6edfa5c0LL),real(0x2dc2d3f3f9f963f0LL),
-      real(-0xf46c321c1b54e0LL),real(-0x14642b52c5fe94b0LL),
+      -real(0x269fd1ef6edfa5c0LL),real(0x2dc2d3f3f9f963f0LL),
+      -real(0xf46c321c1b54e0LL),-real(0x14642b52c5fe94b0LL),
       real(0x6b46a122c3b5c05LL),reale(3071LL,0xfdd7cc41833d5LL),
       // C4[0], coeff of eps^2, polynomial in n of order 21
       real(0x65e46db33460LL),real(0x82b39a7b3380LL),real(0xa9e8c6cf36a0LL),
@@ -182,7 +182,7 @@ namespace GeographicLib {
       real(0x95133a4d60b820LL),real(0x18b02de0f4e4040LL),
       real(0x5ac287501571660LL),real(0x31a5fa2db58d3d80LL),
       reale(-5088LL,0xf42d1707298a0LL),reale(6752LL,0x2ce8487308ac0LL),
-      reale(-2185LL,0x790024cbb96e0LL),real(-0x199994ff919cd3b6LL),
+      reale(-2185LL,0x790024cbb96e0LL),-real(0x199994ff919cd3b6LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[0], coeff of eps^1, polynomial in n of order 22
       real(0xd0da1980ba0LL),real(0x10803fb20d70LL),real(0x151a70ced0c0LL),
@@ -193,7 +193,7 @@ namespace GeographicLib {
       real(0x128a302f4ef3d0LL),real(0x2b2226f5e6b4a0LL),
       real(0x7a36190e0daa70LL),real(0x1e8d8643836a9c0LL),
       real(0x129e3dd12414f710LL),reale(-2185LL,0x790024cbb96e0LL),
-      reale(3276LL,0xca7fc8ce69db0LL),real(-0x5999897e7da4e4fdLL),
+      reale(3276LL,0xca7fc8ce69db0LL),-real(0x5999897e7da4e4fdLL),
       reale(7167LL,0xfaf78743878f1LL),
       // C4[0], coeff of eps^0, polynomial in n of order 23
       real(0x71a68037fdf14LL),real(0x81ebac5d53b48LL),real(0x957440e8ac5fcLL),
@@ -211,172 +211,172 @@ namespace GeographicLib {
       // C4[1], coeff of eps^23, polynomial in n of order 0
       real(3401LL),real(0x1e8bbfc3LL),
       // C4[1], coeff of eps^22, polynomial in n of order 1
-      real(-0x539b40LL),real(0x3a8f8aLL),real(0x262893c099LL),
+      -real(0x539b40LL),real(0x3a8f8aLL),real(0x262893c099LL),
       // C4[1], coeff of eps^21, polynomial in n of order 2
-      real(-0x4ca72060LL),real(0x220f8a90LL),real(0x87f8721LL),
+      -real(0x4ca72060LL),real(0x220f8a90LL),real(0x87f8721LL),
       real(0xef8343fb2e1LL),
       // C4[1], coeff of eps^20, polynomial in n of order 3
-      real(-0x3769db6980LL),real(0x203de5a900LL),real(-0x11f0163080LL),
+      -real(0x3769db6980LL),real(0x203de5a900LL),-real(0x11f0163080LL),
       real(0xc63a320ccLL),real(0x6119423638485LL),
       // C4[1], coeff of eps^19, polynomial in n of order 4
-      real(-0x2066cb6031fc0LL),real(0x14c85e7394470LL),real(-0xf6b8f35571e0LL),
+      -real(0x2066cb6031fc0LL),real(0x14c85e7394470LL),-real(0xf6b8f35571e0LL),
       real(0x6ad3f08040d0LL),real(0x1aa3b2832565LL),real(0x230f8ed873f29c63LL),
       // C4[1], coeff of eps^18, polynomial in n of order 5
-      real(-0x33e9644cad5b40LL),real(0x22b6849ca6a500LL),
-      real(-0x1ce364ad2a4ec0LL),real(0x104aaed8cf4680LL),
-      real(-0x949f0f8a89e40LL),real(0x64bcf4df920c2LL),
+      -real(0x33e9644cad5b40LL),real(0x22b6849ca6a500LL),
+      -real(0x1ce364ad2a4ec0LL),real(0x104aaed8cf4680LL),
+      -real(0x949f0f8a89e40LL),real(0x64bcf4df920c2LL),
       reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^17, polynomial in n of order 6
-      real(-0x50a85b2e2e4060LL),real(0x36bb9aa442c6f0LL),
-      real(-0x3029aafbbe0440LL),real(0x1dc29c0bd6ce90LL),
-      real(-0x16a422844d9020LL),real(0x9763b8d8ca030LL),
+      -real(0x50a85b2e2e4060LL),real(0x36bb9aa442c6f0LL),
+      -real(0x3029aafbbe0440LL),real(0x1dc29c0bd6ce90LL),
+      -real(0x16a422844d9020LL),real(0x9763b8d8ca030LL),
       real(0x25b8d7edff7ebLL),reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^16, polynomial in n of order 7
-      real(-0x3822c174e5c7e00LL),real(0x25fbaf973d78c00LL),
-      real(-0x222a860fbdb7a00LL),real(0x15dabd7a0984800LL),
-      real(-0x129f00215535600LL),real(0xa0e9e0ae9b8400LL),
-      real(-0x5ee97a6d2d5200LL),real(0x3eaf5acabd0e30LL),
+      -real(0x3822c174e5c7e00LL),real(0x25fbaf973d78c00LL),
+      -real(0x222a860fbdb7a00LL),real(0x15dabd7a0984800LL),
+      -real(0x129f00215535600LL),real(0xa0e9e0ae9b8400LL),
+      -real(0x5ee97a6d2d5200LL),real(0x3eaf5acabd0e30LL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^15, polynomial in n of order 8
-      real(-0x5ec1dcd7666b480LL),real(0x3ed4935a3fd8cd0LL),
-      real(-0x38014f5e5d79960LL),real(0x240af6a53256570LL),
-      real(-0x2049d0fb0404a40LL),real(0x12efbc065d3f410LL),
-      real(-0xee9d804d5d8320LL),real(0x5ed209adebbcb0LL),
+      -real(0x5ec1dcd7666b480LL),real(0x3ed4935a3fd8cd0LL),
+      -real(0x38014f5e5d79960LL),real(0x240af6a53256570LL),
+      -real(0x2049d0fb0404a40LL),real(0x12efbc065d3f410LL),
+      -real(0xee9d804d5d8320LL),real(0x5ed209adebbcb0LL),
       real(0x1798ea7fdd6773LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^14, polynomial in n of order 9
-      real(-0x19f69929deb8bc0LL),real(0x1054723730b1600LL),
-      real(-0xdce6aeb616e040LL),real(0x8c0069813d6480LL),
-      real(-0x7e59f70027c8c0LL),real(0x4bea01551feb00LL),
-      real(-0x42bb28790cad40LL),real(0x21dd61f97d4180LL),
-      real(-0x14f93d4343f5c0LL),real(0xd58968a8df35eLL),
+      -real(0x19f69929deb8bc0LL),real(0x1054723730b1600LL),
+      -real(0xdce6aeb616e040LL),real(0x8c0069813d6480LL),
+      -real(0x7e59f70027c8c0LL),real(0x4bea01551feb00LL),
+      -real(0x42bb28790cad40LL),real(0x21dd61f97d4180LL),
+      -real(0x14f93d4343f5c0LL),real(0xd58968a8df35eLL),
       reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^13, polynomial in n of order 10
-      real(-0x1ecd4a3794400de0LL),real(0x101df33ec1bb0110LL),
-      real(-0xbc64ec7794b2980LL),real(0x71d5f4e2a637ff0LL),
-      real(-0x625888ecafc7520LL),real(0x3aa6879742ff4d0LL),
-      real(-0x3585f7f60d164c0LL),real(0x1d18174ef21abb0LL),
-      real(-0x18117eb39416c60LL),real(0x8df7a42ab2f090LL),
+      -real(0x1ecd4a3794400de0LL),real(0x101df33ec1bb0110LL),
+      -real(0xbc64ec7794b2980LL),real(0x71d5f4e2a637ff0LL),
+      -real(0x625888ecafc7520LL),real(0x3aa6879742ff4d0LL),
+      -real(0x3585f7f60d164c0LL),real(0x1d18174ef21abb0LL),
+      -real(0x18117eb39416c60LL),real(0x8df7a42ab2f090LL),
       real(0x23413de9276581LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^12, polynomial in n of order 11
-      real(-0x113775cb09582880LL),real(0x5790112bb17c4700LL),
-      real(-0x204e01ed2b929d80LL),real(0x1063af9e8d99cc00LL),
-      real(-0xc3ef805036ada80LL),real(0x701a56aa2d31100LL),
-      real(-0x63910631abdcf80LL),real(0x368e0c562512600LL),
-      real(-0x31ed34307286c80LL),real(0x170e89cb9dd1b00LL),
-      real(-0xf5f0efdd07a180LL),real(0x93fb623bde75e4LL),
+      -real(0x113775cb09582880LL),real(0x5790112bb17c4700LL),
+      -real(0x204e01ed2b929d80LL),real(0x1063af9e8d99cc00LL),
+      -real(0xc3ef805036ada80LL),real(0x701a56aa2d31100LL),
+      -real(0x63910631abdcf80LL),real(0x368e0c562512600LL),
+      -real(0x31ed34307286c80LL),real(0x170e89cb9dd1b00LL),
+      -real(0xf5f0efdd07a180LL),real(0x93fb623bde75e4LL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^11, polynomial in n of order 12
-      real(0x13635f7860ae69c0LL),real(-0x169d904d9d4691d0LL),
-      real(-0x2254277308cd9e0LL),real(0xd20446e8d8a9710LL),
-      real(-0x4df2aedeefd1980LL),real(0x25e2aff2baec9f0LL),
-      real(-0x1d3856fa2b08920LL),real(0xf7cadc640f92d0LL),
-      real(-0xe3d2f6c9ad5cc0LL),real(0x6e412eaf297db0LL),
-      real(-0x62000ef613c860LL),real(0x201266fb021690LL),
+      real(0x13635f7860ae69c0LL),-real(0x169d904d9d4691d0LL),
+      -real(0x2254277308cd9e0LL),real(0xd20446e8d8a9710LL),
+      -real(0x4df2aedeefd1980LL),real(0x25e2aff2baec9f0LL),
+      -real(0x1d3856fa2b08920LL),real(0xf7cadc640f92d0LL),
+      -real(0xe3d2f6c9ad5cc0LL),real(0x6e412eaf297db0LL),
+      -real(0x62000ef613c860LL),real(0x201266fb021690LL),
       real(0x7ee4c480c21e1LL),reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^10, polynomial in n of order 13
-      real(-0x5fe482817c4c40LL),real(-0x3373730b4b79d00LL),
-      real(0x140f919171472640LL),real(-0x17f10e5417ef9980LL),
-      real(-0x1b454cf244cf340LL),real(0xdd42319af5c0200LL),
-      real(-0x530205145e450c0LL),real(0x25eec00584a7d80LL),
-      real(-0x1e9e562555aaa40LL),real(0xe85806d73b2100LL),
-      real(-0xde44387c5bb7c0LL),real(0x581f06023d3480LL),
-      real(-0x421ccd71c33140LL),real(0x245ff7208ef53aLL),
+      -real(0x5fe482817c4c40LL),-real(0x3373730b4b79d00LL),
+      real(0x140f919171472640LL),-real(0x17f10e5417ef9980LL),
+      -real(0x1b454cf244cf340LL),real(0xdd42319af5c0200LL),
+      -real(0x530205145e450c0LL),real(0x25eec00584a7d80LL),
+      -real(0x1e9e562555aaa40LL),real(0xe85806d73b2100LL),
+      -real(0xde44387c5bb7c0LL),real(0x581f06023d3480LL),
+      -real(0x421ccd71c33140LL),real(0x245ff7208ef53aLL),
       reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^9, polynomial in n of order 14
-      real(-0x47f3709eaa4320LL),real(-0xbb640bc2e1ae70LL),
-      real(-0x2a7854a3ead7b40LL),real(-0x1701de8d91314210LL),
+      -real(0x47f3709eaa4320LL),-real(0xbb640bc2e1ae70LL),
+      -real(0x2a7854a3ead7b40LL),-real(0x1701de8d91314210LL),
       reale(2329LL,0x5f8472b9624a0LL),reale(-2856LL,0x183ee7d78d050LL),
-      real(-0x785bf95be998780LL),real(0x66690260b30024b0LL),
-      real(-0x272595745774a3a0LL),real(0x104f772bee315710LL),
-      real(-0xe11ad02f34b53c0LL),real(0x5a192e055800370LL),
-      real(-0x58d8bfb781fbbe0LL),real(0x17a156426e4c5d0LL),
+      -real(0x785bf95be998780LL),real(0x66690260b30024b0LL),
+      -real(0x272595745774a3a0LL),real(0x104f772bee315710LL),
+      -real(0xe11ad02f34b53c0LL),real(0x5a192e055800370LL),
+      -real(0x58d8bfb781fbbe0LL),real(0x17a156426e4c5d0LL),
       real(0x5c88907e67c575LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^8, polynomial in n of order 15
-      real(-0x1138d3e7324700LL),real(-0x210a1008a4f200LL),
-      real(-0x47b7d2285e8500LL),real(-0xbbe3dba17a1400LL),
-      real(-0x2aeb63e9e4cb300LL),real(-0x1781d8a9c80b7600LL),
+      -real(0x1138d3e7324700LL),-real(0x210a1008a4f200LL),
+      -real(0x47b7d2285e8500LL),-real(0xbbe3dba17a1400LL),
+      -real(0x2aeb63e9e4cb300LL),-real(0x1781d8a9c80b7600LL),
       reale(2419LL,0xe4212c9be8f00LL),reale(-3064LL,0x283dcf5264800LL),
-      real(-0x116171a56015f00LL),real(0x6cc31b4079da8600LL),
-      real(-0x2af22cc657d11d00LL),real(0xf75e4ec12d0a400LL),
-      real(-0xeb60cc0dd754b00LL),real(0x472a49a74880200LL),
-      real(-0x4174f343c328900LL),real(0x1ed324af4f2fd18LL),
+      -real(0x116171a56015f00LL),real(0x6cc31b4079da8600LL),
+      -real(0x2af22cc657d11d00LL),real(0xf75e4ec12d0a400LL),
+      -real(0xeb60cc0dd754b00LL),real(0x472a49a74880200LL),
+      -real(0x4174f343c328900LL),real(0x1ed324af4f2fd18LL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^7, polynomial in n of order 16
-      real(-0xd56426d4f700LL),real(-0x15fa65017d450LL),
-      real(-0x26ba18ad11e20LL),real(-0x4a9605f1a58f0LL),
-      real(-0xa2b494aee2940LL),real(-0x1ad07f38fd2390LL),
-      real(-0x62deb836d71c60LL),real(-0x36d68c47bf27830LL),
-      real(0x167d3fa4abc50480LL),real(-0x1d9b2fd161b99ad0LL),
+      -real(0xd56426d4f700LL),-real(0x15fa65017d450LL),
+      -real(0x26ba18ad11e20LL),-real(0x4a9605f1a58f0LL),
+      -real(0xa2b494aee2940LL),-real(0x1ad07f38fd2390LL),
+      -real(0x62deb836d71c60LL),-real(0x36d68c47bf27830LL),
+      real(0x167d3fa4abc50480LL),-real(0x1d9b2fd161b99ad0LL),
       real(0x13a59aea9293560LL),real(0x10886ca52ccf3090LL),
-      real(-0x6e8a4c27dbf8dc0LL),real(0x1f02cd8f1f8a5f0LL),
-      real(-0x2216230a1ac48e0LL),real(0x5f13c815b08150LL),
+      -real(0x6e8a4c27dbf8dc0LL),real(0x1f02cd8f1f8a5f0LL),
+      -real(0x2216230a1ac48e0LL),real(0x5f13c815b08150LL),
       real(0x1666b06ca8f56dLL),reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^6, polynomial in n of order 17
-      real(-0x2678d0ed9f140LL),real(-0x39d0dbe263c00LL),
-      real(-0x5aa623a5216c0LL),real(-0x95d2f30c44880LL),
-      real(-0x108ea4db631840LL),real(-0x2005d27e0acd00LL),
-      real(-0x463ad5e0e22dc0LL),real(-0xba80ab02c40180LL),
-      real(-0x2b67c47d5d48f40LL),real(-0x186d6a49f7da1e00LL),
+      -real(0x2678d0ed9f140LL),-real(0x39d0dbe263c00LL),
+      -real(0x5aa623a5216c0LL),-real(0x95d2f30c44880LL),
+      -real(0x108ea4db631840LL),-real(0x2005d27e0acd00LL),
+      -real(0x463ad5e0e22dc0LL),-real(0xba80ab02c40180LL),
+      -real(0x2b67c47d5d48f40LL),-real(0x186d6a49f7da1e00LL),
       reale(2625LL,0x9832921f08b40LL),reale(-3628LL,0xf58d11b98a580LL),
       real(0x17be252bac67e9c0LL),real(0x7a8f5366d9ba1100LL),
-      real(-0x38a15d77b043abc0LL),real(0x9cd4e0bf35fec80LL),
-      real(-0xceae5004f176d40LL),real(0x479bb2ae3c01ddaLL),
+      -real(0x38a15d77b043abc0LL),real(0x9cd4e0bf35fec80LL),
+      -real(0xceae5004f176d40LL),real(0x479bb2ae3c01ddaLL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^5, polynomial in n of order 18
-      real(-0x11dc9e54dea60LL),real(-0x193ec5647cdf0LL),
-      real(-0x24bda460ceb00LL),real(-0x3760182d9a010LL),
-      real(-0x5717ea0e54ba0LL),real(-0x907095ecddc30LL),
-      real(-0x10063188dee040LL),real(-0x1f228e862f9650LL),
-      real(-0x44adcde9a37ce0LL),real(-0xb7cbf8f2d0e270LL),
-      real(-0x2b3f803c770f580LL),real(-0x18c05d008644d490LL),
+      -real(0x11dc9e54dea60LL),-real(0x193ec5647cdf0LL),
+      -real(0x24bda460ceb00LL),-real(0x3760182d9a010LL),
+      -real(0x5717ea0e54ba0LL),-real(0x907095ecddc30LL),
+      -real(0x10063188dee040LL),-real(0x1f228e862f9650LL),
+      -real(0x44adcde9a37ce0LL),-real(0xb7cbf8f2d0e270LL),
+      -real(0x2b3f803c770f580LL),-real(0x18c05d008644d490LL),
       reale(2737LL,0x3ce4b1d74e1e0LL),reale(-4018LL,0x2086131467f50LL),
       real(0x30ac41edd5123540LL),real(0x7e3ade121a8e0530LL),
-      real(-0x45ec5d28a0fecf60LL),real(0x3577aaf625fa910LL),
+      -real(0x45ec5d28a0fecf60LL),real(0x3577aaf625fa910LL),
       real(0x7292b77d2ccfc9LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^4, polynomial in n of order 19
-      real(-0x14469ef39280LL),real(-0x1b74a6d65900LL),real(-0x25fc6724f380LL),
-      real(-0x35e25bf6c800LL),real(-0x4eb76c6a3c80LL),real(-0x771a92ddb700LL),
-      real(-0xbc1644489d80LL),real(-0x13946cde25600LL),
-      real(-0x22eaf36054680LL),real(-0x44349dbbbd500LL),
-      real(-0x976a625a56780LL),real(-0x1989ef99e16400LL),
-      real(-0x6150e2c16e3080LL),real(-0x38c68feccea3300LL),
-      real(0x1963a1a8e71b2e80LL),real(-0x2849f713f5ed7200LL),
+      -real(0x14469ef39280LL),-real(0x1b74a6d65900LL),-real(0x25fc6724f380LL),
+      -real(0x35e25bf6c800LL),-real(0x4eb76c6a3c80LL),-real(0x771a92ddb700LL),
+      -real(0xbc1644489d80LL),-real(0x13946cde25600LL),
+      -real(0x22eaf36054680LL),-real(0x44349dbbbd500LL),
+      -real(0x976a625a56780LL),-real(0x1989ef99e16400LL),
+      -real(0x6150e2c16e3080LL),-real(0x38c68feccea3300LL),
+      real(0x1963a1a8e71b2e80LL),-real(0x2849f713f5ed7200LL),
       real(0xd30bac57bb18580LL),real(0x105e1a36741daf00LL),
-      real(-0xc8c696e03b05b80LL),real(0x1feab31d626d154LL),
+      -real(0xc8c696e03b05b80LL),real(0x1feab31d626d154LL),
       reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^3, polynomial in n of order 20
-      real(-0xa4172dfa1c0LL),real(-0xd77fb109ed0LL),real(-0x11fc3eda7860LL),
-      real(-0x1879b9235cf0LL),real(-0x2209eb95db00LL),real(-0x308bcfa5f110LL),
-      real(-0x47510fa29da0LL),real(-0x6c88ffcf6f30LL),real(-0xac6dd3019440LL),
-      real(-0x120fcca63eb50LL),real(-0x206b8121592e0LL),
-      real(-0x3fc3a9ace7970LL),real(-0x8ea4f3b556d80LL),
-      real(-0x18488ccc5b2d90LL),real(-0x5db9d9787df820LL),
-      real(-0x37d6c7544511bb0LL),real(0x1a02f9f8abfbf940LL),
-      real(-0x2d9fe91163ac57d0LL),real(0x18b01234447992a0LL),
-      real(0x46ed1c414c80a10LL),real(-0x57c56c90ceabfa7LL),
+      -real(0xa4172dfa1c0LL),-real(0xd77fb109ed0LL),-real(0x11fc3eda7860LL),
+      -real(0x1879b9235cf0LL),-real(0x2209eb95db00LL),-real(0x308bcfa5f110LL),
+      -real(0x47510fa29da0LL),-real(0x6c88ffcf6f30LL),-real(0xac6dd3019440LL),
+      -real(0x120fcca63eb50LL),-real(0x206b8121592e0LL),
+      -real(0x3fc3a9ace7970LL),-real(0x8ea4f3b556d80LL),
+      -real(0x18488ccc5b2d90LL),-real(0x5db9d9787df820LL),
+      -real(0x37d6c7544511bb0LL),real(0x1a02f9f8abfbf940LL),
+      -real(0x2d9fe91163ac57d0LL),real(0x18b01234447992a0LL),
+      real(0x46ed1c414c80a10LL),-real(0x57c56c90ceabfa7LL),
       reale(9215LL,0xf98764c489b7fLL),
       // C4[1], coeff of eps^2, polynomial in n of order 21
-      real(-0x2271f7278cc0LL),real(-0x2c3f5c6ec900LL),real(-0x399dc5a18140LL),
-      real(-0x4c2bebb96280LL),real(-0x6670101499c0LL),real(-0x8c75450f5400LL),
-      real(-0xc4e9f8733e40LL),real(-0x11b3ff75a0580LL),
-      real(-0x1a3e7cf3fd6c0LL),real(-0x2853a9e02df00LL),
-      real(-0x40b8bca6ccb40LL),real(-0x6da2a9d234880LL),
-      real(-0xc6fc7477c83c0LL),real(-0x18bdddb834aa00LL),
-      real(-0x37ff6cf7616840LL),real(-0x9a5f4811c06b80LL),
-      real(-0x25bde21729de0c0LL),real(-0x16ea24b2a28ff500LL),
+      -real(0x2271f7278cc0LL),-real(0x2c3f5c6ec900LL),-real(0x399dc5a18140LL),
+      -real(0x4c2bebb96280LL),-real(0x6670101499c0LL),-real(0x8c75450f5400LL),
+      -real(0xc4e9f8733e40LL),-real(0x11b3ff75a0580LL),
+      -real(0x1a3e7cf3fd6c0LL),-real(0x2853a9e02df00LL),
+      -real(0x40b8bca6ccb40LL),-real(0x6da2a9d234880LL),
+      -real(0xc6fc7477c83c0LL),-real(0x18bdddb834aa00LL),
+      -real(0x37ff6cf7616840LL),-real(0x9a5f4811c06b80LL),
+      -real(0x25bde21729de0c0LL),-real(0x16ea24b2a28ff500LL),
       reale(2841LL,0x69c686bdbaac0LL),reale(-5561LL,0x628c009235180LL),
-      reale(4369LL,0xdffb6688d240LL),real(-0x4cccbefeb4d67b22LL),
+      reale(4369LL,0xdffb6688d240LL),-real(0x4cccbefeb4d67b22LL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[1], coeff of eps^1, polynomial in n of order 22
-      real(-0xd0da1980ba0LL),real(-0x10803fb20d70LL),real(-0x151a70ced0c0LL),
-      real(-0x1b569dc61a10LL),real(-0x23ecd2ce6de0LL),real(-0x2ff80cba60b0LL),
-      real(-0x413672596700LL),real(-0x5a7b8b75a550LL),real(-0x8082f2984020LL),
-      real(-0xbb859b75abf0LL),real(-0x11a6bf1637d40LL),
-      real(-0x1b9a143813890LL),real(-0x2d2aacb8da260LL),
-      real(-0x4e2c5253a0f30LL),real(-0x914a9e2ed3380LL),
-      real(-0x128a302f4ef3d0LL),real(-0x2b2226f5e6b4a0LL),
-      real(-0x7a36190e0daa70LL),real(-0x1e8d8643836a9c0LL),
-      real(-0x129e3dd12414f710LL),reale(2184LL,0x86ffdb3446920LL),
+      -real(0xd0da1980ba0LL),-real(0x10803fb20d70LL),-real(0x151a70ced0c0LL),
+      -real(0x1b569dc61a10LL),-real(0x23ecd2ce6de0LL),-real(0x2ff80cba60b0LL),
+      -real(0x413672596700LL),-real(0x5a7b8b75a550LL),-real(0x8082f2984020LL),
+      -real(0xbb859b75abf0LL),-real(0x11a6bf1637d40LL),
+      -real(0x1b9a143813890LL),-real(0x2d2aacb8da260LL),
+      -real(0x4e2c5253a0f30LL),-real(0x914a9e2ed3380LL),
+      -real(0x128a302f4ef3d0LL),-real(0x2b2226f5e6b4a0LL),
+      -real(0x7a36190e0daa70LL),-real(0x1e8d8643836a9c0LL),
+      -real(0x129e3dd12414f710LL),reale(2184LL,0x86ffdb3446920LL),
       reale(-3277LL,0x3580373196250LL),real(0x5999897e7da4e4fdLL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[2], coeff of eps^23, polynomial in n of order 0
@@ -384,122 +384,122 @@ namespace GeographicLib {
       // C4[2], coeff of eps^22, polynomial in n of order 1
       real(0x3a924a0LL),real(0xefc484LL),real(0x35f1be97217LL),
       // C4[2], coeff of eps^21, polynomial in n of order 2
-      real(0x3ecd5100LL),real(-0x2a455b80LL),real(0x1a0aa978LL),
+      real(0x3ecd5100LL),-real(0x2a455b80LL),real(0x1a0aa978LL),
       real(0x18f301bf7f77LL),
       // C4[2], coeff of eps^20, polynomial in n of order 3
-      real(0x45823cb069c0LL),real(-0x3dc56cd10180LL),real(0x15b4532d4340LL),
+      real(0x45823cb069c0LL),-real(0x3dc56cd10180LL),real(0x15b4532d4340LL),
       real(0x5946b207ad8LL),real(0xf72bf6e15a9abe5LL),
       // C4[2], coeff of eps^19, polynomial in n of order 4
-      real(0x1b1b08a8c6e00LL),real(-0x1a1dea5249180LL),real(0xc1b857255700LL),
-      real(-0x8a94db95d080LL),real(0x5209b9749ec8LL),
+      real(0x1b1b08a8c6e00LL),-real(0x1a1dea5249180LL),real(0xc1b857255700LL),
+      -real(0x8a94db95d080LL),real(0x5209b9749ec8LL),
       real(0x3a6f4368c13f04a5LL),
       // C4[2], coeff of eps^18, polynomial in n of order 5
-      real(0x13c972f90d64d60LL),real(-0x12d8369dbbbb080LL),
-      real(0xa013fa80d7c1a0LL),real(-0x95d1a2bb4de840LL),
+      real(0x13c972f90d64d60LL),-real(0x12d8369dbbbb080LL),
+      real(0xa013fa80d7c1a0LL),-real(0x95d1a2bb4de840LL),
       real(0x30a495fb9aa5e0LL),real(0xc95efc891d64cLL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^17, polynomial in n of order 6
-      real(0x4b31e4eff4bc00LL),real(-0x4190c8b5d5de00LL),
-      real(0x27770ac0842800LL),real(-0x270a0d33995200LL),
-      real(0x10c9f01b859400LL),real(-0xd056352974600LL),
+      real(0x4b31e4eff4bc00LL),-real(0x4190c8b5d5de00LL),
+      real(0x27770ac0842800LL),-real(0x270a0d33995200LL),
+      real(0x10c9f01b859400LL),-real(0xd056352974600LL),
       real(0x74f9dc1f6f260LL),reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^16, polynomial in n of order 7
-      real(0x39908ef33285d00LL),real(-0x2a7d467835cbe00LL),
-      real(0x1e0505551ade700LL),real(-0x1bf3204cf26d400LL),
-      real(0xe195527d96f100LL),real(-0xe0af5ccd52ea00LL),
+      real(0x39908ef33285d00LL),-real(0x2a7d467835cbe00LL),
+      real(0x1e0505551ade700LL),-real(0x1bf3204cf26d400LL),
+      real(0xe195527d96f100LL),-real(0xe0af5ccd52ea00LL),
       real(0x41681113e87b00LL),real(0x1112b429bab2a0LL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^15, polynomial in n of order 8
-      real(0xf8fa0142055000LL),real(-0x8f8aa7832e8a00LL),
-      real(0x7d6f3ddfb47c00LL),real(-0x62d1e182b7be00LL),
-      real(0x3bb149eddea800LL),real(-0x3be3b3e26a7200LL),
-      real(0x175d0d17dad400LL),real(-0x14371cfc4fa600LL),
+      real(0xf8fa0142055000LL),-real(0x8f8aa7832e8a00LL),
+      real(0x7d6f3ddfb47c00LL),-real(0x62d1e182b7be00LL),
+      real(0x3bb149eddea800LL),-real(0x3be3b3e26a7200LL),
+      real(0x175d0d17dad400LL),-real(0x14371cfc4fa600LL),
       real(0xa8f8f5855a060LL),reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^14, polynomial in n of order 9
-      real(0x21490cd145715e0LL),real(-0xe087822f191900LL),
-      real(0xf91f2bb3d29820LL),real(-0x949428c90dc2c0LL),
-      real(0x7371ad50b34a60LL),real(-0x63c52e9a850c80LL),
-      real(0x301579a22c8ca0LL),real(-0x33552a69ca1640LL),
+      real(0x21490cd145715e0LL),-real(0xe087822f191900LL),
+      real(0xf91f2bb3d29820LL),-real(0x949428c90dc2c0LL),
+      real(0x7371ad50b34a60LL),-real(0x63c52e9a850c80LL),
+      real(0x301579a22c8ca0LL),-real(0x33552a69ca1640LL),
       real(0xcc2c8c733bee0LL),real(0x35f5f30acfbecLL),
       reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^13, polynomial in n of order 10
-      real(0x29bb6acaa073ef00LL),real(-0xc930d526d728e80LL),
-      real(0xf55c2b3103d0c00LL),real(-0x63b9281a5449980LL),
-      real(0x6acdfd5dbb92900LL),real(-0x441c8fce3be0480LL),
-      real(0x2be797a45cb8600LL),real(-0x2aec3395f438f80LL),
-      real(0xec70ff5d376300LL),real(-0xedc27143c9fa80LL),
+      real(0x29bb6acaa073ef00LL),-real(0xc930d526d728e80LL),
+      real(0xf55c2b3103d0c00LL),-real(0x63b9281a5449980LL),
+      real(0x6acdfd5dbb92900LL),-real(0x441c8fce3be0480LL),
+      real(0x2be797a45cb8600LL),-real(0x2aec3395f438f80LL),
+      real(0xec70ff5d376300LL),-real(0xedc27143c9fa80LL),
       real(0x7039bcd0124e68LL),reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^12, polynomial in n of order 11
-      real(-0x17ce935fc610ad40LL),real(-0x5d5bbde81a902580LL),
-      real(0x2dcc12fb45c89240LL),real(-0xc1c61e98a479e00LL),
-      real(0x10183633a5ddf1c0LL),real(-0x672de318faa1680LL),
-      real(0x64ee85310393140LL),real(-0x481cf983db0cf00LL),
-      real(0x2299f24f52810c0LL),real(-0x271fc56086d0780LL),
+      -real(0x17ce935fc610ad40LL),-real(0x5d5bbde81a902580LL),
+      real(0x2dcc12fb45c89240LL),-real(0xc1c61e98a479e00LL),
+      real(0x10183633a5ddf1c0LL),-real(0x672de318faa1680LL),
+      real(0x64ee85310393140LL),-real(0x481cf983db0cf00LL),
+      real(0x2299f24f52810c0LL),-real(0x271fc56086d0780LL),
       real(0x79dac155045040LL),real(0x20c44d35dada38LL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^11, polynomial in n of order 12
-      real(-0x6b8bdbaa2666e600LL),reale(2706LL,0x6d4e4332c7e80LL),
-      real(-0x201eb2939ffc7500LL),real(-0x605f6d97c740b880LL),
-      real(0x32fb1ca66ccebc00LL),real(-0xb85f2dd585e0f80LL),
-      real(0x10b7dbe9dec0ed00LL),real(-0x6e454f6a0fd4680LL),
-      real(0x594f6f139205e00LL),real(-0x4c204810d601d80LL),
-      real(0x16a875347934f00LL),real(-0x1be72589c185480LL),
+      -real(0x6b8bdbaa2666e600LL),reale(2706LL,0x6d4e4332c7e80LL),
+      -real(0x201eb2939ffc7500LL),-real(0x605f6d97c740b880LL),
+      real(0x32fb1ca66ccebc00LL),-real(0xb85f2dd585e0f80LL),
+      real(0x10b7dbe9dec0ed00LL),-real(0x6e454f6a0fd4680LL),
+      real(0x594f6f139205e00LL),-real(0x4c204810d601d80LL),
+      real(0x16a875347934f00LL),-real(0x1be72589c185480LL),
       real(0xb5a396e2ccd788LL),reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^10, polynomial in n of order 13
       real(0x332d666e095e20LL),real(0x205e97ebfb32780LL),
-      real(-0xf80bf36cd359f20LL),real(0x19615ff8d71e0640LL),
-      real(-0x61aef235a414c60LL),real(-0xe1fda0393083b00LL),
-      real(0x83e2ad192fc7660LL),real(-0x18ece140ef0fc40LL),
-      real(0x26bbb213037c920LL),real(-0x11a4c9418dd9d80LL),
-      real(0x9ec708de66cbe0LL),real(-0xaee5994e9b7ec0LL),
+      -real(0xf80bf36cd359f20LL),real(0x19615ff8d71e0640LL),
+      -real(0x61aef235a414c60LL),-real(0xe1fda0393083b00LL),
+      real(0x83e2ad192fc7660LL),-real(0x18ece140ef0fc40LL),
+      real(0x26bbb213037c920LL),-real(0x11a4c9418dd9d80LL),
+      real(0x9ec708de66cbe0LL),-real(0xaee5994e9b7ec0LL),
       real(0x1626e135e59ea0LL),real(0x610ef2b6b35c4LL),
       reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^9, polynomial in n of order 14
       real(0x1b709db1871200LL),real(0x51a2a024c26b00LL),
       real(0x157c554050bb400LL),real(0xddb41f944653d00LL),
-      real(-0x6d182f563006aa00LL),reale(2991LL,0xf7eb0ae304f00LL),
-      real(-0x387b65599c618800LL),real(-0x64242336a83ddf00LL),
-      real(0x4282c6eaa3899a00LL),real(-0xa8fc3afb1e6cd00LL),
-      real(0x1040dddbf0493c00LL),real(-0x9184bc07b2bfb00LL),
-      real(0x281ea22622bde00LL),real(-0x3dc59bc648ee900LL),
+      -real(0x6d182f563006aa00LL),reale(2991LL,0xf7eb0ae304f00LL),
+      -real(0x387b65599c618800LL),-real(0x64242336a83ddf00LL),
+      real(0x4282c6eaa3899a00LL),-real(0xa8fc3afb1e6cd00LL),
+      real(0x1040dddbf0493c00LL),-real(0x9184bc07b2bfb00LL),
+      real(0x281ea22622bde00LL),-real(0x3dc59bc648ee900LL),
       real(0x13fb78815b4ca90LL),reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^8, polynomial in n of order 15
       real(0xacc0646b5180LL),real(0x1753663f74b00LL),real(0x3994d0061e480LL),
       real(0xadc1fbdd72e00LL),real(0x2e87a44adab780LL),
-      real(0x1eaeb3451821100LL),real(-0xf937e414930b580LL),
-      real(0x1c27d8b21df37400LL),real(-0xaa5908f76fee280LL),
-      real(-0xe1c8d327ee92900LL),real(0xb2675f22d49b080LL),
-      real(-0x19e66cd66684600LL),real(0x1f3a47aa5ea8380LL),
-      real(-0x18da246c74e6300LL),real(0x10dd3b80dd1680LL),
+      real(0x1eaeb3451821100LL),-real(0xf937e414930b580LL),
+      real(0x1c27d8b21df37400LL),-real(0xaa5908f76fee280LL),
+      -real(0xe1c8d327ee92900LL),real(0xb2675f22d49b080LL),
+      -real(0x19e66cd66684600LL),real(0x1f3a47aa5ea8380LL),
+      -real(0x18da246c74e6300LL),real(0x10dd3b80dd1680LL),
       real(0x3f21f272d2a30LL),reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^7, polynomial in n of order 16
       real(0x2957d7da1000LL),real(0x4c28ba8a3700LL),real(0x9714a6610e00LL),
       real(0x14a5ff52a4500LL),real(0x33af2f78d8c00LL),real(0x9e87298409300LL),
       real(0x2b4e15dbd10a00LL),real(0x1d4c6da210ea100LL),
-      real(-0xf6c4a6847e2f800LL),real(0x1da98c51a6b5ef00LL),
-      real(-0xe1270d810dcfa00LL),real(-0xd23a021f3080300LL),
-      real(0xd3b280b26948400LL),real(-0x22fd890d309b500LL),
-      real(0x119ef453c630200LL),real(-0x1959af9980da700LL),
+      -real(0xf6c4a6847e2f800LL),real(0x1da98c51a6b5ef00LL),
+      -real(0xe1270d810dcfa00LL),-real(0xd23a021f3080300LL),
+      real(0xd3b280b26948400LL),-real(0x22fd890d309b500LL),
+      real(0x119ef453c630200LL),-real(0x1959af9980da700LL),
       real(0x5959078fa70870LL),reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^6, polynomial in n of order 17
       real(0x511612baa2a0LL),real(0x87a79de92a00LL),real(0xee2dd20af160LL),
       real(0x1bbcfaf32f4c0LL),real(0x37ba524fb5020LL),real(0x7b9b8f2a45f80LL),
       real(0x13a76fcf6fdee0LL),real(0x3d717a0fbe0a40LL),
       real(0x112dc752f02bda0LL),real(0xbfa002cc4689500LL),
-      real(-0x694405622017f3a0LL),reale(3484LL,0x979f3cbb89fc0LL),
-      reale(-2089LL,0xb01dfba51eb20LL),real(-0x49f87439584d3580LL),
-      real(0x6c3e90c1455479e0LL),real(-0x1afff07538f04ac0LL),
-      real(-0x1a0f4cdf3b62760LL),real(-0x112f9b85f9ebf7cLL),
+      -real(0x694405622017f3a0LL),reale(3484LL,0x979f3cbb89fc0LL),
+      reale(-2089LL,0xb01dfba51eb20LL),-real(0x49f87439584d3580LL),
+      real(0x6c3e90c1455479e0LL),-real(0x1afff07538f04ac0LL),
+      -real(0x1a0f4cdf3b62760LL),-real(0x112f9b85f9ebf7cLL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^5, polynomial in n of order 18
       real(0x181437e05500LL),real(0x25c7b1fe6a80LL),real(0x3d5ebd606800LL),
       real(0x67dd27f0e580LL),real(0xb8ac7d2a7b00LL),real(0x15ce71e5cc080LL),
       real(0x2c7c6a3654e00LL),real(0x6460c05d0bb80LL),real(0x1046637cd7a100LL),
       real(0x340d46956b9680LL),real(0xef5f1bde883400LL),
-      real(0xacec6aed73c1180LL),real(-0x63ea680d7ea23900LL),
+      real(0xacec6aed73c1180LL),-real(0x63ea680d7ea23900LL),
       reale(3605LL,0xecc3861a0ec80LL),reale(-2760LL,0x37fb593bf1a00LL),
-      real(-0x212a787bd0571880LL),real(0x70c6a0884332ed00LL),
-      real(-0x31a5fa2db58d3d80LL),real(0x5033807138f7d98LL),
+      -real(0x212a787bd0571880LL),real(0x70c6a0884332ed00LL),
+      -real(0x31a5fa2db58d3d80LL),real(0x5033807138f7d98LL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^4, polynomial in n of order 19
       real(0x6f3f0983c40LL),real(0xa6cf9192980LL),real(0x100e50e166c0LL),
@@ -507,9 +507,9 @@ namespace GeographicLib {
       real(0x821ecd9c1bc0LL),real(0xfa1d1da0b100LL),real(0x2081a78802640LL),
       real(0x4aefd4add3380LL),real(0xc730805b650c0LL),real(0x28f491e04e7600LL),
       real(0xc2d07512dddb40LL),real(0x92e539684c6b880LL),
-      real(-0x5a2096cfc695fa40LL),reale(3598LL,0x9cd1e91b83b00LL),
+      -real(0x5a2096cfc695fa40LL),reale(3598LL,0x9cd1e91b83b00LL),
       reale(-3554LL,0xe2b69fe3a1040LL),real(0x31a5fa2db58d3d80LL),
-      real(0x3760835a5e313ac0LL),real(-0x1bed5cb9b61f7298LL),
+      real(0x3760835a5e313ac0LL),-real(0x1bed5cb9b61f7298LL),
       reale(107519LL,0xb480ecf4f161fLL),
       // C4[2], coeff of eps^3, polynomial in n of order 20
       real(0x3f9079b600LL),real(0x5c3030c280LL),real(0x88a1097700LL),
@@ -517,9 +517,9 @@ namespace GeographicLib {
       real(0x36a4a027900LL),real(0x5f8b4acad80LL),real(0xb01798c3a00LL),
       real(0x15a2eb8a6680LL),real(0x2e235b147b00LL),real(0x6d6a30f2bf80LL),
       real(0x12c54474b7c00LL),real(0x40129870df880LL),real(0x13e41ecc817d00LL),
-      real(0xfcf67c8cf45180LL),real(-0xa65f288fe794200LL),
-      real(0x1cea83a477ce0a80LL),real(-0x240239aaff748100LL),
-      real(0x1547221396f36380LL),real(-0x4e04d247d427178LL),
+      real(0xfcf67c8cf45180LL),-real(0xa65f288fe794200LL),
+      real(0x1cea83a477ce0a80LL),-real(0x240239aaff748100LL),
+      real(0x1547221396f36380LL),-real(0x4e04d247d427178LL),
       reale(15359LL,0xf536fd4790329LL),
       // C4[2], coeff of eps^2, polynomial in n of order 21
       real(0x49e4c0b060LL),real(0x687ef6a180LL),real(0x96820442a0LL),
@@ -528,1183 +528,1183 @@ namespace GeographicLib {
       real(0x1013bf0bfa80LL),real(0x1e750d7baba0LL),real(0x3dc4346800c0LL),
       real(0x88729901ade0LL),real(0x150e863aba700LL),real(0x3c89c1e8d8020LL),
       real(0xd9efed463cd40LL),real(0x47e39644808260LL),
-      real(0x3d1b0c8706d5380LL),real(-0x2af704cef0cdeb60LL),
+      real(0x3d1b0c8706d5380LL),-real(0x2af704cef0cdeb60LL),
       real(0x7c1ef17245e119c0LL),reale(-2185LL,0x790024cbb96e0LL),
       real(0x333329ff2339a76cLL),reale(107519LL,0xb480ecf4f161fLL),
       // C4[3], coeff of eps^23, polynomial in n of order 0
       real(70576LL),real(0x6cd1db26bLL),
       // C4[3], coeff of eps^22, polynomial in n of order 1
-      real(-0x1dbc000LL),real(0x10088c0LL),real(0x192c8c2464fLL),
+      -real(0x1dbc000LL),real(0x10088c0LL),real(0x192c8c2464fLL),
       // C4[3], coeff of eps^21, polynomial in n of order 2
-      real(-0x1fa8df9600LL),real(0x89ebf7900LL),real(0x24e4f9128LL),
+      -real(0x1fa8df9600LL),real(0x89ebf7900LL),real(0x24e4f9128LL),
       real(0xb98f5d0044051LL),
       // C4[3], coeff of eps^20, polynomial in n of order 3
-      real(-0x30f8b0f5c00LL),real(0x12d79f66800LL),real(-0x115c7023400LL),
+      -real(0x30f8b0f5c00LL),real(0x12d79f66800LL),-real(0x115c7023400LL),
       real(0x8d25cb7890LL),real(0xa7c6f527b4f7c7LL),
       // C4[3], coeff of eps^19, polynomial in n of order 4
-      real(-0x3317d68847dc00LL),real(0x19fc69dd236700LL),
-      real(-0x1c6d14df7ace00LL),real(0x6cfe4fac52d00LL),
+      -real(0x3317d68847dc00LL),real(0x19fc69dd236700LL),
+      -real(0x1c6d14df7ace00LL),real(0x6cfe4fac52d00LL),
       real(0x1d99f24357808LL),reale(30105LL,0x847604e86c8c1LL),
       // C4[3], coeff of eps^18, polynomial in n of order 5
-      real(-0x15b0eba45ef8000LL),real(0xf79bdd24a10000LL),
-      real(-0xf32a8559288000LL),real(0x563281b24a8000LL),
-      real(-0x5920796c2f8000LL),real(0x29f7b73471c480LL),
+      -real(0x15b0eba45ef8000LL),real(0xf79bdd24a10000LL),
+      -real(0xf32a8559288000LL),real(0x563281b24a8000LL),
+      -real(0x5920796c2f8000LL),real(0x29f7b73471c480LL),
       reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^17, polynomial in n of order 6
-      real(-0x1c02d0336ef1800LL),real(0x1d91ba24525dc00LL),
-      real(-0x163d203e4811000LL),real(0xb8e8b252aa8400LL),
-      real(-0xd2485de6110800LL),real(0x2a40e341b4ac00LL),
+      -real(0x1c02d0336ef1800LL),real(0x1d91ba24525dc00LL),
+      -real(0x163d203e4811000LL),real(0xb8e8b252aa8400LL),
+      -real(0xd2485de6110800LL),real(0x2a40e341b4ac00LL),
       real(0xbb70f2cbcf360LL),reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^16, polynomial in n of order 7
-      real(-0x58b4aa16ae3000LL),real(0x7fa0a14380e000LL),
-      real(-0x429ab6e3829000LL),real(0x383428ed0d4000LL),
-      real(-0x32e93ebd99f000LL),real(0x108fe88bbda000LL),
-      real(-0x13ba86ffa65000LL),real(0x868b4ab8e3340LL),
+      -real(0x58b4aa16ae3000LL),real(0x7fa0a14380e000LL),
+      -real(0x429ab6e3829000LL),real(0x383428ed0d4000LL),
+      -real(0x32e93ebd99f000LL),real(0x108fe88bbda000LL),
+      -real(0x13ba86ffa65000LL),real(0x868b4ab8e3340LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^15, polynomial in n of order 8
-      real(-0xaedfc7febee000LL),real(0xe403ca9386ec00LL),
-      real(-0x5568aa53f7a800LL),real(0x76f3d9af940400LL),
-      real(-0x475f28b7bb7000LL),real(0x29018461d69c00LL),
-      real(-0x2ed89591f13800LL),real(0x74380445fb400LL),
+      -real(0xaedfc7febee000LL),real(0xe403ca9386ec00LL),
+      -real(0x5568aa53f7a800LL),real(0x76f3d9af940400LL),
+      -real(0x475f28b7bb7000LL),real(0x29018461d69c00LL),
+      -real(0x2ed89591f13800LL),real(0x74380445fb400LL),
       real(0x21274712bcba0LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^14, polynomial in n of order 9
-      real(-0x231ca125e5c8000LL),real(0x15ea7d5f05e0000LL),
-      real(-0x97f88531f38000LL),real(0xee839ade908000LL),
-      real(-0x572a9cdd748000LL),real(0x65a05d4f5f0000LL),
-      real(-0x4ce11756538000LL),real(0x177f524c958000LL),
-      real(-0x20e57338048000LL),real(0xc4518e260f380LL),
+      -real(0x231ca125e5c8000LL),real(0x15ea7d5f05e0000LL),
+      -real(0x97f88531f38000LL),real(0xee839ade908000LL),
+      -real(0x572a9cdd748000LL),real(0x65a05d4f5f0000LL),
+      -real(0x4ce11756538000LL),real(0x177f524c958000LL),
+      -real(0x20e57338048000LL),real(0xc4518e260f380LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^13, polynomial in n of order 10
-      real(-0x44ebd4477ad4f200LL),real(0x9a6a6024b320f00LL),
-      real(-0xe915ce102d6a800LL),real(0xb28d5273bcee100LL),
-      real(-0x37fa968ec235e00LL),real(0x68974b850671300LL),
-      real(-0x2a735b9bf505400LL),real(0x20513dd7a7f6500LL),
-      real(-0x220360a9be2ca00LL),real(0x36d1c1a3f49700LL),
+      -real(0x44ebd4477ad4f200LL),real(0x9a6a6024b320f00LL),
+      -real(0xe915ce102d6a800LL),real(0xb28d5273bcee100LL),
+      -real(0x37fa968ec235e00LL),real(0x68974b850671300LL),
+      -real(0x2a735b9bf505400LL),real(0x20513dd7a7f6500LL),
+      -real(0x220360a9be2ca00LL),real(0x36d1c1a3f49700LL),
       real(0x10369a2227fd98LL),reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^12, polynomial in n of order 11
       real(0x52462bb828351400LL),real(0x4a4d1c14e6172800LL),
-      real(-0x4ced32c430d22400LL),real(0xb52b1b0c2492000LL),
-      real(-0xd058359466b1c00LL),real(0xd07709dd3bd1800LL),
-      real(-0x30072e56aae5400LL),real(0x605c027d5629000LL),
-      real(-0x32e58b8ebb44c00LL),real(0x108221f23a90800LL),
-      real(-0x1a7ac7295958400LL),real(0x836be4086f28d0LL),
+      -real(0x4ced32c430d22400LL),real(0xb52b1b0c2492000LL),
+      -real(0xd058359466b1c00LL),real(0xd07709dd3bd1800LL),
+      -real(0x30072e56aae5400LL),real(0x605c027d5629000LL),
+      -real(0x32e58b8ebb44c00LL),real(0x108221f23a90800LL),
+      -real(0x1a7ac7295958400LL),real(0x836be4086f28d0LL),
       reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^11, polynomial in n of order 12
       real(0x48f7bc8748dd3400LL),reale(-2562LL,0x8060698c5b900LL),
       real(0x601d0ed1c7f2b600LL),real(0x449204e4f86d4300LL),
-      real(-0x56194f80f81a8800LL),real(0xea108cfa6f6ed00LL),
-      real(-0xa7ad46bd016c600LL),real(0xef32c344e507700LL),
-      real(-0x30a1762ff0e4400LL),real(0x4a78ea25c4fa100LL),
-      real(-0x3c3cca9d1bd4200LL),real(0x22cbd76a022b00LL),
+      -real(0x56194f80f81a8800LL),real(0xea108cfa6f6ed00LL),
+      -real(0xa7ad46bd016c600LL),real(0xef32c344e507700LL),
+      -real(0x30a1762ff0e4400LL),real(0x4a78ea25c4fa100LL),
+      -real(0x3c3cca9d1bd4200LL),real(0x22cbd76a022b00LL),
       real(0x9df3abb037278LL),reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^10, polynomial in n of order 13
-      real(-0x9607df2a17c000LL),real(-0x739371b7f3d8000LL),
+      -real(0x9607df2a17c000LL),-real(0x739371b7f3d8000LL),
       real(0x4688c366039fc000LL),reale(-2612LL,0x75993403fc000LL),
       real(0x7056fbc7b1c24000LL),real(0x3af7506941670000LL),
-      real(-0x601cadbaecf24000LL),real(0x14affbea17164000LL),
-      real(-0x6daccbfd0bfc000LL),real(0x1036680bb42b8000LL),
-      real(-0x42f04a7d6e84000LL),real(0x246d9b6ab84c000LL),
-      real(-0x37cce3b53adc000LL),real(0xd43660c7def0c0LL),
+      -real(0x601cadbaecf24000LL),real(0x14affbea17164000LL),
+      -real(0x6daccbfd0bfc000LL),real(0x1036680bb42b8000LL),
+      -real(0x42f04a7d6e84000LL),real(0x246d9b6ab84c000LL),
+      -real(0x37cce3b53adc000LL),real(0xd43660c7def0c0LL),
       reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^9, polynomial in n of order 14
-      real(-0x115a7e31ff400LL),real(-0x3c90c47c29600LL),
-      real(-0x1311ab10640800LL),real(-0xf2246746703a00LL),
-      real(0x99b5e8c5c68e400LL),real(-0x179a6d9c8ead9e00LL),
+      -real(0x115a7e31ff400LL),-real(0x3c90c47c29600LL),
+      -real(0x1311ab10640800LL),-real(0xf2246746703a00LL),
+      real(0x99b5e8c5c68e400LL),-real(0x179a6d9c8ead9e00LL),
       real(0x12bd250608495000LL),real(0x63777cc9563be00LL),
-      real(-0xf1ef7972c204400LL),real(0x47367775d725a00LL),
-      real(-0x63378c7bb15800LL),real(0x22d63078c5cb600LL),
-      real(-0xf8707c83e76c00LL),real(-0xb0e06786eae00LL),
-      real(-0x5e4438ea922f0LL),reale(21503LL,0xf0e695ca96ad3LL),
+      -real(0xf1ef7972c204400LL),real(0x47367775d725a00LL),
+      -real(0x63378c7bb15800LL),real(0x22d63078c5cb600LL),
+      -real(0xf8707c83e76c00LL),-real(0xb0e06786eae00LL),
+      -real(0x5e4438ea922f0LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^8, polynomial in n of order 15
-      real(-0x1fe011d85800LL),real(-0x4f422fb05000LL),real(-0xe40060fc8800LL),
-      real(-0x32e664e9c2000LL),real(-0x1078ec0ef63800LL),
-      real(-0xd864902b71f000LL),real(0x8fab71292d19800LL),
-      real(-0x179bbec0170ac000LL),real(0x15c925f1e4f1e800LL),
-      real(0x2c36e0d96c07000LL),real(-0x100d07856dfe4800LL),
-      real(0x6d9c3efea16a000LL),real(-0x13ac4a3567f800LL),
-      real(0x15b22a4de1ed000LL),real(-0x1452d18e2b42800LL),
+      -real(0x1fe011d85800LL),-real(0x4f422fb05000LL),-real(0xe40060fc8800LL),
+      -real(0x32e664e9c2000LL),-real(0x1078ec0ef63800LL),
+      -real(0xd864902b71f000LL),real(0x8fab71292d19800LL),
+      -real(0x179bbec0170ac000LL),real(0x15c925f1e4f1e800LL),
+      real(0x2c36e0d96c07000LL),-real(0x100d07856dfe4800LL),
+      real(0x6d9c3efea16a000LL),-real(0x13ac4a3567f800LL),
+      real(0x15b22a4de1ed000LL),-real(0x1452d18e2b42800LL),
       real(0x32eab893d697a0LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^7, polynomial in n of order 16
-      real(-0x5003ad66000LL),real(-0xa79ae296200LL),real(-0x17d9e9f5d400LL),
-      real(-0x3c8762ad2600LL),real(-0xb232a56ac800LL),real(-0x28dbf6ee52a00LL),
-      real(-0xda6199e36bc00LL),real(-0xba74c6aa46ee00LL),
-      real(0x825959cb764d000LL),real(-0x17232e4c4e57f200LL),
-      real(0x190bf0598fc65c00LL),real(-0x27c51cb844db600LL),
-      real(-0xf8735fc98339800LL),real(0xa28217eef524600LL),
-      real(-0xfc87c9cb4a8c00LL),real(-0x3228ffc0ed7e00LL),
-      real(-0x387bf611406670LL),reale(21503LL,0xf0e695ca96ad3LL),
+      -real(0x5003ad66000LL),-real(0xa79ae296200LL),-real(0x17d9e9f5d400LL),
+      -real(0x3c8762ad2600LL),-real(0xb232a56ac800LL),-real(0x28dbf6ee52a00LL),
+      -real(0xda6199e36bc00LL),-real(0xba74c6aa46ee00LL),
+      real(0x825959cb764d000LL),-real(0x17232e4c4e57f200LL),
+      real(0x190bf0598fc65c00LL),-real(0x27c51cb844db600LL),
+      -real(0xf8735fc98339800LL),real(0xa28217eef524600LL),
+      -real(0xfc87c9cb4a8c00LL),-real(0x3228ffc0ed7e00LL),
+      -real(0x387bf611406670LL),reale(21503LL,0xf0e695ca96ad3LL),
       // C4[3], coeff of eps^6, polynomial in n of order 17
-      real(-0x62d694dc000LL),real(-0xba60f7a0000LL),real(-0x173b38f24000LL),
-      real(-0x319b0ca1c000LL),real(-0x7361a893c000LL),real(-0x12be5bef38000LL),
-      real(-0x38b3402cc4000LL),real(-0xd6a4403694000LL),
-      real(-0x4a69cc1535c000LL),real(-0x42816c266fd0000LL),
+      -real(0x62d694dc000LL),-real(0xba60f7a0000LL),-real(0x173b38f24000LL),
+      -real(0x319b0ca1c000LL),-real(0x7361a893c000LL),-real(0x12be5bef38000LL),
+      -real(0x38b3402cc4000LL),-real(0xd6a4403694000LL),
+      -real(0x4a69cc1535c000LL),-real(0x42816c266fd0000LL),
       real(0x315cb6a39d95c000LL),reale(-2450LL,0x306e3c9574000LL),
-      reale(3143LL,0x2391393fc4000LL),real(-0x466890d45f668000LL),
-      real(-0x50368754849c4000LL),real(0x594b313771cfc000LL),
-      real(-0x1cc16f4e99cdc000LL),real(0x1e8d8643836a9c0LL),
+      reale(3143LL,0x2391393fc4000LL),-real(0x466890d45f668000LL),
+      -real(0x50368754849c4000LL),real(0x594b313771cfc000LL),
+      -real(0x1cc16f4e99cdc000LL),real(0x1e8d8643836a9c0LL),
       reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^5, polynomial in n of order 18
-      real(-0x1136c8f5600LL),real(-0x1e3b013df00LL),real(-0x37550c23000LL),
-      real(-0x6a508e10100LL),real(-0xd872daf0a00LL),real(-0x1d8dd6618300LL),
-      real(-0x468422b6a400LL),real(-0xbc9d06f02500LL),real(-0x24d784d09be00LL),
-      real(-0x90d122dffa700LL),real(-0x347ca809f91800LL),
-      real(-0x31861ec3b2ac900LL),real(0x276d051382ba8e00LL),
+      -real(0x1136c8f5600LL),-real(0x1e3b013df00LL),-real(0x37550c23000LL),
+      -real(0x6a508e10100LL),-real(0xd872daf0a00LL),-real(0x1d8dd6618300LL),
+      -real(0x468422b6a400LL),-real(0xbc9d06f02500LL),-real(0x24d784d09be00LL),
+      -real(0x90d122dffa700LL),-real(0x347ca809f91800LL),
+      -real(0x31861ec3b2ac900LL),real(0x276d051382ba8e00LL),
       reale(-2164LL,0xaacb805bbb500LL),reale(3319LL,0x8d7da907400LL),
-      reale(-2192LL,0x2451a99991300LL),real(-0x47e396448082600LL),
-      real(0x3577aaf625fa9100LL),real(-0x1449fb28d544cb98LL),
+      reale(-2192LL,0x2451a99991300LL),-real(0x47e396448082600LL),
+      real(0x3577aaf625fa9100LL),-real(0x1449fb28d544cb98LL),
       reale(150527LL,0x964e188a1ebc5LL),
       // C4[3], coeff of eps^4, polynomial in n of order 19
-      real(-0xda1252c00LL),real(-0x16bd22f800LL),real(-0x2731e0a400LL),
-      real(-0x46214fc000LL),real(-0x830545dc00LL),real(-0x1017e988800LL),
-      real(-0x21987b95400LL),real(-0x4b78a99d000LL),real(-0xb9ccd9f8c00LL),
-      real(-0x202de3701800LL),real(-0x68b6655d0400LL),real(-0x1af3df037e000LL),
-      real(-0xa515b5f563c00LL),real(-0xa65924698da800LL),
-      real(0x8fc72c890104c00LL),real(-0x226e597c6e0df000LL),
-      real(0x3ee7237bf0721400LL),real(-0x3d1b0c8706d53800LL),
-      real(0x1e8d8643836a9c00LL),real(-0x634bf45b6b1a7b0LL),
+      -real(0xda1252c00LL),-real(0x16bd22f800LL),-real(0x2731e0a400LL),
+      -real(0x46214fc000LL),-real(0x830545dc00LL),-real(0x1017e988800LL),
+      -real(0x21987b95400LL),-real(0x4b78a99d000LL),-real(0xb9ccd9f8c00LL),
+      -real(0x202de3701800LL),-real(0x68b6655d0400LL),-real(0x1af3df037e000LL),
+      -real(0xa515b5f563c00LL),-real(0xa65924698da800LL),
+      real(0x8fc72c890104c00LL),-real(0x226e597c6e0df000LL),
+      real(0x3ee7237bf0721400LL),-real(0x3d1b0c8706d53800LL),
+      real(0x1e8d8643836a9c00LL),-real(0x634bf45b6b1a7b0LL),
       reale(50175LL,0xdcc4b2d8b4e97LL),
       // C4[3], coeff of eps^3, polynomial in n of order 20
-      real(-0x3da35ec00LL),real(-0x62f09c100LL),real(-0xa329fce00LL),
-      real(-0x11560fab00LL),real(-0x1e812bf000LL),real(-0x37d592b500LL),
-      real(-0x6af77a1200LL),real(-0xd82e3c9f00LL),real(-0x1d19ea9f400LL),
-      real(-0x43b761f2900LL),real(-0xad7cf6b5600LL),real(-0x1f71d9841300LL),
-      real(-0x6bcf7c0df800LL),real(-0x1d7abbebd1d00LL),
-      real(-0xc1b8d2e919a00LL),real(-0xd3e226aef40700LL),
-      real(0xc94a0b2634a0400LL),real(-0x3577aaf625fa9100LL),
-      real(0x6aef55ec4bf52200LL),real(-0x634bf45b6b1a7b00LL),
+      -real(0x3da35ec00LL),-real(0x62f09c100LL),-real(0xa329fce00LL),
+      -real(0x11560fab00LL),-real(0x1e812bf000LL),-real(0x37d592b500LL),
+      -real(0x6af77a1200LL),-real(0xd82e3c9f00LL),-real(0x1d19ea9f400LL),
+      -real(0x43b761f2900LL),-real(0xad7cf6b5600LL),-real(0x1f71d9841300LL),
+      -real(0x6bcf7c0df800LL),-real(0x1d7abbebd1d00LL),
+      -real(0xc1b8d2e919a00LL),-real(0xd3e226aef40700LL),
+      real(0xc94a0b2634a0400LL),-real(0x3577aaf625fa9100LL),
+      real(0x6aef55ec4bf52200LL),-real(0x634bf45b6b1a7b00LL),
       real(0x22221bff6cd11a48LL),reale(150527LL,0x964e188a1ebc5LL),
       // C4[4], coeff of eps^23, polynomial in n of order 0
       real(567424LL),real(0x1467591741LL),
       // C4[4], coeff of eps^22, polynomial in n of order 1
       real(0x7f44f800LL),real(0x23b17a00LL),real(0x1358168b64fd9LL),
       // C4[4], coeff of eps^21, polynomial in n of order 2
-      real(0x560fab000LL),real(-0x6488cc800LL),real(0x2bcf67580LL),
+      real(0x560fab000LL),-real(0x6488cc800LL),real(0x2bcf67580LL),
       real(0x4f869592664b5LL),
       // C4[4], coeff of eps^20, polynomial in n of order 3
-      real(0xa4d4b674a00LL),real(-0xbdc38ed8400LL),real(0x20274dfee00LL),
+      real(0xa4d4b674a00LL),-real(0xbdc38ed8400LL),real(0x20274dfee00LL),
       real(0x93ecaa9440LL),real(0x436914c918b5d6dLL),
       // C4[4], coeff of eps^19, polynomial in n of order 4
-      real(0x481bf9079c000LL),real(-0x3c015f7917000LL),real(0x133447522e000LL),
-      real(-0x195b19983d000LL),real(0xa0f15f7a8700LL),
+      real(0x481bf9079c000LL),-real(0x3c015f7917000LL),real(0x133447522e000LL),
+      -real(0x195b19983d000LL),real(0xa0f15f7a8700LL),
       reale(3518LL,0xd3a367a37a66dLL),
       // C4[4], coeff of eps^18, polynomial in n of order 5
-      real(0x1e9f26efa689000LL),real(-0x100c94382c2c000LL),
-      real(0xabead3c2e1f000LL),real(-0xc04c79a6f96000LL),
+      real(0x1e9f26efa689000LL),-real(0x100c94382c2c000LL),
+      real(0xabead3c2e1f000LL),-real(0xc04c79a6f96000LL),
       real(0x18fb8548735000LL),real(0x76d40a3ef6c00LL),
       reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^17, polynomial in n of order 6
-      real(0x780536a0606000LL),real(-0x28779739e97000LL),
-      real(0x3a9fdf130c4000LL),real(-0x2860390cb81000LL),
-      real(0xcce73d3902000LL),real(-0x1322aa5844b000LL),
+      real(0x780536a0606000LL),-real(0x28779739e97000LL),
+      real(0x3a9fdf130c4000LL),-real(0x2860390cb81000LL),
+      real(0xcce73d3902000LL),-real(0x1322aa5844b000LL),
       real(0x6bd0a3ad69900LL),reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^16, polynomial in n of order 7
-      real(0x45af61c2ad1f800LL),real(-0x1b140a5252fd000LL),
-      real(0x348e789bd7f6800LL),real(-0x137ac7aed3be000LL),
-      real(0x11da35dc2ded800LL),real(-0x12097ef153ff000LL),
+      real(0x45af61c2ad1f800LL),-real(0x1b140a5252fd000LL),
+      real(0x348e789bd7f6800LL),-real(0x137ac7aed3be000LL),
+      real(0x11da35dc2ded800LL),-real(0x12097ef153ff000LL),
       real(0x186b19645c4800LL),real(0x7935fe20ccb00LL),
       reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^15, polynomial in n of order 8
-      real(0x788485be348000LL),real(-0xbf417480965000LL),
-      real(0xbdad05e3bd6000LL),real(-0x306dcc448df000LL),
-      real(0x6c08266aea4000LL),real(-0x364dbd52879000LL),
-      real(0x13468d692f2000LL),real(-0x1f6575294f3000LL),
+      real(0x788485be348000LL),-real(0xbf417480965000LL),
+      real(0xbdad05e3bd6000LL),-real(0x306dcc448df000LL),
+      real(0x6c08266aea4000LL),-real(0x364dbd52879000LL),
+      real(0x13468d692f2000LL),-real(0x1f6575294f3000LL),
       real(0x97982d7211100LL),reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^14, polynomial in n of order 9
-      real(0x99754be5293000LL),real(-0x273b2ae73028000LL),
-      real(0xa610233e31d000LL),real(-0x8ee7336f99e000LL),
-      real(0xd7a1a110827000LL),real(-0x2f0d74b9c14000LL),
-      real(0x4f375451ab1000LL),real(-0x4002b6db48a000LL),
+      real(0x99754be5293000LL),-real(0x273b2ae73028000LL),
+      real(0xa610233e31d000LL),-real(0x8ee7336f99e000LL),
+      real(0xd7a1a110827000LL),-real(0x2f0d74b9c14000LL),
+      real(0x4f375451ab1000LL),-real(0x4002b6db48a000LL),
       real(0x20d804cbbb000LL),real(0xa41d3b221400LL),
       reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^13, polynomial in n of order 10
-      real(0x6016f6408271a000LL),real(-0x1e7546e7a0d1b000LL),
-      real(0x18e4e98f72c8000LL),real(-0x113f96068e695000LL),
-      real(0x6af41cd57176000LL),real(-0x2590480c1d6f000LL),
-      real(0x61253410a664000LL),real(-0x1c92661c6269000LL),
-      real(0xfa686d5b4d2000LL),real(-0x188238347643000LL),
+      real(0x6016f6408271a000LL),-real(0x1e7546e7a0d1b000LL),
+      real(0x18e4e98f72c8000LL),-real(0x113f96068e695000LL),
+      real(0x6af41cd57176000LL),-real(0x2590480c1d6f000LL),
+      real(0x61253410a664000LL),-real(0x1c92661c6269000LL),
+      real(0xfa686d5b4d2000LL),-real(0x188238347643000LL),
       real(0x60544135abb900LL),reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^12, polynomial in n of order 11
-      reale(-2097LL,0x6253f1b27a00LL),real(-0xa96847f4d191400LL),
-      real(0x644f115411ee9e00LL),real(-0x2912ee32dfa61000LL),
-      real(-0x81eeabcb01be00LL),real(-0xfba8345c9670c00LL),
-      real(0x9bbda8340726600LL),real(-0x11537009b3f0800LL),
-      real(0x51c2ea8aa8c0a00LL),real(-0x2bb89caf7310400LL),
-      real(-0x162bd9b163d200LL),real(-0xac0895744a3c0LL),
+      reale(-2097LL,0x6253f1b27a00LL),-real(0xa96847f4d191400LL),
+      real(0x644f115411ee9e00LL),-real(0x2912ee32dfa61000LL),
+      -real(0x81eeabcb01be00LL),-real(0xfba8345c9670c00LL),
+      real(0x9bbda8340726600LL),-real(0x11537009b3f0800LL),
+      real(0x51c2ea8aa8c0a00LL),-real(0x2bb89caf7310400LL),
+      -real(0x162bd9b163d200LL),-real(0xac0895744a3c0LL),
       reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^11, polynomial in n of order 12
-      real(-0x296aa6e320b86000LL),real(0x7d9f9f72af514800LL),
+      -real(0x296aa6e320b86000LL),real(0x7d9f9f72af514800LL),
       reale(-2285LL,0x1022817ab000LL),real(0x8d22edc50949800LL),
-      real(0x6581767b41ffc000LL),real(-0x371ad32683bb1800LL),
-      real(-0x915b5d6cd33000LL),real(-0xbce7db3a027c800LL),
-      real(0xd0ebaf65b57e000LL),real(-0x1274db255bb7800LL),
-      real(0x2970a5137d6f000LL),real(-0x30b8535f9002800LL),
+      real(0x6581767b41ffc000LL),-real(0x371ad32683bb1800LL),
+      -real(0x915b5d6cd33000LL),-real(0xbce7db3a027c800LL),
+      real(0xd0ebaf65b57e000LL),-real(0x1274db255bb7800LL),
+      real(0x2970a5137d6f000LL),-real(0x30b8535f9002800LL),
       real(0x8fa21d365c3780LL),reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^10, polynomial in n of order 13
       real(0x73aaee373e800LL),real(0x6d942f05126000LL),
-      real(-0x55d059f7fa72800LL),real(0x114ee97e0f335000LL),
-      real(-0x16053fa9ce763800LL),real(0x4d23952dbcc4000LL),
-      real(0xdda0de6f17eb800LL),real(-0xa56bf33e63ad000LL),
-      real(0x90dadc83efa800LL),real(-0xbf52dd8df9e000LL),
-      real(0x2172ab2d7549800LL),real(-0x85ae20f708f000LL),
-      real(-0x10c904999a7800LL),real(-0xae78582fbfa00LL),
+      -real(0x55d059f7fa72800LL),real(0x114ee97e0f335000LL),
+      -real(0x16053fa9ce763800LL),real(0x4d23952dbcc4000LL),
+      real(0xdda0de6f17eb800LL),-real(0xa56bf33e63ad000LL),
+      real(0x90dadc83efa800LL),-real(0xbf52dd8df9e000LL),
+      real(0x2172ab2d7549800LL),-real(0x85ae20f708f000LL),
+      -real(0x10c904999a7800LL),-real(0xae78582fbfa00LL),
       reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^9, polynomial in n of order 14
       real(0x19fde85a2f000LL),real(0x6b4aa2bef4800LL),real(0x28c46a7eab6000LL),
-      real(0x2827ed076a87800LL),real(-0x210a7394d5283000LL),
+      real(0x2827ed076a87800LL),-real(0x210a7394d5283000LL),
       real(0x72396f4bbfb2a800LL),reale(-2621LL,0xb23f88e224000LL),
       real(0x40dce91ee367d800LL),real(0x52592d2deb84b000LL),
-      real(-0x5a9bf1fdd05df800LL),real(0x10e48562d1f92000LL),
+      -real(0x5a9bf1fdd05df800LL),real(0x10e48562d1f92000LL),
       real(0x1d4b91258bb3800LL),real(0xaa81c5529799000LL),
-      real(-0x6eadf18b1729800LL),real(0xd0db43634fa080LL),
+      -real(0x6eadf18b1729800LL),real(0xd0db43634fa080LL),
       reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^8, polynomial in n of order 15
       real(0x45bda664400LL),real(0xc8c97088800LL),real(0x2a5a46b84c00LL),
       real(0xb467fe915000LL),real(0x471c8a3c15400LL),real(0x49361b74ae1800LL),
-      real(-0x3fb304ab7e4a400LL),real(0xedcc81cc3d0e000LL),
-      real(-0x1834aac92fbf9c00LL),real(0xe864613c6aba800LL),
-      real(0x759492ec34a6c00LL),real(-0xea1e49c1b0f9000LL),
+      -real(0x3fb304ab7e4a400LL),real(0xedcc81cc3d0e000LL),
+      -real(0x1834aac92fbf9c00LL),real(0xe864613c6aba800LL),
+      real(0x759492ec34a6c00LL),-real(0xea1e49c1b0f9000LL),
       real(0x5db63d617b37400LL),real(0x31083890113800LL),
-      real(-0xa60c227ea8400LL),real(-0x3b3da9a3dab180LL),
+      -real(0xa60c227ea8400LL),-real(0x3b3da9a3dab180LL),
       reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^7, polynomial in n of order 16
       real(0x6d40f58000LL),real(0x10545cac800LL),real(0x2adf04bd000LL),
       real(0x7eec6985800LL),real(0x1ba16d402000LL),real(0x7a072d7ae800LL),
       real(0x322ca20e07000LL),real(0x3657aa17207800LL),
-      real(-0x3263434d5c54000LL),real(0xcd0703e8db70800LL),
-      real(-0x17ea571d4aa2f000LL),real(0x141161dbf7ec9800LL),
-      real(-0x57d62fedaaa000LL),real(-0xce7cd449810d800LL),
-      real(0x99132fccc31b000LL),real(-0x27598ad75934800LL),
+      -real(0x3263434d5c54000LL),real(0xcd0703e8db70800LL),
+      -real(0x17ea571d4aa2f000LL),real(0x141161dbf7ec9800LL),
+      -real(0x57d62fedaaa000LL),-real(0xce7cd449810d800LL),
+      real(0x99132fccc31b000LL),-real(0x27598ad75934800LL),
       real(0x18a5cd1eccf980LL),reale(27647LL,0xec962e4d9d27dLL),
       // C4[4], coeff of eps^6, polynomial in n of order 17
       real(0x4f8563d800LL),real(0xa96c658000LL),real(0x180da872800LL),
       real(0x3b0b3acd000LL),real(0x9f94c3e7800LL),real(0x1e8177ec2000LL),
       real(0x6e3ee471c800LL),real(0x1fbe99a5b7000LL),real(0xdb641b5c91800LL),
-      real(0xfc08a38932c000LL),real(-0xfb6a7929bd39800LL),
+      real(0xfc08a38932c000LL),-real(0xfb6a7929bd39800LL),
       real(0x466e762d282a1000LL),reale(-2431LL,0x7283aad43b800LL),
-      reale(2721LL,0xe81cb8f96000LL),real(-0x4dc0eea70f08f800LL),
-      real(-0x1b9eda123c275000LL),real(0x2eba54dfb9ee5800LL),
-      real(-0xf46c321c1b54e00LL),reale(193535LL,0x781b441f4c16bLL),
+      reale(2721LL,0xe81cb8f96000LL),-real(0x4dc0eea70f08f800LL),
+      -real(0x1b9eda123c275000LL),real(0x2eba54dfb9ee5800LL),
+      -real(0xf46c321c1b54e00LL),reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^5, polynomial in n of order 18
       real(0x741543000LL),real(0xe4714b800LL),real(0x1d7c5d8000LL),
       real(0x406b2a4800LL),real(0x9671f6d000LL),real(0x17cd936d800LL),
       real(0x429614e2000LL),real(0xd3b41886800LL),real(0x31f7c0917000LL),
       real(0xf21fb6ecf800LL),real(0x6ee892beec000LL),real(0x889688d5b28800LL),
-      real(-0x944ac482b6bf000LL),real(0x2e4469f00aa71800LL),
-      real(-0x73c7760d5050a000LL),reale(2642LL,0x7d1cf3a18a800LL),
+      -real(0x944ac482b6bf000LL),real(0x2e4469f00aa71800LL),
+      -real(0x73c7760d5050a000LL),reale(2642LL,0x7d1cf3a18a800LL),
       reale(-2186LL,0x92f4aa56eb000LL),real(0x3d1b0c8706d53800LL),
-      real(-0xb7512595147fa80LL),reale(193535LL,0x781b441f4c16bLL),
+      -real(0xb7512595147fa80LL),reale(193535LL,0x781b441f4c16bLL),
       // C4[4], coeff of eps^4, polynomial in n of order 19
       real(0x6bb08e00LL),real(0xc7f67400LL),real(0x181eb1a00LL),
       real(0x30a52a000LL),real(0x673602600LL),real(0xe8536cc00LL),
       real(0x230e6ab200LL),real(0x5c19c1f800LL),real(0x10ca075be00LL),
       real(0x37f6c332400LL),real(0xdf0e61c4a00LL),real(0x47dfa8095000LL),
       real(0x236014b495600LL),real(0x2f60ae04237c00LL),
-      real(-0x38c125ca4a81e00LL),real(0x13dd33a066e0a800LL),
-      real(-0x389cd322becd1200LL),real(0x5ba892ca8a3fd400LL),
-      real(-0x4c61cfa8c88a8600LL),real(0x18d2fd16dac69ec0LL),
+      -real(0x38c125ca4a81e00LL),real(0x13dd33a066e0a800LL),
+      -real(0x389cd322becd1200LL),real(0x5ba892ca8a3fd400LL),
+      -real(0x4c61cfa8c88a8600LL),real(0x18d2fd16dac69ec0LL),
       reale(193535LL,0x781b441f4c16bLL),
       // C4[5], coeff of eps^23, polynomial in n of order 0
       real(0xe17e80LL),real(0xd190230980fLL),
       // C4[5], coeff of eps^22, polynomial in n of order 1
-      real(-0x63fa000LL),real(0x259cf00LL),real(0x62c2748ec71LL),
+      -real(0x63fa000LL),real(0x259cf00LL),real(0x62c2748ec71LL),
       // C4[5], coeff of eps^21, polynomial in n of order 2
-      real(-0xa82231000LL),real(0x12ebf1800LL),real(0x5cce6880LL),
+      -real(0xa82231000LL),real(0x12ebf1800LL),real(0x5cce6880LL),
       real(0x4f869592664b5LL),
       // C4[5], coeff of eps^20, polynomial in n of order 3
-      real(-0xecd417f0000LL),real(0x4df40da0000LL),real(-0x78cb3050000LL),
+      -real(0xecd417f0000LL),real(0x4df40da0000LL),-real(0x78cb3050000LL),
       real(0x28d58610800LL),real(0x5263fcf5c8de3f7LL),
       // C4[5], coeff of eps^19, polynomial in n of order 4
-      real(-0xf4977948ac000LL),real(0xfebd5b2ac3000LL),
-      real(-0xf90c852576000LL),real(0x1257a8b1e1000LL),real(0x5e1a6b95fb00LL),
+      -real(0xf4977948ac000LL),real(0xfebd5b2ac3000LL),
+      -real(0xf90c852576000LL),real(0x1257a8b1e1000LL),real(0x5e1a6b95fb00LL),
       reale(21503LL,0xf0e695ca96ad3LL),
       // C4[5], coeff of eps^18, polynomial in n of order 5
-      real(-0x25dd48c154000LL),real(0x596953f850000LL),
-      real(-0x2b40cdd44c000LL),real(0x104815a268000LL),
-      real(-0x1ab27f0a04000LL),real(0x7e701f145600LL),
+      -real(0x25dd48c154000LL),real(0x596953f850000LL),
+      -real(0x2b40cdd44c000LL),real(0x104815a268000LL),
+      -real(0x1ab27f0a04000LL),real(0x7e701f145600LL),
       reale(3071LL,0xfdd7cc41833d5LL),
       // C4[5], coeff of eps^17, polynomial in n of order 6
-      real(-0x4776cd8c606000LL),real(0x6d8a47bfe9f000LL),
-      real(-0x187da0ea944000LL),real(0x2b758d37739000LL),
-      real(-0x22fd5e6d302000LL),real(0x107133def3000LL),real(0x56ef801cd100LL),
+      -real(0x4776cd8c606000LL),real(0x6d8a47bfe9f000LL),
+      -real(0x187da0ea944000LL),real(0x2b758d37739000LL),
+      -real(0x22fd5e6d302000LL),real(0x107133def3000LL),real(0x56ef801cd100LL),
       reale(33791LL,0xe845c6d0a3a27LL),
       // C4[5], coeff of eps^16, polynomial in n of order 7
-      real(-0x6b41dfbb0208000LL),real(0x3281e67a9bd0000LL),
-      real(-0x11e76a3ab618000LL),real(0x2fa8791e0ae0000LL),
-      real(-0xef00faafea8000LL),real(0x82642584ff0000LL),
-      real(-0xce6c8b206b8000LL),real(0x33a2c6e1f0cc00LL),
+      -real(0x6b41dfbb0208000LL),real(0x3281e67a9bd0000LL),
+      -real(0x11e76a3ab618000LL),real(0x2fa8791e0ae0000LL),
+      -real(0xef00faafea8000LL),real(0x82642584ff0000LL),
+      -real(0xce6c8b206b8000LL),real(0x33a2c6e1f0cc00LL),
       reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^15, polynomial in n of order 8
-      real(-0xd8a9f7e5e7f8000LL),real(0x75ff062faeb000LL),
-      real(-0x57d41a79bb5a000LL),real(0x470a22b15ed1000LL),
-      real(-0x941305430fc000LL),real(0x2571b5b524d7000LL),
-      real(-0x15ee8622281e000LL),real(-0x810fd11a43000LL),
-      real(-0x3b143f8fcc100LL),reale(236543LL,0x59e86fb479711LL),
+      -real(0xd8a9f7e5e7f8000LL),real(0x75ff062faeb000LL),
+      -real(0x57d41a79bb5a000LL),real(0x470a22b15ed1000LL),
+      -real(0x941305430fc000LL),real(0x2571b5b524d7000LL),
+      -real(0x15ee8622281e000LL),-real(0x810fd11a43000LL),
+      -real(0x3b143f8fcc100LL),reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^14, polynomial in n of order 9
-      real(-0x11e2c065bec000LL),real(0x1160c7104de0000LL),
-      real(-0x2505ead2add4000LL),real(0x375d7cf9da8000LL),
-      real(-0x7d85d31b2fc000LL),real(0xc6e2597bcf0000LL),
-      real(-0x1c3d1fca5e4000LL),real(0x26eff911138000LL),
-      real(-0x32d040ac10c000LL),real(0xa3358a5620200LL),
+      -real(0x11e2c065bec000LL),real(0x1160c7104de0000LL),
+      -real(0x2505ead2add4000LL),real(0x375d7cf9da8000LL),
+      -real(0x7d85d31b2fc000LL),real(0xc6e2597bcf0000LL),
+      -real(0x1c3d1fca5e4000LL),real(0x26eff911138000LL),
+      -real(0x32d040ac10c000LL),real(0xa3358a5620200LL),
       reale(33791LL,0xe845c6d0a3a27LL),
       // C4[5], coeff of eps^13, polynomial in n of order 10
-      real(-0x4e0fa2600780a000LL),real(0x4e911c6aabd6b000LL),
-      real(-0x693532675088000LL),real(0x218ccc46e845000LL),
-      real(-0x117da33185e06000LL),real(0x4517905378bf000LL),
-      real(-0x10ba1c1d3344000LL),real(0x5399b73b0419000LL),
-      real(-0x1d57ddd62302000LL),real(-0x2b67cba006d000LL),
-      real(-0x17851f6bed3f00LL),reale(236543LL,0x59e86fb479711LL),
+      -real(0x4e0fa2600780a000LL),real(0x4e911c6aabd6b000LL),
+      -real(0x693532675088000LL),real(0x218ccc46e845000LL),
+      -real(0x117da33185e06000LL),real(0x4517905378bf000LL),
+      -real(0x10ba1c1d3344000LL),real(0x5399b73b0419000LL),
+      -real(0x1d57ddd62302000LL),-real(0x2b67cba006d000LL),
+      -real(0x17851f6bed3f00LL),reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^12, polynomial in n of order 11
-      reale(2256LL,0x5da9961330000LL),real(-0x4ad304d1312a0000LL),
-      real(-0x4061e93f2b8f0000LL),real(0x5b0abf1dff380000LL),
-      real(-0x11e106d1afa10000LL),real(-0x36aeeaeb6e60000LL),
-      real(-0xfcdce3949630000LL),real(0x8af39fd661c0000LL),
+      reale(2256LL,0x5da9961330000LL),-real(0x4ad304d1312a0000LL),
+      -real(0x4061e93f2b8f0000LL),real(0x5b0abf1dff380000LL),
+      -real(0x11e106d1afa10000LL),-real(0x36aeeaeb6e60000LL),
+      -real(0xfcdce3949630000LL),real(0x8af39fd661c0000LL),
       real(0x3d8b99e8cb0000LL),real(0x2f252d98fde0000LL),
-      real(-0x29a890537770000LL),real(0x62af9738c95800LL),
+      -real(0x29a890537770000LL),real(0x62af9738c95800LL),
       reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^11, polynomial in n of order 12
-      real(0x2c14f5cef5da000LL),real(-0xb44f7f3a7637800LL),
-      real(0x144dd8529649b000LL),real(-0xdf6b3f6a9dda800LL),
-      real(-0x611b67a2b3c4000LL),real(0xe4e2f0fafbb2800LL),
-      real(-0x51c03e2adea3000LL),real(-0xd7c7b9cb0f0800LL),
-      real(-0x16096a592762000LL),real(0x1c9393e7a4dc800LL),
-      real(-0x381de14f961000LL),real(-0xdc6f16ca46800LL),
-      real(-0xd4311572ebf80LL),reale(33791LL,0xe845c6d0a3a27LL),
+      real(0x2c14f5cef5da000LL),-real(0xb44f7f3a7637800LL),
+      real(0x144dd8529649b000LL),-real(0xdf6b3f6a9dda800LL),
+      -real(0x611b67a2b3c4000LL),real(0xe4e2f0fafbb2800LL),
+      -real(0x51c03e2adea3000LL),-real(0xd7c7b9cb0f0800LL),
+      -real(0x16096a592762000LL),real(0x1c9393e7a4dc800LL),
+      -real(0x381de14f961000LL),-real(0xdc6f16ca46800LL),
+      -real(0xd4311572ebf80LL),reale(33791LL,0xe845c6d0a3a27LL),
       // C4[5], coeff of eps^10, polynomial in n of order 13
-      real(-0x1f7df788da000LL),real(-0x249f1260a08000LL),
-      real(0x2485dbf6336a000LL),real(-0x9fd55d1961bc000LL),
-      real(0x13ee6db114d4e000LL),real(-0x114ab28a688b0000LL),
-      real(-0x1759d6f434ee000LL),real(0xe5435dae775c000LL),
-      real(-0x883ae4654d0a000LL),real(0x6d085594a8000LL),
-      real(-0x3b594ff4c6000LL),real(0x18b250a1c574000LL),
-      real(-0xc2af3f725e2000LL),real(0x11b5d0e5824b00LL),
+      -real(0x1f7df788da000LL),-real(0x249f1260a08000LL),
+      real(0x2485dbf6336a000LL),-real(0x9fd55d1961bc000LL),
+      real(0x13ee6db114d4e000LL),-real(0x114ab28a688b0000LL),
+      -real(0x1759d6f434ee000LL),real(0xe5435dae775c000LL),
+      -real(0x883ae4654d0a000LL),real(0x6d085594a8000LL),
+      -real(0x3b594ff4c6000LL),real(0x18b250a1c574000LL),
+      -real(0xc2af3f725e2000LL),real(0x11b5d0e5824b00LL),
       reale(33791LL,0xe845c6d0a3a27LL),
       // C4[5], coeff of eps^9, polynomial in n of order 14
-      real(-0x45be4df1f000LL),real(-0x154928d5d8800LL),
-      real(-0x9c093f54d6000LL),real(-0xbe1dac855c3800LL),
-      real(0xc8c35d9371b3000LL),real(-0x3b27b3be7f71e800LL),
+      -real(0x45be4df1f000LL),-real(0x154928d5d8800LL),
+      -real(0x9c093f54d6000LL),-real(0xbe1dac855c3800LL),
+      real(0xc8c35d9371b3000LL),-real(0x3b27b3be7f71e800LL),
       reale(2105LL,0xa27ce5e51c000LL),reale(-2267LL,0xddae18aab6800LL),
       real(0x215c4ca42d605000LL),real(0x52b0fbc40a45b800LL),
-      real(-0x52abb6acf6af2000LL),real(0x14cab8bdb5a70800LL),
+      -real(0x52abb6acf6af2000LL),real(0x14cab8bdb5a70800LL),
       real(0x422bb90412d7000LL),real(0xaa8f3f42195800LL),
-      real(-0x18c864fb5207380LL),reale(236543LL,0x59e86fb479711LL),
+      -real(0x18c864fb5207380LL),reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^8, polynomial in n of order 15
-      real(-0x323b5354000LL),real(-0xa77c1e58000LL),real(-0x297150a3c000LL),
-      real(-0xd25b36ef0000LL),real(-0x64c6f9d464000LL),
-      real(-0x816d981c288000LL),real(0x91bbe6aceeb4000LL),
-      real(-0x2ea0d03ef98a0000LL),real(0x748c356a9df8c000LL),
+      -real(0x323b5354000LL),-real(0xa77c1e58000LL),-real(0x297150a3c000LL),
+      -real(0xd25b36ef0000LL),-real(0x64c6f9d464000LL),
+      -real(0x816d981c288000LL),real(0x91bbe6aceeb4000LL),
+      -real(0x2ea0d03ef98a0000LL),real(0x748c356a9df8c000LL),
       reale(-2464LL,0xbb08388f48000LL),real(0x55038197b9ea4000LL),
-      real(0x24c2f502435b0000LL),real(-0x557a28e333384000LL),
-      real(0x319d6c472db18000LL),real(-0xa981b88bf66c000LL),
+      real(0x24c2f502435b0000LL),-real(0x557a28e333384000LL),
+      real(0x319d6c472db18000LL),-real(0xa981b88bf66c000LL),
       real(0x2452a78bb4ce00LL),reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^7, polynomial in n of order 16
-      real(-0x6982d8000LL),real(-0x1200880800LL),real(-0x367aead000LL),
-      real(-0xbc0ef21800LL),real(-0x306255a2000LL),real(-0x100b9fcf2800LL),
-      real(-0x8171cf3d7000LL),real(-0xb08a440213800LL),
-      real(0xd5be3a4ba94000LL),real(-0x4af12ff99ea4800LL),
-      real(0xd4237986197f000LL),real(-0x15530c89262c5800LL),
-      real(0x12c48ba350cca000LL),real(-0x590f07b7ee96800LL),
-      real(-0x53e376c2a7ab000LL),real(0x5b3d559eedc8800LL),
-      real(-0x1b37127cacfe280LL),reale(33791LL,0xe845c6d0a3a27LL),
+      -real(0x6982d8000LL),-real(0x1200880800LL),-real(0x367aead000LL),
+      -real(0xbc0ef21800LL),-real(0x306255a2000LL),-real(0x100b9fcf2800LL),
+      -real(0x8171cf3d7000LL),-real(0xb08a440213800LL),
+      real(0xd5be3a4ba94000LL),-real(0x4af12ff99ea4800LL),
+      real(0xd4237986197f000LL),-real(0x15530c89262c5800LL),
+      real(0x12c48ba350cca000LL),-real(0x590f07b7ee96800LL),
+      -real(0x53e376c2a7ab000LL),real(0x5b3d559eedc8800LL),
+      -real(0x1b37127cacfe280LL),reale(33791LL,0xe845c6d0a3a27LL),
       // C4[5], coeff of eps^6, polynomial in n of order 17
-      real(-0x287496000LL),real(-0x615720000LL),real(-0xfbb32a000LL),
-      real(-0x2c5b51c000LL),real(-0x8b2715e000LL),real(-0x1f40dc58000LL),
-      real(-0x869fe272000LL),real(-0x2f027b014000LL),real(-0x19275e39a6000LL),
-      real(-0x24c57351390000LL),real(0x305c8c1f55c6000LL),
-      real(-0x12c56d86cea0c000LL),real(0x3c958c9a69892000LL),
-      real(-0x75427b7d716c8000LL),reale(2264LL,0x2021045b7e000LL),
-      real(-0x686da1b1a7d04000LL),real(0x2b2226f5e6b4a000LL),
-      real(-0x7a36190e0daa700LL),reale(236543LL,0x59e86fb479711LL),
+      -real(0x287496000LL),-real(0x615720000LL),-real(0xfbb32a000LL),
+      -real(0x2c5b51c000LL),-real(0x8b2715e000LL),-real(0x1f40dc58000LL),
+      -real(0x869fe272000LL),-real(0x2f027b014000LL),-real(0x19275e39a6000LL),
+      -real(0x24c57351390000LL),real(0x305c8c1f55c6000LL),
+      -real(0x12c56d86cea0c000LL),real(0x3c958c9a69892000LL),
+      -real(0x75427b7d716c8000LL),reale(2264LL,0x2021045b7e000LL),
+      -real(0x686da1b1a7d04000LL),real(0x2b2226f5e6b4a000LL),
+      -real(0x7a36190e0daa700LL),reale(236543LL,0x59e86fb479711LL),
       // C4[5], coeff of eps^5, polynomial in n of order 18
-      real(-0x176bb000LL),real(-0x339cb800LL),real(-0x78298000LL),
-      real(-0x12a324800LL),real(-0x31dd75000LL),real(-0x92088d800LL),
-      real(-0x1dded72000LL),real(-0x7091426800LL),real(-0x1ffab8af000LL),
-      real(-0xbdf5200f800LL),real(-0x6d0cb854c000LL),real(-0xacf22c5668800LL),
-      real(0xfa276dd8697000LL),real(-0x6c92e41ed151800LL),
-      real(0x18f8d3300c4da000LL),real(-0x382fdb2c1baea800LL),
-      real(0x4f13f21826f5d000LL),real(-0x3d1b0c8706d53800LL),
+      -real(0x176bb000LL),-real(0x339cb800LL),-real(0x78298000LL),
+      -real(0x12a324800LL),-real(0x31dd75000LL),-real(0x92088d800LL),
+      -real(0x1dded72000LL),-real(0x7091426800LL),-real(0x1ffab8af000LL),
+      -real(0xbdf5200f800LL),-real(0x6d0cb854c000LL),-real(0xacf22c5668800LL),
+      real(0xfa276dd8697000LL),-real(0x6c92e41ed151800LL),
+      real(0x18f8d3300c4da000LL),-real(0x382fdb2c1baea800LL),
+      real(0x4f13f21826f5d000LL),-real(0x3d1b0c8706d53800LL),
       real(0x131873ea3222a180LL),reale(236543LL,0x59e86fb479711LL),
       // C4[6], coeff of eps^23, polynomial in n of order 0
       real(0x1316c00LL),real(0x45dab658805LL),
       // C4[6], coeff of eps^22, polynomial in n of order 1
       real(0x2e25f5000LL),real(0xf2951a00LL),real(0x1b45118f2c973bLL),
       // C4[6], coeff of eps^21, polynomial in n of order 2
-      real(0x1946d60000LL),real(-0x2993250000LL),real(0xc21a91000LL),
+      real(0x1946d60000LL),-real(0x2993250000LL),real(0xc21a91000LL),
       real(0x22cae1700cc0f3LL),
       // C4[6], coeff of eps^20, polynomial in n of order 3
-      real(0x94a2566a8000LL),real(-0x7736ce990000LL),real(0x345f5a38000LL),
+      real(0x94a2566a8000LL),-real(0x7736ce990000LL),real(0x345f5a38000LL),
       real(0x11f45dc9000LL),real(0x36c560e36413be89LL),
       // C4[6], coeff of eps^19, polynomial in n of order 4
-      real(0x5a0e4ebdc0000LL),real(-0x1d4e9158b0000LL),real(0xfe56696e0000LL),
-      real(-0x195347b590000LL),real(0x66855efe5000LL),
+      real(0x5a0e4ebdc0000LL),-real(0x1d4e9158b0000LL),real(0xfe56696e0000LL),
+      -real(0x195347b590000LL),real(0x66855efe5000LL),
       reale(3630LL,0x89164e7bf8313LL),
       // C4[6], coeff of eps^18, polynomial in n of order 5
-      real(0x588efe4c176000LL),real(-0xcc317e9b08000LL),
-      real(0x2e65271667a000LL),real(-0x1cb46908f84000LL),
-      real(-0x7bc8d2682000LL),real(-0x36524dd3a400LL),
+      real(0x588efe4c176000LL),-real(0xcc317e9b08000LL),
+      real(0x2e65271667a000LL),-real(0x1cb46908f84000LL),
+      -real(0x7bc8d2682000LL),-real(0x36524dd3a400LL),
       reale(39935LL,0xe3f55f53aa1d1LL),
       // C4[6], coeff of eps^17, polynomial in n of order 6
-      real(0x2dbd6ef2050000LL),real(-0x356ee7ee5e8000LL),
-      real(0x65e2c9482e0000LL),real(-0x1247a684858000LL),
-      real(0x13c46949570000LL),real(-0x1b548eba6c8000LL),
+      real(0x2dbd6ef2050000LL),-real(0x356ee7ee5e8000LL),
+      real(0x65e2c9482e0000LL),-real(0x1247a684858000LL),
+      real(0x13c46949570000LL),-real(0x1b548eba6c8000LL),
       real(0x5c900466be800LL),reale(39935LL,0xe3f55f53aa1d1LL),
       // C4[6], coeff of eps^16, polynomial in n of order 7
-      real(-0x3fff5b5aa54000LL),real(-0x6a2cbaeaf348000LL),
-      real(0x2b55e8782dc4000LL),real(-0x69f22faba30000LL),
-      real(0x26e11f54b9dc000LL),real(-0x105d41b83118000LL),
-      real(-0x12eb1ab4e0c000LL),real(-0x9530f9646a800LL),
+      -real(0x3fff5b5aa54000LL),-real(0x6a2cbaeaf348000LL),
+      real(0x2b55e8782dc4000LL),-real(0x69f22faba30000LL),
+      real(0x26e11f54b9dc000LL),-real(0x105d41b83118000LL),
+      -real(0x12eb1ab4e0c000LL),-real(0x9530f9646a800LL),
       reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^15, polynomial in n of order 8
-      real(0xf488f4012440000LL),real(-0xb16a4f02dfc8000LL),
-      real(-0x103bba4a90d0000LL),real(-0x4da08c72a3d8000LL),
-      real(0x45a11acaf220000LL),real(-0x25f21bc63e8000LL),
-      real(0x12fccd9d4510000LL),real(-0x13e0eb3687f8000LL),
+      real(0xf488f4012440000LL),-real(0xb16a4f02dfc8000LL),
+      -real(0x103bba4a90d0000LL),-real(0x4da08c72a3d8000LL),
+      real(0x45a11acaf220000LL),-real(0x25f21bc63e8000LL),
+      real(0x12fccd9d4510000LL),-real(0x13e0eb3687f8000LL),
       real(0x356c2e9517d800LL),reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^14, polynomial in n of order 9
       real(0x28c5c3199aad2000LL),real(0x80d5fb17a810000LL),
-      real(0x9c623a70694e000LL),real(-0xf23c0600f3f4000LL),
-      real(0x6928769f1ca000LL),real(-0x1e8f96869bf8000LL),
-      real(0x4f9253e0b846000LL),real(-0x11e4e806cbfc000LL),
-      real(-0x2dad19c0f3e000LL),real(-0x1f2fac1e88dc00LL),
+      real(0x9c623a70694e000LL),-real(0xf23c0600f3f4000LL),
+      real(0x6928769f1ca000LL),-real(0x1e8f96869bf8000LL),
+      real(0x4f9253e0b846000LL),-real(0x11e4e806cbfc000LL),
+      -real(0x2dad19c0f3e000LL),-real(0x1f2fac1e88dc00LL),
       reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^13, polynomial in n of order 10
-      real(-0xdb139b99ca0000LL),real(-0x5dbaf74a92790000LL),
+      -real(0xdb139b99ca0000LL),-real(0x5dbaf74a92790000LL),
       real(0x3b504b033ef80000LL),real(0x39f346109690000LL),
-      real(0x1c11de49bba0000LL),real(-0x10aa5a9917350000LL),
+      real(0x1c11de49bba0000LL),-real(0x10aa5a9917350000LL),
       real(0x49bc5039b7c0000LL),real(0x92ae304aad0000LL),
-      real(0x32f3e8ddd3e0000LL),real(-0x233311e51f10000LL),
+      real(0x32f3e8ddd3e0000LL),-real(0x233311e51f10000LL),
       real(0x4483a6a16dd000LL),reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^12, polynomial in n of order 11
-      real(-0xfbf5c5edd078000LL),real(0x1202fde81d5f0000LL),
-      real(-0x454a07e84fa8000LL),real(-0xbd470dafdb40000LL),
-      real(0xb3ba7d182928000LL),real(-0x155dacd6cc70000LL),
-      real(-0xdc21a82d608000LL),real(-0x1d2df304ada0000LL),
-      real(0x167a9a9742c8000LL),real(-0x7d81f52ed0000LL),
-      real(-0x7ffde3fc68000LL),real(-0xe287c62fa3000LL),
+      -real(0xfbf5c5edd078000LL),real(0x1202fde81d5f0000LL),
+      -real(0x454a07e84fa8000LL),-real(0xbd470dafdb40000LL),
+      real(0xb3ba7d182928000LL),-real(0x155dacd6cc70000LL),
+      -real(0xdc21a82d608000LL),-real(0x1d2df304ada0000LL),
+      real(0x167a9a9742c8000LL),-real(0x7d81f52ed0000LL),
+      -real(0x7ffde3fc68000LL),-real(0xe287c62fa3000LL),
       reale(39935LL,0xe3f55f53aa1d1LL),
       // C4[6], coeff of eps^11, polynomial in n of order 12
-      real(-0x108032160840000LL),real(0x5885fb25bf70000LL),
-      real(-0xe5dec7019ee0000LL),real(0x13305b31e4ed0000LL),
-      real(-0x9278e6008580000LL),real(-0x855a0cffe9d0000LL),
-      real(0xd3d848f453e0000LL),real(-0x4a9f485fda70000LL),
-      real(-0xfb7b0fc02c0000LL),real(-0x691c2e87310000LL),
-      real(0x177c9a6d86a0000LL),real(-0x9585db4a3b0000LL),
+      -real(0x108032160840000LL),real(0x5885fb25bf70000LL),
+      -real(0xe5dec7019ee0000LL),real(0x13305b31e4ed0000LL),
+      -real(0x9278e6008580000LL),-real(0x855a0cffe9d0000LL),
+      real(0xd3d848f453e0000LL),-real(0x4a9f485fda70000LL),
+      -real(0xfb7b0fc02c0000LL),-real(0x691c2e87310000LL),
+      real(0x177c9a6d86a0000LL),-real(0x9585db4a3b0000LL),
       real(0xa77dc54c8f000LL),reale(39935LL,0xe3f55f53aa1d1LL),
       // C4[6], coeff of eps^10, polynomial in n of order 13
-      real(0x6d0001099000LL),real(0x9a74d7ec5c000LL),real(-0xc18676170e1000LL),
-      real(0x45ad31c7f8a2000LL),real(-0xc7369375e55b000LL),
-      real(0x1364b97f822e8000LL),real(-0xe19539447ad5000LL),
-      real(-0x26bf9b041ad2000LL),real(0xce71cc8200b1000LL),
-      real(-0x8c822446468c000LL),real(0x12e554ec5f37000LL),
+      real(0x6d0001099000LL),real(0x9a74d7ec5c000LL),-real(0xc18676170e1000LL),
+      real(0x45ad31c7f8a2000LL),-real(0xc7369375e55b000LL),
+      real(0x1364b97f822e8000LL),-real(0xe19539447ad5000LL),
+      -real(0x26bf9b041ad2000LL),real(0xce71cc8200b1000LL),
+      -real(0x8c822446468c000LL),real(0x12e554ec5f37000LL),
       real(0xa6c4f3e59ba000LL),real(0x30bb36a52bd000LL),
-      real(-0x34440d2d335600LL),reale(39935LL,0xe3f55f53aa1d1LL),
+      -real(0x34440d2d335600LL),reale(39935LL,0xe3f55f53aa1d1LL),
       // C4[6], coeff of eps^9, polynomial in n of order 14
       real(0x8fcb3bf8000LL),real(0x33bb5d994000LL),real(0x1c6cd111b0000LL),
-      real(0x2a77da91fcc000LL),real(-0x38ac5a4a0098000LL),
-      real(0x160f7571fbc04000LL),real(-0x45e92df7f7ee0000LL),
-      real(0x7f01d3c372a3c000LL),real(-0x7edcf27daed28000LL),
+      real(0x2a77da91fcc000LL),-real(0x38ac5a4a0098000LL),
+      real(0x160f7571fbc04000LL),-real(0x45e92df7f7ee0000LL),
+      real(0x7f01d3c372a3c000LL),-real(0x7edcf27daed28000LL),
       real(0x27dfe4585e674000LL),real(0x38a548f303090000LL),
-      real(-0x4b87231069354000LL),real(0x24d2adef05648000LL),
-      real(-0x6a5625dbc71c000LL),real(-0x18371a5d233400LL),
+      -real(0x4b87231069354000LL),real(0x24d2adef05648000LL),
+      -real(0x6a5625dbc71c000LL),-real(0x18371a5d233400LL),
       reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^8, polynomial in n of order 15
       real(0x3bee10e000LL),real(0xe6dcd7c000LL),real(0x42cbc6ea000LL),
       real(0x1923069d8000LL),real(0xe8a206ec6000LL),real(0x170dd449e34000LL),
-      real(-0x2102346c3b5e000LL),real(0xe0052eca6690000LL),
-      real(-0x318a0eacb0b82000LL),real(0x690a1407d3eec000LL),
+      -real(0x2102346c3b5e000LL),real(0xe0052eca6690000LL),
+      -real(0x318a0eacb0b82000LL),real(0x690a1407d3eec000LL),
       reale(-2183LL,0x49fe19ea5a000LL),real(0x61bf435eea348000LL),
-      real(-0xe133a8622dca000LL),real(-0x2748b26bf705c000LL),
-      real(0x220d7d12f9812000LL),real(-0x98dbd66bee38400LL),
+      -real(0xe133a8622dca000LL),-real(0x2748b26bf705c000LL),
+      real(0x220d7d12f9812000LL),-real(0x98dbd66bee38400LL),
       reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[6], coeff of eps^7, polynomial in n of order 16
       real(0x9a2c0000LL),real(0x1df854000LL),real(0x684c68000LL),
       real(0x1a2757c000LL),real(0x7eb6a10000LL),real(0x3232f0a4000LL),
-      real(0x1ec960fb8000LL),real(0x3439f07dcc000LL),real(-0x50f0148aea0000LL),
-      real(0x25bf6de530f4000LL),real(-0x9635a567bcf8000LL),
-      real(0x1735ee17e1e1c000LL),real(-0x25a38fef60750000LL),
-      real(0x2834884b55944000LL),real(-0x1b3dfda8c79a8000LL),
-      real(0xa981b88bf66c000LL),real(-0x1cc16f4e99cdc00LL),
+      real(0x1ec960fb8000LL),real(0x3439f07dcc000LL),-real(0x50f0148aea0000LL),
+      real(0x25bf6de530f4000LL),-real(0x9635a567bcf8000LL),
+      real(0x1735ee17e1e1c000LL),-real(0x25a38fef60750000LL),
+      real(0x2834884b55944000LL),-real(0x1b3dfda8c79a8000LL),
+      real(0xa981b88bf66c000LL),-real(0x1cc16f4e99cdc00LL),
       reale(93183LL,0xbe91de6de243dLL),
       // C4[6], coeff of eps^6, polynomial in n of order 17
       real(0xa16f000LL),real(0x1b5f0000LL),real(0x50671000LL),
       real(0x103c32000LL),real(0x3aee73000LL),real(0xf7d074000LL),
       real(0x4f19f75000LL),real(0x214230b6000LL),real(0x15d36ff77000LL),
-      real(0x2803a29af8000LL),real(-0x43d629aab87000LL),
-      real(0x232131018d3a000LL),real(-0x9e155c86fb85000LL),
-      real(0x1c3aabf38857c000LL),real(-0x361b1ee81aa83000LL),
-      real(0x44dcb2f8dc1be000LL),real(-0x325282c98d281000LL),
+      real(0x2803a29af8000LL),-real(0x43d629aab87000LL),
+      real(0x232131018d3a000LL),-real(0x9e155c86fb85000LL),
+      real(0x1c3aabf38857c000LL),-real(0x361b1ee81aa83000LL),
+      real(0x44dcb2f8dc1be000LL),-real(0x325282c98d281000LL),
       real(0xf46c321c1b54e00LL),reale(279551LL,0x3bb59b49a6cb7LL),
       // C4[7], coeff of eps^23, polynomial in n of order 0
       real(0x16e04c00LL),real(0x7ee24536c1115LL),
       // C4[7], coeff of eps^22, polynomial in n of order 1
-      real(-127523LL<<20),real(0x7f04dc000LL),real(0x1f771442bd4c09LL),
+      -real(127523LL<<20),real(0x7f04dc000LL),real(0x1f771442bd4c09LL),
       // C4[7], coeff of eps^21, polynomial in n of order 2
-      real(-0x5e69ccb80000LL),real(-0x129b18c0000LL),real(-0x7e0a2d5000LL),
+      -real(0x5e69ccb80000LL),-real(0x129b18c0000LL),-real(0x7e0a2d5000LL),
       real(0x3b1ebd1165abdce9LL),
       // C4[7], coeff of eps^20, polynomial in n of order 3
-      real(-0x44bcafdLL<<20),real(0x4022926LL<<20),real(-0x5be7eafLL<<20),
+      -real(0x44bcafdLL<<20),real(0x4022926LL<<20),-real(0x5be7eafLL<<20),
       real(0x142b356fa000LL),real(0x3f32837c872a7963LL),
       // C4[7], coeff of eps^19, polynomial in n of order 4
-      real(-0x860dfb0dLL<<20),real(0x30520b04740000LL),
-      real(-0x16c930c6e80000LL),real(-0x1551cc2040000LL),
-      real(-0x9e5c3c48b000LL),reale(46079LL,0xdfa4f7d6b097bLL),
+      -real(0x860dfb0dLL<<20),real(0x30520b04740000LL),
+      -real(0x16c930c6e80000LL),-real(0x1551cc2040000LL),
+      -real(0x9e5c3c48b000LL),reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^18, polynomial in n of order 5
-      real(-0x49904931bLL<<20),real(0x587ea7004LL<<20),real(-0x713785ddLL<<20),
-      real(0x159398e02LL<<20),real(-0x19125a29fLL<<20),real(0x490d94cd2c000LL),
+      -real(0x49904931bLL<<20),real(0x587ea7004LL<<20),-real(0x713785ddLL<<20),
+      real(0x159398e02LL<<20),-real(0x19125a29fLL<<20),real(0x490d94cd2c000LL),
       reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^17, polynomial in n of order 6
-      real(-0xf7ed31ddbc0000LL),real(0x2a1cd053860000LL),
-      real(-0x15bd5c44a80000LL),real(0x58222c9a6a0000LL),
-      real(-0x1a74fbea940000LL),real(-0x33adc5ff20000LL),
-      real(-0x1e088e877c800LL),reale(46079LL,0xdfa4f7d6b097bLL),
+      -real(0xf7ed31ddbc0000LL),real(0x2a1cd053860000LL),
+      -real(0x15bd5c44a80000LL),real(0x58222c9a6a0000LL),
+      -real(0x1a74fbea940000LL),-real(0x33adc5ff20000LL),
+      -real(0x1e088e877c800LL),reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^16, polynomial in n of order 7
-      real(-0x50279d0e5080000LL),real(-0x1377536973LL<<20),
-      real(-0x5dbd91fdb180000LL),real(0x31c729210eLL<<20),
+      -real(0x50279d0e5080000LL),-real(0x1377536973LL<<20),
+      -real(0x5dbd91fdb180000LL),real(0x31c729210eLL<<20),
       real(0x29488a66580000LL),real(0x14b8aba5efLL<<20),
-      real(-0x119aee903b80000LL),real(0x28435aa5d4b000LL),
+      -real(0x119aee903b80000LL),real(0x28435aa5d4b000LL),
       reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^15, polynomial in n of order 8
       real(0x81cc8b1dcdLL<<20),real(0xfbb72a664ee0000LL),
-      real(-0xa9b81eb4ea40000LL),real(-0x1a9b4c3da160000LL),
-      real(-0x2fae19e7f980000LL),real(0x4780d431da60000LL),
-      real(-0x94b9eca98c0000LL),real(-0x26a006435e0000LL),
-      real(-0x238b221440f800LL),reale(322559LL,0x1d82c6ded425dLL),
+      -real(0xa9b81eb4ea40000LL),-real(0x1a9b4c3da160000LL),
+      -real(0x2fae19e7f980000LL),real(0x4780d431da60000LL),
+      -real(0x94b9eca98c0000LL),-real(0x26a006435e0000LL),
+      -real(0x238b221440f800LL),reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^14, polynomial in n of order 9
-      real(-0x59ec90b7ba5LL<<20),real(0x1b2e993a518LL<<20),
+      -real(0x59ec90b7ba5LL<<20),real(0x1b2e993a518LL<<20),
       real(0xb181e937d5LL<<20),real(0x848206ddd2LL<<20),
-      real(-0xf0573a4eb1LL<<20),real(0x178a3aa28cLL<<20),
+      -real(0xf0573a4eb1LL<<20),real(0x178a3aa28cLL<<20),
       real(0x54cb88cc9LL<<20),real(0x347f03cf46LL<<20),
-      real(-0x1d8e5249bdLL<<20),real(0x2fd680f7c84000LL),
+      -real(0x1d8e5249bdLL<<20),real(0x2fd680f7c84000LL),
       reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^13, polynomial in n of order 10
       real(0x565424989aa80000LL),real(0x19becd8256b40000LL),
-      real(-0x5ce84822f7eLL<<20),real(0x32b09223748c0000LL),
-      real(0x58cb61831980000LL),real(-0x21b97054d1c0000LL),
-      real(-0xe18452e77fLL<<20),real(0x73cbed27abc0000LL),
-      real(0x8bb5bd3c880000LL),real(-0xdb0f0aaec0000LL),
-      real(-0x63c3eeba719000LL),reale(322559LL,0x1d82c6ded425dLL),
+      -real(0x5ce84822f7eLL<<20),real(0x32b09223748c0000LL),
+      real(0x58cb61831980000LL),-real(0x21b97054d1c0000LL),
+      -real(0xe18452e77fLL<<20),real(0x73cbed27abc0000LL),
+      real(0x8bb5bd3c880000LL),-real(0xdb0f0aaec0000LL),
+      -real(0x63c3eeba719000LL),reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^12, polynomial in n of order 11
-      real(0x91dbaae447LL<<20),real(-0x10852008f6aLL<<20),
-      real(0xf5d2e8872dLL<<20),real(-0x19e277ff48LL<<20),
-      real(-0xba0387bf1dLL<<20),real(0xa9c28a7b5aLL<<20),
-      real(-0x1e0b075737LL<<20),real(-0x1365648a24LL<<20),
-      real(-0xc040d09c1LL<<20),real(0x157e47e59eLL<<20),
-      real(-0x731193f5bLL<<20),real(0x6042659ec2000LL),
+      real(0x91dbaae447LL<<20),-real(0x10852008f6aLL<<20),
+      real(0xf5d2e8872dLL<<20),-real(0x19e277ff48LL<<20),
+      -real(0xba0387bf1dLL<<20),real(0xa9c28a7b5aLL<<20),
+      -real(0x1e0b075737LL<<20),-real(0x1365648a24LL<<20),
+      -real(0xc040d09c1LL<<20),real(0x157e47e59eLL<<20),
+      -real(0x731193f5bLL<<20),real(0x6042659ec2000LL),
       reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^11, polynomial in n of order 12
-      real(0x4d670674dLL<<20),real(-0x212a526a59c0000LL),
-      real(0x74d620fb6d80000LL),real(-0xef8ba34c8740000LL),
-      real(0x116e3dbfd5eLL<<20),real(-0x7cf99a74ecc0000LL),
-      real(-0x6f74068a7180000LL),real(0xc30e342965c0000LL),
-      real(-0x6299996391LL<<20),real(0x2142ebd6040000LL),
+      real(0x4d670674dLL<<20),-real(0x212a526a59c0000LL),
+      real(0x74d620fb6d80000LL),-real(0xef8ba34c8740000LL),
+      real(0x116e3dbfd5eLL<<20),-real(0x7cf99a74ecc0000LL),
+      -real(0x6f74068a7180000LL),real(0xc30e342965c0000LL),
+      -real(0x6299996391LL<<20),real(0x2142ebd6040000LL),
       real(0x937704e6f80000LL),real(0x402c43bf2c0000LL),
-      real(-0x2f872ef9963000LL),reale(46079LL,0xdfa4f7d6b097bLL),
+      -real(0x2f872ef9963000LL),reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^10, polynomial in n of order 13
-      real(-0x121bdc9LL<<20),real(-0x1ef8211cLL<<20),real(0x3001ff791LL<<20),
-      real(-0x1624466f42LL<<20),real(0x55944c23ebLL<<20),
-      real(-0xc71654db68LL<<20),real(0x11c056e4d45LL<<20),
-      real(-0xdb34af9f8eLL<<20),real(0xeea56899fLL<<20),
-      real(0x9412b68a4cLL<<20),real(-0x93d752a107LL<<20),
-      real(0x3ee3b30826LL<<20),real(-0x9a03d5cadLL<<20),
-      real(-0x7382e0581c000LL),reale(46079LL,0xdfa4f7d6b097bLL),
+      -real(0x121bdc9LL<<20),-real(0x1ef8211cLL<<20),real(0x3001ff791LL<<20),
+      -real(0x1624466f42LL<<20),real(0x55944c23ebLL<<20),
+      -real(0xc71654db68LL<<20),real(0x11c056e4d45LL<<20),
+      -real(0xdb34af9f8eLL<<20),real(0xeea56899fLL<<20),
+      real(0x9412b68a4cLL<<20),-real(0x93d752a107LL<<20),
+      real(0x3ee3b30826LL<<20),-real(0x9a03d5cadLL<<20),
+      -real(0x7382e0581c000LL),reale(46079LL,0xdfa4f7d6b097bLL),
       // C4[7], coeff of eps^9, polynomial in n of order 14
-      real(-0xd7e2520000LL),real(-0x5b0edcf0000LL),real(-0x3b8edf740000LL),
-      real(-0x6befb7d790000LL),real(0xb301172bea0000LL),
-      real(-0x5978c2137030000LL),real(0x17de1f39f1080000LL),
-      real(-0x3f35c80b0f2d0000LL),real(0x6ce3ff0d91260000LL),
-      real(-0x7761d1ce42b70000LL),real(0x468057c8ed840000LL),
-      real(0x1bcb7dfb99f0000LL),real(-0x26d98474089e0000LL),
-      real(0x1d375a3e49150000LL),real(-0x7d9dd8c3269dc00LL),
+      -real(0xd7e2520000LL),-real(0x5b0edcf0000LL),-real(0x3b8edf740000LL),
+      -real(0x6befb7d790000LL),real(0xb301172bea0000LL),
+      -real(0x5978c2137030000LL),real(0x17de1f39f1080000LL),
+      -real(0x3f35c80b0f2d0000LL),real(0x6ce3ff0d91260000LL),
+      -real(0x7761d1ce42b70000LL),real(0x468057c8ed840000LL),
+      real(0x1bcb7dfb99f0000LL),-real(0x26d98474089e0000LL),
+      real(0x1d375a3e49150000LL),-real(0x7d9dd8c3269dc00LL),
       reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^8, polynomial in n of order 15
-      real(-0x2eaf40000LL),real(-0xcf0180000LL),real(-0x45b31c0000LL),
-      real(-0x1eeb47LL<<20),real(-0x156868840000LL),real(-0x29667c3c80000LL),
-      real(0x4a029719540000LL),real(-0x2867692d1aLL<<20),
-      real(0xbfc5c91f6ec0000LL),real(-0x243d93fc11780000LL),
-      real(0x4a699e0854c40000LL),real(-0x69d85e75b6dLL<<20),
-      real(0x66f7a9fb575c0000LL),real(-0x4146a01c75280000LL),
-      real(0x18371a5d23340000LL),real(-0x3f90a5347c68800LL),
+      -real(0x2eaf40000LL),-real(0xcf0180000LL),-real(0x45b31c0000LL),
+      -real(0x1eeb47LL<<20),-real(0x156868840000LL),-real(0x29667c3c80000LL),
+      real(0x4a029719540000LL),-real(0x2867692d1aLL<<20),
+      real(0xbfc5c91f6ec0000LL),-real(0x243d93fc11780000LL),
+      real(0x4a699e0854c40000LL),-real(0x69d85e75b6dLL<<20),
+      real(0x66f7a9fb575c0000LL),-real(0x4146a01c75280000LL),
+      real(0x18371a5d23340000LL),-real(0x3f90a5347c68800LL),
       reale(322559LL,0x1d82c6ded425dLL),
       // C4[7], coeff of eps^7, polynomial in n of order 16
-      real(-143LL<<20),real(-0x1f950000LL),real(-0x7df20000LL),
-      real(-0x248bf0000LL),real(-0xcf3b40000LL),real(-0x615b090000LL),
-      real(-0x47e90f60000LL),real(-0x95a9db330000LL),real(0x123032a3880000LL),
-      real(-0xaf0fe765fd0000LL),real(0x3a2548493060000LL),
-      real(-0xc8bdaa520270000LL),real(0x1e1c7325e6c40000LL),
-      real(-0x3353672f26710000LL),real(0x3c89c1e8d8020000LL),
-      real(-0x2a606e22fd9b0000LL),real(0xc94a0b2634a0400LL),
+      -real(143LL<<20),-real(0x1f950000LL),-real(0x7df20000LL),
+      -real(0x248bf0000LL),-real(0xcf3b40000LL),-real(0x615b090000LL),
+      -real(0x47e90f60000LL),-real(0x95a9db330000LL),real(0x123032a3880000LL),
+      -real(0xaf0fe765fd0000LL),real(0x3a2548493060000LL),
+      -real(0xc8bdaa520270000LL),real(0x1e1c7325e6c40000LL),
+      -real(0x3353672f26710000LL),real(0x3c89c1e8d8020000LL),
+      -real(0x2a606e22fd9b0000LL),real(0xc94a0b2634a0400LL),
       reale(322559LL,0x1d82c6ded425dLL),
       // C4[8], coeff of eps^23, polynomial in n of order 0
       real(0xecd8000LL),real(0x4f56c0c24f87LL),
       // C4[8], coeff of eps^22, polynomial in n of order 1
-      real(-0x32ad0aLL<<20),real(-0x168d9710000LL),real(0x38232f25bccb5275LL),
+      -real(0x32ad0aLL<<20),-real(0x168d9710000LL),real(0x38232f25bccb5275LL),
       // C4[8], coeff of eps^21, polynomial in n of order 2
-      real(0x932fdbLL<<20),real(-0xb7410080000LL),real(0x234f1b38000LL),
+      real(0x932fdbLL<<20),-real(0xb7410080000LL),real(0x234f1b38000LL),
       real(0x99262e0aeeff091LL),
       // C4[8], coeff of eps^20, polynomial in n of order 3
-      real(0x1558506bdd80000LL),real(-0x7a4a6b91fLL<<20),
-      real(-0xc1fc716b80000LL),real(-0x6677b4e9b0000LL),
+      real(0x1558506bdd80000LL),-real(0x7a4a6b91fLL<<20),
+      -real(0xc1fc716b80000LL),-real(0x6677b4e9b0000LL),
       reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^19, polynomial in n of order 4
-      real(0x1f4bce9766LL<<20),real(-0x5fdd5e580000LL),real(0xa3f440b43LL<<20),
-      real(-0x9fca1971c80000LL),real(0x195ba7c1ef8000LL),
+      real(0x1f4bce9766LL<<20),-real(0x5fdd5e580000LL),real(0xa3f440b43LL<<20),
+      -real(0x9fca1971c80000LL),real(0x195ba7c1ef8000LL),
       reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^18, polynomial in n of order 5
-      real(-0x1a16956LL<<20),real(-0x227092628LL<<20),real(0x53eaa5526LL<<20),
-      real(-0x1172940b4LL<<20),real(-0x3268c87eLL<<20),
-      real(-0x23cc4ec070000LL),reale(52223LL,0xdb549059b7125LL),
+      -real(0x1a16956LL<<20),-real(0x227092628LL<<20),real(0x53eaa5526LL<<20),
+      -real(0x1172940b4LL<<20),-real(0x3268c87eLL<<20),
+      -real(0x23cc4ec070000LL),reale(52223LL,0xdb549059b7125LL),
       // C4[8], coeff of eps^17, polynomial in n of order 6
-      real(-0x6472fe3LL<<20),real(-0xe3d4e1d7080000LL),real(0x46aa4c61eLL<<20),
+      -real(0x6472fe3LL<<20),-real(0xe3d4e1d7080000LL),real(0x46aa4c61eLL<<20),
       real(0x916a2a5c80000LL),real(0x3227324dfLL<<20),
-      real(-0x236ac124680000LL),real(0x45bace6718000LL),
+      -real(0x236ac124680000LL),real(0x45bace6718000LL),
       reale(52223LL,0xdb549059b7125LL),
       // C4[8], coeff of eps^16, polynomial in n of order 7
-      real(0x1200bdf8116c0000LL),real(-0x5ba1b11ae080000LL),
-      real(-0x23e6c3f55fc0000LL),real(-0x3e50001d0bLL<<20),
-      real(0x3d5fd0e699c0000LL),real(-0x31f0d677580000LL),
-      real(-0x1b9c6065cc0000LL),real(-0x25c0cef2988000LL),
+      real(0x1200bdf8116c0000LL),-real(0x5ba1b11ae080000LL),
+      -real(0x23e6c3f55fc0000LL),-real(0x3e50001d0bLL<<20),
+      real(0x3d5fd0e699c0000LL),-real(0x31f0d677580000LL),
+      -real(0x1b9c6065cc0000LL),-real(0x25c0cef2988000LL),
       reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^15, polynomial in n of order 8
       real(0x392e4b99f4LL<<20),real(0x9d011c37ef80000LL),
-      real(0xd34e66de87LL<<20),real(-0xc0a473ee4980000LL),
-      real(-0xa24391f86LL<<20),real(-0x2950151b280000LL),
-      real(0x3428e530adLL<<20),real(-0x18bf1d836b80000LL),
+      real(0xd34e66de87LL<<20),-real(0xc0a473ee4980000LL),
+      -real(0xa24391f86LL<<20),-real(0x2950151b280000LL),
+      real(0x3428e530adLL<<20),-real(0x18bf1d836b80000LL),
       real(0x216a7bfadc8000LL),reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^14, polynomial in n of order 9
-      real(0x8ddebe343aLL<<20),real(-0xc011c31e9LL<<24),
+      real(0x8ddebe343aLL<<20),-real(0xc011c31e9LL<<24),
       real(0x3ab0cb9fe6LL<<20),real(0x1a9916d434LL<<20),
-      real(0x60678eb72LL<<20),real(-0x1ff9f88048LL<<20),
+      real(0x60678eb72LL<<20),-real(0x1ff9f88048LL<<20),
       real(0xb64aaec9eLL<<20),real(0x224f2ebbcLL<<20),real(0x3674d12aLL<<20),
-      real(-0xde9c5a4230000LL),reale(52223LL,0xdb549059b7125LL),
+      -real(0xde9c5a4230000LL),reale(52223LL,0xdb549059b7125LL),
       // C4[8], coeff of eps^13, polynomial in n of order 10
-      real(-0x71eca5b57e5LL<<20),real(0x46cc55ae2a580000LL),
-      real(0x1cee45fc03cLL<<20),real(-0x5663e4f0ecd80000LL),
-      real(0x35a7c7b51ddLL<<20),real(-0x974f15cf080000LL),
-      real(-0x7645cd0962LL<<20),real(-0x6f217f1c2380000LL),
-      real(0x8684ad181fLL<<20),real(-0x26e1e6e8c680000LL),
+      -real(0x71eca5b57e5LL<<20),real(0x46cc55ae2a580000LL),
+      real(0x1cee45fc03cLL<<20),-real(0x5663e4f0ecd80000LL),
+      real(0x35a7c7b51ddLL<<20),-real(0x974f15cf080000LL),
+      -real(0x7645cd0962LL<<20),-real(0x6f217f1c2380000LL),
+      real(0x8684ad181fLL<<20),-real(0x26e1e6e8c680000LL),
       real(0x1689b847558000LL),reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^12, polynomial in n of order 11
-      real(-0x1b3fbdf6d2c80000LL),real(0x45996b8ba21LL<<20),
-      real(-0x6e75aa49fe180000LL),real(0x6210f2c5834LL<<20),
-      real(-0x10bc4d28ff680000LL),real(-0x41cde5aa8b9LL<<20),
-      real(0x4ab1c7ac75480000LL),real(-0x1ca79717ce6LL<<20),
-      real(-0x32aa32794080000LL),real(0x330fe43f6dLL<<20),
-      real(0x1ffca3e30a80000LL),real(-0x12cf88fa6ff0000LL),
+      -real(0x1b3fbdf6d2c80000LL),real(0x45996b8ba21LL<<20),
+      -real(0x6e75aa49fe180000LL),real(0x6210f2c5834LL<<20),
+      -real(0x10bc4d28ff680000LL),-real(0x41cde5aa8b9LL<<20),
+      real(0x4ab1c7ac75480000LL),-real(0x1ca79717ce6LL<<20),
+      -real(0x32aa32794080000LL),real(0x330fe43f6dLL<<20),
+      real(0x1ffca3e30a80000LL),-real(0x12cf88fa6ff0000LL),
       reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^11, polynomial in n of order 12
-      real(-0x111ca21ceLL<<20),real(0x92841d41680000LL),
-      real(-0x29f2152631LL<<20),real(0x77700c12df80000LL),
-      real(-0xdd22256234LL<<20),real(0x102165ee69880000LL),
-      real(-0x97d2f2eab7LL<<20),real(-0x25f0afa39e80000LL),
-      real(0x9732beeb66LL<<20),real(-0x7cbf10f6a580000LL),
-      real(0x2f60975b43LL<<20),real(-0x618af655c80000LL),
-      real(-0x8a9d0d3688000LL),reale(52223LL,0xdb549059b7125LL),
+      -real(0x111ca21ceLL<<20),real(0x92841d41680000LL),
+      -real(0x29f2152631LL<<20),real(0x77700c12df80000LL),
+      -real(0xdd22256234LL<<20),real(0x102165ee69880000LL),
+      -real(0x97d2f2eab7LL<<20),-real(0x25f0afa39e80000LL),
+      real(0x9732beeb66LL<<20),-real(0x7cbf10f6a580000LL),
+      real(0x2f60975b43LL<<20),-real(0x618af655c80000LL),
+      -real(0x8a9d0d3688000LL),reale(52223LL,0xdb549059b7125LL),
       // C4[8], coeff of eps^10, polynomial in n of order 13
-      real(0x22cb56LL<<20),real(0x4712bf8LL<<20),real(-0x86448846LL<<20),
-      real(0x4d78a5544LL<<20),real(-0x1846aa1b42LL<<20),
-      real(0x4d6026db5LL<<24),real(-0xa68352f15eLL<<20),
-      real(0xf43495185cLL<<20),real(-0xe824a7465aLL<<20),
+      real(0x22cb56LL<<20),real(0x4712bf8LL<<20),-real(0x86448846LL<<20),
+      real(0x4d78a5544LL<<20),-real(0x1846aa1b42LL<<20),
+      real(0x4d6026db5LL<<24),-real(0xa68352f15eLL<<20),
+      real(0xf43495185cLL<<20),-real(0xe824a7465aLL<<20),
       real(0x705265a6a8LL<<20),real(0x1aafe4620aLL<<20),
-      real(-0x54b54f2f8cLL<<20),real(0x39c1702c0eLL<<20),
-      real(-0xf0a5fe0ce50000LL),reale(52223LL,0xdb549059b7125LL),
+      -real(0x54b54f2f8cLL<<20),real(0x39c1702c0eLL<<20),
+      -real(0xf0a5fe0ce50000LL),reale(52223LL,0xdb549059b7125LL),
       // C4[8], coeff of eps^9, polynomial in n of order 14
       real(54009LL<<20),real(0x67acb80000LL),real(0x500d1aLL<<20),
-      real(0xadfe97880000LL),real(-0x160da3e85LL<<20),real(0xdd0128d3580000LL),
-      real(-0x4c49107c44LL<<20),real(0x1114fafcba280000LL),
-      real(-0x2a9587ee883LL<<20),real(0x4c17a3da25f80000LL),
-      real(-0x61c2e73ffa2LL<<20),real(0x584c43ef70c80000LL),
-      real(-0x35101f0ee01LL<<20),real(0x12f378ce74980000LL),
-      real(-0x306e34ba4668000LL),reale(365566LL,0xff4ff27401803LL),
+      real(0xadfe97880000LL),-real(0x160da3e85LL<<20),real(0xdd0128d3580000LL),
+      -real(0x4c49107c44LL<<20),real(0x1114fafcba280000LL),
+      -real(0x2a9587ee883LL<<20),real(0x4c17a3da25f80000LL),
+      -real(0x61c2e73ffa2LL<<20),real(0x584c43ef70c80000LL),
+      -real(0x35101f0ee01LL<<20),real(0x12f378ce74980000LL),
+      -real(0x306e34ba4668000LL),reale(365566LL,0xff4ff27401803LL),
       // C4[8], coeff of eps^8, polynomial in n of order 15
       real(0x11ee0000LL),real(0x5b1c0000LL),real(0x2380a0000LL),
       real(0x126f180000LL),real(0xf233a60000LL),real(0x234385140000LL),
-      real(-0x4d5c1f23e0000LL),real(0x35017da21LL<<20),
-      real(-0x144a92180a20000LL),real(0x51fe4e56b0c0000LL),
-      real(-0xeb59f3d2e860000LL),real(0x1f060a0805080000LL),
-      real(-0x305340db42ea0000LL),real(0x35b1d648f5040000LL),
-      real(-0x2452a78bb4ce0000LL),real(0xa981b88bf66c000LL),
+      -real(0x4d5c1f23e0000LL),real(0x35017da21LL<<20),
+      -real(0x144a92180a20000LL),real(0x51fe4e56b0c0000LL),
+      -real(0xeb59f3d2e860000LL),real(0x1f060a0805080000LL),
+      -real(0x305340db42ea0000LL),real(0x35b1d648f5040000LL),
+      -real(0x2452a78bb4ce0000LL),real(0xa981b88bf66c000LL),
       reale(365566LL,0xff4ff27401803LL),
       // C4[9], coeff of eps^23, polynomial in n of order 0
-      real(-0x59168000LL),real(0xa0b835899f381LL),
+      -real(0x59168000LL),real(0xa0b835899f381LL),
       // C4[9], coeff of eps^22, polynomial in n of order 1
-      real(-0x8e52aaLL<<20),real(0x18513690000LL),real(0x8f68f0ea15ed989LL),
+      -real(0x8e52aaLL<<20),real(0x18513690000LL),real(0x8f68f0ea15ed989LL),
       // C4[9], coeff of eps^21, polynomial in n of order 2
-      real(-0x12b4039bLL<<20),real(-0x2ab303780000LL),real(-0x1a402b7d8000LL),
+      -real(0x12b4039bLL<<20),-real(0x2ab303780000LL),-real(0x1a402b7d8000LL),
       reale(5306LL,0x2ad1d52b570cdLL),
       // C4[9], coeff of eps^20, polynomial in n of order 3
-      real(0x193584d8cLL<<20),real(0xaee4c7138LL<<20),real(-0x90b2b09bcLL<<20),
+      real(0x193584d8cLL<<20),real(0xaee4c7138LL<<20),-real(0x90b2b09bcLL<<20),
       real(0x14347a15e20000LL),reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^19, polynomial in n of order 4
-      real(-0x154417c7baLL<<20),real(0x21c835beaa80000LL),
-      real(-0x47f00f48dLL<<20),real(-0x131fb47ac80000LL),
-      real(-0x11435a10568000LL),reale(408574LL,0xe11d1e092eda9LL),
+      -real(0x154417c7baLL<<20),real(0x21c835beaa80000LL),
+      -real(0x47f00f48dLL<<20),-real(0x131fb47ac80000LL),
+      -real(0x11435a10568000LL),reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^18, polynomial in n of order 5
-      real(-0x605a433c5eLL<<20),real(0xee9760038LL<<20),
+      -real(0x605a433c5eLL<<20),real(0xee9760038LL<<20),
       real(0x31be2bbeeLL<<20),real(0x16998498fcLL<<20),
-      real(-0xd95bd4266LL<<20),real(0x173060290f0000LL),
+      -real(0xd95bd4266LL<<20),real(0x173060290f0000LL),
       reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^17, polynomial in n of order 6
-      real(-0x39cd187bbLL<<20),real(-0x43663bd8c80000LL),
-      real(-0xa53ccf9f2LL<<20),real(0x73d8c049880000LL),real(0x29510997LL<<20),
-      real(-0x2376b9f280000LL),real(-0x5829503048000LL),
+      -real(0x39cd187bbLL<<20),-real(0x43663bd8c80000LL),
+      -real(0xa53ccf9f2LL<<20),real(0x73d8c049880000LL),real(0x29510997LL<<20),
+      -real(0x2376b9f280000LL),-real(0x5829503048000LL),
       reale(58367LL,0xd70428dcbd8cfLL),
       // C4[9], coeff of eps^16, polynomial in n of order 7
       real(0x47bc345c88LL<<20),real(0xfc7910c13LL<<24),
-      real(-0x8a99ea3268LL<<20),real(-0x1daff62ceLL<<24),
-      real(-0xb75ae4cd8LL<<20),real(0x327b674f1LL<<24),
-      real(-0x14b41287c8LL<<20),real(0x17347d5efc0000LL),
+      -real(0x8a99ea3268LL<<20),-real(0x1daff62ceLL<<24),
+      -real(0xb75ae4cd8LL<<20),real(0x327b674f1LL<<24),
+      -real(0x14b41287c8LL<<20),real(0x17347d5efc0000LL),
       reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^15, polynomial in n of order 8
-      real(-0x9726f4fc34LL<<20),real(0xff4317f5080000LL),
+      -real(0x9726f4fc34LL<<20),real(0xff4317f5080000LL),
       real(0x1bbfa05d89LL<<20),real(0xf6d36e74980000LL),
-      real(-0x1da1c48f9aLL<<20),real(0x736575d3280000LL),
-      real(0x282d7a403LL<<20),real(0x7ce6feab80000LL),real(-0xd59ae9d0e8000LL),
+      -real(0x1da1c48f9aLL<<20),real(0x736575d3280000LL),
+      real(0x282d7a403LL<<20),real(0x7ce6feab80000LL),-real(0xd59ae9d0e8000LL),
       reale(58367LL,0xd70428dcbd8cfLL),
       // C4[9], coeff of eps^14, polynomial in n of order 9
       real(0x4be3b7611eLL<<20),real(0x7df9c8e65LL<<24),
-      real(-0xb7d5e385beLL<<20),real(0x4ff746711cLL<<20),
-      real(0xf1de11b06LL<<20),real(-0xbdd4407d8LL<<20),
-      real(-0x123b4a6356LL<<20),real(0x10f0c4fcb4LL<<20),
-      real(-0x44ea62792LL<<20),real(0x16fdaafdd0000LL),
+      -real(0xb7d5e385beLL<<20),real(0x4ff746711cLL<<20),
+      real(0xf1de11b06LL<<20),-real(0xbdd4407d8LL<<20),
+      -real(0x123b4a6356LL<<20),real(0x10f0c4fcb4LL<<20),
+      -real(0x44ea62792LL<<20),real(0x16fdaafdd0000LL),
       reale(58367LL,0xd70428dcbd8cfLL),
       // C4[9], coeff of eps^13, polynomial in n of order 10
-      real(0x52d38896f8bLL<<20),real(-0x69d66f818ca80000LL),
+      real(0x52d38896f8bLL<<20),-real(0x69d66f818ca80000LL),
       real(0x4656ca873fcLL<<20),real(0xca9586e4a280000LL),
-      real(-0x486f0b6e413LL<<20),real(0x3e51674541f80000LL),
-      real(-0x11c29dd7982LL<<20),real(-0x538c73053380000LL),
+      -real(0x486f0b6e413LL<<20),real(0x3e51674541f80000LL),
+      -real(0x11c29dd7982LL<<20),-real(0x538c73053380000LL),
       real(0x250fa482cfLL<<20),real(0x21f35b25c980000LL),
-      real(-0x110150274e88000LL),reale(408574LL,0xe11d1e092eda9LL),
+      -real(0x110150274e88000LL),reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^12, polynomial in n of order 11
-      real(0x8611fdfe7cLL<<20),real(-0x1c4d2ef1e48LL<<20),
-      real(0x40757ac5854LL<<20),real(-0x636fb3adbaLL<<24),
-      real(0x60fcc033fecLL<<20),real(-0x28ce9785af8LL<<20),
-      real(-0x1fc3eed6a3cLL<<20),real(0x3fd2e7b543LL<<24),
-      real(-0x2dbfcefc5a4LL<<20),real(0xfbe0aa2258LL<<20),
-      real(-0x1aa48ff1ccLL<<20),real(-0x3ee3b308260000LL),
+      real(0x8611fdfe7cLL<<20),-real(0x1c4d2ef1e48LL<<20),
+      real(0x40757ac5854LL<<20),-real(0x636fb3adbaLL<<24),
+      real(0x60fcc033fecLL<<20),-real(0x28ce9785af8LL<<20),
+      -real(0x1fc3eed6a3cLL<<20),real(0x3fd2e7b543LL<<24),
+      -real(0x2dbfcefc5a4LL<<20),real(0xfbe0aa2258LL<<20),
+      -real(0x1aa48ff1ccLL<<20),-real(0x3ee3b308260000LL),
       reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^11, polynomial in n of order 12
-      real(0x12c71299eLL<<20),real(-0xc4ddd05ba80000LL),
-      real(0x46ff5325c9LL<<20),real(-0x1091808b66b80000LL),
-      real(0x2ad630e8614LL<<20),real(-0x4e92a508ecc80000LL),
-      real(0x6510e717cdfLL<<20),real(-0x54aeb3c027d80000LL),
+      real(0x12c71299eLL<<20),-real(0xc4ddd05ba80000LL),
+      real(0x46ff5325c9LL<<20),-real(0x1091808b66b80000LL),
+      real(0x2ad630e8614LL<<20),-real(0x4e92a508ecc80000LL),
+      real(0x6510e717cdfLL<<20),-real(0x54aeb3c027d80000LL),
       real(0x20abba2fc8aLL<<20),real(0x11cde6b42e180000LL),
-      real(-0x22ba072788bLL<<20),real(0x160a1506db080000LL),
-      real(-0x59b3a2379f58000LL),reale(408574LL,0xe11d1e092eda9LL),
+      -real(0x22ba072788bLL<<20),real(0x160a1506db080000LL),
+      -real(0x59b3a2379f58000LL),reale(408574LL,0xe11d1e092eda9LL),
       // C4[9], coeff of eps^10, polynomial in n of order 13
-      real(-58786LL<<20),real(-0x22a868LL<<20),real(0x4eac072LL<<20),
-      real(-0x37a6160cLL<<20),real(0x15ee16526LL<<20),real(-0x5aee1acfLL<<24),
-      real(0x10b01e88baLL<<20),real(-0x23f7de64d4LL<<20),
-      real(0x39a4332b6eLL<<20),real(-0x443f573578LL<<20),
-      real(0x3a056acd82LL<<20),real(-0x215eb2969cLL<<20),
-      real(0xb8d166f36LL<<20),real(-0x1ce0b816070000LL),
+      -real(58786LL<<20),-real(0x22a868LL<<20),real(0x4eac072LL<<20),
+      -real(0x37a6160cLL<<20),real(0x15ee16526LL<<20),-real(0x5aee1acfLL<<24),
+      real(0x10b01e88baLL<<20),-real(0x23f7de64d4LL<<20),
+      real(0x39a4332b6eLL<<20),-real(0x443f573578LL<<20),
+      real(0x3a056acd82LL<<20),-real(0x215eb2969cLL<<20),
+      real(0xb8d166f36LL<<20),-real(0x1ce0b816070000LL),
       reale(19455LL,0xf256b84994845LL),
       // C4[9], coeff of eps^9, polynomial in n of order 14
-      real(-1615LL<<20),real(-0x396880000LL),real(-212534LL<<20),
-      real(-0x85c63380000LL),real(0x146d5b23LL<<20),real(-0xfb41142e80000LL),
-      real(0x6ce077adcLL<<20),real(-0x1f78e2983980000LL),
-      real(0x68e848a615LL<<20),real(-0x10644b59f3480000LL),
-      real(0x1f453d0a1eeLL<<20),real(-0x2d579881dff80000LL),
-      real(0x3002653e387LL<<20),real(-0x1f95c95817a80000LL),
+      -real(1615LL<<20),-real(0x396880000LL),-real(212534LL<<20),
+      -real(0x85c63380000LL),real(0x146d5b23LL<<20),-real(0xfb41142e80000LL),
+      real(0x6ce077adcLL<<20),-real(0x1f78e2983980000LL),
+      real(0x68e848a615LL<<20),-real(0x10644b59f3480000LL),
+      real(0x1f453d0a1eeLL<<20),-real(0x2d579881dff80000LL),
+      real(0x3002653e387LL<<20),-real(0x1f95c95817a80000LL),
       real(0x914a9e2ed338000LL),reale(408574LL,0xe11d1e092eda9LL),
       // C4[10], coeff of eps^23, polynomial in n of order 0
       real(274LL<<20),real(0x8757c14b789bLL),
       // C4[10], coeff of eps^22, polynomial in n of order 1
-      real(-0x1196b3LL<<20),real(-0xcdcede0000LL),real(0x9e817610332f06fLL),
+      -real(0x1196b3LL<<20),-real(0xcdcede0000LL),real(0x9e817610332f06fLL),
       // C4[10], coeff of eps^21, polynomial in n of order 2
-      real(0x2603b6b8LL<<20),real(-0x1b1fbe44LL<<20),real(0x35b1e4040000LL),
+      real(0x2603b6b8LL<<20),-real(0x1b1fbe44LL<<20),real(0x35b1e4040000LL),
       reale(5864LL,0xb6105765cc00bLL),
       // C4[10], coeff of eps^20, polynomial in n of order 3
-      real(0x1e33a6057eLL<<20),real(-0x21167e86cLL<<20),
-      real(-0xeff2cdd6LL<<20),real(-0x123578c1740000LL),
+      real(0x1e33a6057eLL<<20),-real(0x21167e86cLL<<20),
+      -real(0xeff2cdd6LL<<20),-real(0x123578c1740000LL),
       reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^19, polynomial in n of order 4
       real(0x271f287fLL<<24),real(0xf600a494LL<<20),real(0x16c0b9cef8LL<<20),
-      real(-0xbe2389024LL<<20),real(0x11a4af29a40000LL),
+      -real(0xbe2389024LL<<20),real(0x11a4af29a40000LL),
       reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^18, polynomial in n of order 5
-      real(-0xea32c51c9LL<<20),real(-0x4d6b22d794LL<<20),
-      real(0x2863098f21LL<<20),real(0x3eb4014b6LL<<20),real(-0x3d11ab75LL<<20),
-      real(-0x267d9727d20000LL),reale(451582LL,0xc2ea499e5c34fLL),
+      -real(0xea32c51c9LL<<20),-real(0x4d6b22d794LL<<20),
+      real(0x2863098f21LL<<20),real(0x3eb4014b6LL<<20),-real(0x3d11ab75LL<<20),
+      -real(0x267d9727d20000LL),reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^17, polynomial in n of order 6
-      real(0x1042c27c41LL<<24),real(-0x577f944588LL<<20),
-      real(-0x268f031eaLL<<24),real(-0x13c26a3db8LL<<20),
-      real(0x2ff20d26bLL<<24),real(-0x11540a97e8LL<<20),
+      real(0x1042c27c41LL<<24),-real(0x577f944588LL<<20),
+      -real(0x268f031eaLL<<24),-real(0x13c26a3db8LL<<20),
+      real(0x2ff20d26bLL<<24),-real(0x11540a97e8LL<<20),
       real(0xfe28858a80000LL),reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^16, polynomial in n of order 7
-      real(-0xbcd2f1d94LL<<20),real(0x160523aeb8LL<<20),
-      real(0x1643235e04LL<<20),real(-0x1a2a58ca3LL<<24),
+      -real(0xbcd2f1d94LL<<20),real(0x160523aeb8LL<<20),
+      real(0x1643235e04LL<<20),-real(0x1a2a58ca3LL<<24),
       real(0x3f66def9cLL<<20),real(0x28e5854e8LL<<20),real(0xb430db34LL<<20),
-      real(-0xcaee985680000LL),reale(64511LL,0xd2b3c15fc4079LL),
+      -real(0xcaee985680000LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[10], coeff of eps^15, polynomial in n of order 8
-      real(0x9db3395b4LL<<24),real(-0x9d7319ec68LL<<20),
-      real(0x2d4332da7LL<<24),real(0x170f6ac248LL<<20),real(-0x63f39826LL<<24),
-      real(-0x136411b108LL<<20),real(0xecea038dLL<<24),
-      real(-0x35a24d258LL<<20),real(0x4a8ec1980000LL),
+      real(0x9db3395b4LL<<24),-real(0x9d7319ec68LL<<20),
+      real(0x2d4332da7LL<<24),real(0x170f6ac248LL<<20),-real(0x63f39826LL<<24),
+      -real(0x136411b108LL<<20),real(0xecea038dLL<<24),
+      -real(0x35a24d258LL<<20),real(0x4a8ec1980000LL),
       reale(64511LL,0xd2b3c15fc4079LL),
       // C4[10], coeff of eps^14, polynomial in n of order 9
-      real(-0xd6b297dd67LL<<20),real(0x629dad8e08LL<<20),
-      real(0x4cbffd5477LL<<20),real(-0xa54ccd42faLL<<20),
-      real(0x72d04d3dd5LL<<20),real(-0x1671c74cfcLL<<20),
-      real(-0xddab04a4dLL<<20),real(0x37935a302LL<<20),real(0x4f2336311LL<<20),
-      real(-0x233169f0960000LL),reale(64511LL,0xd2b3c15fc4079LL),
+      -real(0xd6b297dd67LL<<20),real(0x629dad8e08LL<<20),
+      real(0x4cbffd5477LL<<20),-real(0xa54ccd42faLL<<20),
+      real(0x72d04d3dd5LL<<20),-real(0x1671c74cfcLL<<20),
+      -real(0xddab04a4dLL<<20),real(0x37935a302LL<<20),real(0x4f2336311LL<<20),
+      -real(0x233169f0960000LL),reale(64511LL,0xd2b3c15fc4079LL),
       // C4[10], coeff of eps^13, polynomial in n of order 10
-      real(-0x2640ec7ff08LL<<20),real(0x49172ca078cLL<<20),
-      real(-0x60a332f31aLL<<24),real(0x4f6133ce734LL<<20),
-      real(-0x13c00fbdc38LL<<20),real(-0x29139b5a224LL<<20),
-      real(0x3ba48bedf3LL<<24),real(-0x26443e5f67cLL<<20),
-      real(0xc0b73ade98LL<<20),real(-0x100cb5f7d4LL<<20),
-      real(-0x3d5727afac0000LL),reale(451582LL,0xc2ea499e5c34fLL),
+      -real(0x2640ec7ff08LL<<20),real(0x49172ca078cLL<<20),
+      -real(0x60a332f31aLL<<24),real(0x4f6133ce734LL<<20),
+      -real(0x13c00fbdc38LL<<20),-real(0x29139b5a224LL<<20),
+      real(0x3ba48bedf3LL<<24),-real(0x26443e5f67cLL<<20),
+      real(0xc0b73ade98LL<<20),-real(0x100cb5f7d4LL<<20),
+      -real(0x3d5727afac0000LL),reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^12, polynomial in n of order 11
-      real(-0x1c2fcb0feaLL<<20),real(0x78cd035154LL<<20),
-      real(-0x16d0a12eceeLL<<20),real(0x32382092d1LL<<24),
-      real(-0x50f9872fef2LL<<20),real(0x5d34c6740ccLL<<20),
-      real(-0x457e5bc2bf6LL<<20),real(0x1415a511e88LL<<20),
-      real(0x15730500606LL<<20),real(-0x20401dde7bcLL<<20),
-      real(0x1361c2c3102LL<<20),real(-0x4d7d212a0a40000LL),
+      -real(0x1c2fcb0feaLL<<20),real(0x78cd035154LL<<20),
+      -real(0x16d0a12eceeLL<<20),real(0x32382092d1LL<<24),
+      -real(0x50f9872fef2LL<<20),real(0x5d34c6740ccLL<<20),
+      -real(0x457e5bc2bf6LL<<20),real(0x1415a511e88LL<<20),
+      real(0x15730500606LL<<20),-real(0x20401dde7bcLL<<20),
+      real(0x1361c2c3102LL<<20),-real(0x4d7d212a0a40000LL),
       reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^11, polynomial in n of order 12
-      real(-0x1dc61f3LL<<24),real(0x177c584b4LL<<20),real(-0xa68e4dda8LL<<20),
-      real(0x310ee42c7cLL<<20),real(-0xa5e7161a2LL<<24),
-      real(0x1a2ee772944LL<<20),real(-0x3250f74ee98LL<<20),
-      real(0x49d6b12a10cLL<<20),real(-0x51be070751LL<<24),
-      real(0x4214c5c39d4LL<<20),real(-0x24a245ec788LL<<20),
-      real(0xc5a70e199cLL<<20),real(-0x1e525ae3edc0000LL),
+      -real(0x1dc61f3LL<<24),real(0x177c584b4LL<<20),-real(0xa68e4dda8LL<<20),
+      real(0x310ee42c7cLL<<20),-real(0xa5e7161a2LL<<24),
+      real(0x1a2ee772944LL<<20),-real(0x3250f74ee98LL<<20),
+      real(0x49d6b12a10cLL<<20),-real(0x51be070751LL<<24),
+      real(0x4214c5c39d4LL<<20),-real(0x24a245ec788LL<<20),
+      real(0xc5a70e199cLL<<20),-real(0x1e525ae3edc0000LL),
       reale(451582LL,0xc2ea499e5c34fLL),
       // C4[10], coeff of eps^10, polynomial in n of order 13
-      real(46189LL<<20),real(0x1fe0ccLL<<20),real(-0x55d6a55LL<<20),
-      real(0x4928642aLL<<20),real(-0x2363dbf97LL<<20),real(0xb840ca888LL<<20),
-      real(-0x2baa055459LL<<20),real(0x7de38a60e6LL<<20),
-      real(-0x11a7161219bLL<<20),real(0x1f11977c044LL<<20),
-      real(-0x2a7db4d305dLL<<20),real(0x2b3c8b159a2LL<<20),
-      real(-0x1bcb7dfb99fLL<<20),real(0x7e5725605ea0000LL),
+      real(46189LL<<20),real(0x1fe0ccLL<<20),-real(0x55d6a55LL<<20),
+      real(0x4928642aLL<<20),-real(0x2363dbf97LL<<20),real(0xb840ca888LL<<20),
+      -real(0x2baa055459LL<<20),real(0x7de38a60e6LL<<20),
+      -real(0x11a7161219bLL<<20),real(0x1f11977c044LL<<20),
+      -real(0x2a7db4d305dLL<<20),real(0x2b3c8b159a2LL<<20),
+      -real(0x1bcb7dfb99fLL<<20),real(0x7e5725605ea0000LL),
       reale(451582LL,0xc2ea499e5c34fLL),
       // C4[11], coeff of eps^23, polynomial in n of order 0
-      real(-14618LL<<20),real(0x2c95e8ad321065LL),
+      -real(14618LL<<20),real(0x2c95e8ad321065LL),
       // C4[11], coeff of eps^22, polynomial in n of order 1
-      real(-475508LL<<28),real(0xcc9558LL<<20),real(0x7759dcb5574d50a7LL),
+      -real(475508LL<<28),real(0xcc9558LL<<20),real(0x7759dcb5574d50a7LL),
       // C4[11], coeff of eps^21, polynomial in n of order 2
-      real(-0x8af151LL<<24),real(-0x17c4bd28LL<<20),real(-0x2ab725b4c0000LL),
+      -real(0x8af151LL<<24),-real(0x17c4bd28LL<<20),-real(0x2ab725b4c0000LL),
       reale(70655LL,0xce6359e2ca823LL),
       // C4[11], coeff of eps^20, polynomial in n of order 3
-      real(-0x1c84ad12LL<<24),real(0x167f4f58cLL<<24),real(-0xa6243226LL<<24),
+      -real(0x1c84ad12LL<<24),real(0x167f4f58cLL<<24),-real(0xa6243226LL<<24),
       real(0xd66f0f6680000LL),reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^19, polynomial in n of order 4
-      real(-0x4e628a606LL<<24),real(0x1f0426c698LL<<20),real(0x5a0f914dLL<<24),
-      real(0x6ca5b688LL<<20),real(-0x25d6eb7f040000LL),
+      -real(0x4e628a606LL<<24),real(0x1f0426c698LL<<20),real(0x5a0f914dLL<<24),
+      real(0x6ca5b688LL<<20),-real(0x25d6eb7f040000LL),
       reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^18, polynomial in n of order 5
-      real(-0x2bf157d5LL<<28),real(-0x2808e738LL<<28),real(-0x1ac7b8a3LL<<28),
-      real(0x2cec47ecLL<<28),real(-0xe84ff89LL<<28),real(0xa955cbd6LL<<20),
+      -real(0x2bf157d5LL<<28),-real(0x2808e738LL<<28),-real(0x1ac7b8a3LL<<28),
+      real(0x2cec47ecLL<<28),-real(0xe84ff89LL<<28),real(0xa955cbd6LL<<20),
       reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^17, polynomial in n of order 6
-      real(0xd6416fd2LL<<24),real(0x1a7ce273bLL<<24),real(-0x164414e34LL<<24),
+      real(0xd6416fd2LL<<24),real(0x1a7ce273bLL<<24),-real(0x164414e34LL<<24),
       real(0x18514f7dLL<<24),real(0x26a24e46LL<<24),real(0xde21c9fLL<<24),
-      real(-0xbfafa69580000LL),reale(70655LL,0xce6359e2ca823LL),
+      -real(0xbfafa69580000LL),reale(70655LL,0xce6359e2ca823LL),
       // C4[11], coeff of eps^16, polynomial in n of order 7
-      real(-0x37574f34acLL<<24),real(0x84fafcb78LL<<24),
-      real(0xb233d7bfcLL<<24),real(-0x6f2a193LL<<28),real(-0x89bedbe1cLL<<24),
-      real(0x5a25b4328LL<<24),real(-0x12508eb74LL<<24),real(-0x31e34911LL<<20),
+      -real(0x37574f34acLL<<24),real(0x84fafcb78LL<<24),
+      real(0xb233d7bfcLL<<24),-real(0x6f2a193LL<<28),-real(0x89bedbe1cLL<<24),
+      real(0x5a25b4328LL<<24),-real(0x12508eb74LL<<24),-real(0x31e34911LL<<20),
       reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^15, polynomial in n of order 8
-      real(0x2b3869c18LL<<24),real(0x6bde35689LL<<24),real(-0x9bd70f74eLL<<24),
-      real(0x59f59768bLL<<24),real(-0x989546f4LL<<24),real(-0xe250b353LL<<24),
-      real(0x1ea69be6LL<<24),real(0x4ec2b9afLL<<24),real(-0x1ff3696ed80000LL),
+      real(0x2b3869c18LL<<24),real(0x6bde35689LL<<24),-real(0x9bd70f74eLL<<24),
+      real(0x59f59768bLL<<24),-real(0x989546f4LL<<24),-real(0xe250b353LL<<24),
+      real(0x1ea69be6LL<<24),real(0x4ec2b9afLL<<24),-real(0x1ff3696ed80000LL),
       reale(70655LL,0xce6359e2ca823LL),
       // C4[11], coeff of eps^14, polynomial in n of order 9
-      real(0xb24820b1LL<<28),real(-0xcdaa7f9LL<<32),real(0x8d98303fLL<<28),
-      real(-0x715b264LL<<28),real(-0x69a997fbLL<<28),real(0x7cf953f8LL<<28),
-      real(-0x492e000dLL<<28),real(0x1532a074LL<<28),real(-0x1477807LL<<28),
-      real(-0x84ab32d6LL<<20),reale(70655LL,0xce6359e2ca823LL),
+      real(0xb24820b1LL<<28),-real(0xcdaa7f9LL<<32),real(0x8d98303fLL<<28),
+      -real(0x715b264LL<<28),-real(0x69a997fbLL<<28),real(0x7cf953f8LL<<28),
+      -real(0x492e000dLL<<28),real(0x1532a074LL<<28),-real(0x1477807LL<<28),
+      -real(0x84ab32d6LL<<20),reale(70655LL,0xce6359e2ca823LL),
       // C4[11], coeff of eps^13, polynomial in n of order 10
-      real(0xb3c06cd6dLL<<24),real(-0x1cd91850ed8LL<<20),
-      real(0x37ca1889e4LL<<24),real(-0x50c8876bea8LL<<20),
-      real(0x546435a5dbLL<<24),real(-0x3839a481d78LL<<20),
+      real(0xb3c06cd6dLL<<24),-real(0x1cd91850ed8LL<<20),
+      real(0x37ca1889e4LL<<24),-real(0x50c8876bea8LL<<20),
+      real(0x546435a5dbLL<<24),-real(0x3839a481d78LL<<20),
       real(0xa846bfd72LL<<24),real(0x1777a57c6b8LL<<20),
-      real(-0x1dd3659b37LL<<24),real(0x112d2a31fe8LL<<20),
-      real(-0x43bae67ca340000LL),reale(494590LL,0xa4b77533898f5LL),
+      -real(0x1dd3659b37LL<<24),real(0x112d2a31fe8LL<<20),
+      -real(0x43bae67ca340000LL),reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^12, polynomial in n of order 11
-      real(0x3a2fdc86LL<<24),real(-0x133458534LL<<24),real(0x4983cdbc2LL<<24),
-      real(-0xd4d77511LL<<28),real(0x1dcdf50ddeLL<<24),
-      real(-0x342b8eadecLL<<24),real(0x472c5d4b1aLL<<24),
-      real(-0x4a78d3d788LL<<24),real(0x39b15b6bb6LL<<24),
-      real(-0x1f0000c9a4LL<<24),real(0xa393147f2LL<<24),
-      real(-0x18b4e1c33380000LL),reale(494590LL,0xa4b77533898f5LL),
+      real(0x3a2fdc86LL<<24),-real(0x133458534LL<<24),real(0x4983cdbc2LL<<24),
+      -real(0xd4d77511LL<<28),real(0x1dcdf50ddeLL<<24),
+      -real(0x342b8eadecLL<<24),real(0x472c5d4b1aLL<<24),
+      -real(0x4a78d3d788LL<<24),real(0x39b15b6bb6LL<<24),
+      -real(0x1f0000c9a4LL<<24),real(0xa393147f2LL<<24),
+      -real(0x18b4e1c33380000LL),reale(494590LL,0xa4b77533898f5LL),
       // C4[11], coeff of eps^11, polynomial in n of order 12
-      real(0x1671deLL<<24),real(-0x1500c668LL<<20),real(0xb37afc9LL<<24),
-      real(-0x40e6c22f8LL<<20),real(0x113a17194LL<<24),
-      real(-0x382ee86c88LL<<20),real(0x90789ecdfLL<<24),
-      real(-0x128f7f11918LL<<20),real(0x1e91fe774aLL<<24),
-      real(-0x27d2630dea8LL<<20),real(0x2730923e75LL<<24),
-      real(-0x18b4e1c3338LL<<20),real(0x6f2df7ee67c0000LL),
+      real(0x1671deLL<<24),-real(0x1500c668LL<<20),real(0xb37afc9LL<<24),
+      -real(0x40e6c22f8LL<<20),real(0x113a17194LL<<24),
+      -real(0x382ee86c88LL<<20),real(0x90789ecdfLL<<24),
+      -real(0x128f7f11918LL<<20),real(0x1e91fe774aLL<<24),
+      -real(0x27d2630dea8LL<<20),real(0x2730923e75LL<<24),
+      -real(0x18b4e1c3338LL<<20),real(0x6f2df7ee67c0000LL),
       reale(494590LL,0xa4b77533898f5LL),
       // C4[12], coeff of eps^23, polynomial in n of order 0
       real(173LL<<24),real(0x88d5e64011771LL),
       // C4[12], coeff of eps^22, polynomial in n of order 1
-      real(-163369LL<<28),real(-533806LL<<28),reale(14529LL,0xb09bccfe817bfLL),
+      -real(163369LL<<28),-real(533806LL<<28),reale(14529LL,0xb09bccfe817bfLL),
       // C4[12], coeff of eps^21, polynomial in n of order 2
-      real(0x3221baeLL<<28),real(-0x14bb46dLL<<28),real(0x1728fcfLL<<24),
+      real(0x3221baeLL<<28),-real(0x14bb46dLL<<28),real(0x1728fcfLL<<24),
       reale(76799LL,0xca12f265d0fcdLL),
       // C4[12], coeff of eps^20, polynomial in n of order 3
       real(0x16cedd0f7LL<<24),real(0x68f5252aLL<<24),real(0x100a803dLL<<24),
-      real(-0x24d58931aLL<<20),reale(537598LL,0x8684a0c8b6e9bLL),
+      -real(0x24d58931aLL<<20),reale(537598LL,0x8684a0c8b6e9bLL),
       // C4[12], coeff of eps^19, polynomial in n of order 4
-      real(-0x24c667a9LL<<28),real(-0x204f7245cLL<<24),real(0x29ae5e638LL<<24),
-      real(-0xc2f052f4LL<<24),real(0x6b6905bcLL<<20),
+      -real(0x24c667a9LL<<28),-real(0x204f7245cLL<<24),real(0x29ae5e638LL<<24),
+      -real(0xc2f052f4LL<<24),real(0x6b6905bcLL<<20),
       reale(537598LL,0x8684a0c8b6e9bLL),
       // C4[12], coeff of eps^18, polynomial in n of order 5
-      real(0x1c800d54cLL<<24),real(-0x125e2539LL<<28),real(-0x431e66cLL<<24),
-      real(0x22c53a38LL<<24),real(0xfcf4ddcLL<<24),real(-0xb47cb7cLL<<24),
+      real(0x1c800d54cLL<<24),-real(0x125e2539LL<<28),-real(0x431e66cLL<<24),
+      real(0x22c53a38LL<<24),real(0xfcf4ddcLL<<24),-real(0xb47cb7cLL<<24),
       reale(76799LL,0xca12f265d0fcdLL),
       // C4[12], coeff of eps^17, polynomial in n of order 6
       real(0x45b00e8LL<<24),real(0x1879e031cLL<<24),real(0x380b7efLL<<28),
-      real(-0x135dac8bcLL<<24),real(0xb2b97ef8LL<<24),real(-0x20bc2b14LL<<24),
-      real(-0xea38f04LL<<20),reale(76799LL,0xca12f265d0fcdLL),
+      -real(0x135dac8bcLL<<24),real(0xb2b97ef8LL<<24),-real(0x20bc2b14LL<<24),
+      -real(0xea38f04LL<<20),reale(76799LL,0xca12f265d0fcdLL),
       // C4[12], coeff of eps^16, polynomial in n of order 7
-      real(0x3701f1b322LL<<24),real(-0x3de4b7ca4cLL<<24),
-      real(0x1e0551a306LL<<24),real(-0x3ff2ae88LL<<24),
-      real(-0x5ea04db96LL<<24),real(0x4663a33cLL<<24),real(0x21c3a104eLL<<24),
-      real(-0xcbb56a5acLL<<20),reale(537598LL,0x8684a0c8b6e9bLL),
+      real(0x3701f1b322LL<<24),-real(0x3de4b7ca4cLL<<24),
+      real(0x1e0551a306LL<<24),-real(0x3ff2ae88LL<<24),
+      -real(0x5ea04db96LL<<24),real(0x4663a33cLL<<24),real(0x21c3a104eLL<<24),
+      -real(0xcbb56a5acLL<<20),reale(537598LL,0x8684a0c8b6e9bLL),
       // C4[12], coeff of eps^15, polynomial in n of order 8
-      real(-0x50e951d9eLL<<28),real(0x2dc21adf0cLL<<24),
-      real(0x9a9f67018LL<<24),real(-0x307f93b19cLL<<24),
-      real(0x3187e8171LL<<28),real(-0x1ad4690cc4LL<<24),
-      real(0x72d4f7c08LL<<24),real(-0x4284616cLL<<24),real(-0x360b8f27cLL<<20),
+      -real(0x50e951d9eLL<<28),real(0x2dc21adf0cLL<<24),
+      real(0x9a9f67018LL<<24),-real(0x307f93b19cLL<<24),
+      real(0x3187e8171LL<<28),-real(0x1ad4690cc4LL<<24),
+      real(0x72d4f7c08LL<<24),-real(0x4284616cLL<<24),-real(0x360b8f27cLL<<20),
       reale(537598LL,0x8684a0c8b6e9bLL),
       // C4[12], coeff of eps^14, polynomial in n of order 9
-      real(-0x4e6bc3424LL<<24),real(0x8833a59eLL<<28),real(-0xb3dd28c1cLL<<24),
-      real(0xac3fc9f68LL<<24),real(-0x667eb7414LL<<24),real(0x77b80cfLL<<28),
-      real(0x37cf913f4LL<<24),real(-0x3ef425588LL<<24),real(0x230a4ebfcLL<<24),
-      real(-0x88b062ecLL<<24),reale(76799LL,0xca12f265d0fcdLL),
+      -real(0x4e6bc3424LL<<24),real(0x8833a59eLL<<28),-real(0xb3dd28c1cLL<<24),
+      real(0xac3fc9f68LL<<24),-real(0x667eb7414LL<<24),real(0x77b80cfLL<<28),
+      real(0x37cf913f4LL<<24),-real(0x3ef425588LL<<24),real(0x230a4ebfcLL<<24),
+      -real(0x88b062ecLL<<24),reale(76799LL,0xca12f265d0fcdLL),
       // C4[12], coeff of eps^13, polynomial in n of order 10
-      real(-0xa4a255b8LL<<24),real(0x2198941c4LL<<24),real(-0x55f3d536LL<<28),
-      real(0xaea2f0a7cLL<<24),real(-0x11ad0f2508LL<<24),
-      real(0x16acb091b4LL<<24),real(-0x169cc955bLL<<28),
-      real(0x10e39cbc6cLL<<24),real(-0x8d594f058LL<<24),
-      real(0x2dbb02fa4LL<<24),real(-0x6d0cb854cLL<<20),
+      -real(0xa4a255b8LL<<24),real(0x2198941c4LL<<24),-real(0x55f3d536LL<<28),
+      real(0xaea2f0a7cLL<<24),-real(0x11ad0f2508LL<<24),
+      real(0x16acb091b4LL<<24),-real(0x169cc955bLL<<28),
+      real(0x10e39cbc6cLL<<24),-real(0x8d594f058LL<<24),
+      real(0x2dbb02fa4LL<<24),-real(0x6d0cb854cLL<<20),
       reale(179199LL,0x822c35983cf89LL),
       // C4[12], coeff of eps^12, polynomial in n of order 11
-      real(-0x37b8e9dLL<<24),real(0x16298b8aLL<<24),real(-0x6829a96fLL<<24),
-      real(0x17ac60b08LL<<24),real(-0x448421b01LL<<24),real(0xa08605c86LL<<24),
-      real(-0x132e21a1d3LL<<24),real(0x1de177c384LL<<24),
-      real(-0x2559d5b465LL<<24),real(0x23ba1a5382LL<<24),
-      real(-0x1626957137LL<<24),real(0x62d3870cceLL<<20),
+      -real(0x37b8e9dLL<<24),real(0x16298b8aLL<<24),-real(0x6829a96fLL<<24),
+      real(0x17ac60b08LL<<24),-real(0x448421b01LL<<24),real(0xa08605c86LL<<24),
+      -real(0x132e21a1d3LL<<24),real(0x1de177c384LL<<24),
+      -real(0x2559d5b465LL<<24),real(0x23ba1a5382LL<<24),
+      -real(0x1626957137LL<<24),real(0x62d3870cceLL<<20),
       reale(537598LL,0x8684a0c8b6e9bLL),
       // C4[13], coeff of eps^23, polynomial in n of order 0
-      real(-34717LL<<24),real(0x4013d857859e5adLL),
+      -real(34717LL<<24),real(0x4013d857859e5adLL),
       // C4[13], coeff of eps^22, polynomial in n of order 1
-      real(-211348LL<<28),real(202566LL<<24),real(0x39b1009e5dec691dLL),
+      -real(211348LL<<28),real(202566LL<<24),real(0x39b1009e5dec691dLL),
       // C4[13], coeff of eps^21, polynomial in n of order 2
-      real(0x6f0d556LL<<28),real(0x17e5b6fLL<<28),real(-0x239e6b67LL<<24),
+      real(0x6f0d556LL<<28),real(0x17e5b6fLL<<28),-real(0x239e6b67LL<<24),
       reale(580606LL,0x6851cc5de4441LL),
       // C4[13], coeff of eps^20, polynomial in n of order 3
-      real(-0x2464749LL<<32),real(0x26669d6LL<<32),real(-0xa3d513LL<<32),
+      -real(0x2464749LL<<32),real(0x26669d6LL<<32),-real(0xa3d513LL<<32),
       real(0x3def9d8LL<<24),reale(580606LL,0x6851cc5de4441LL),
       // C4[13], coeff of eps^19, polynomial in n of order 4
-      real(-0xeb80f55LL<<28),real(-0x1858908cLL<<24),real(0x1e2afdd8LL<<24),
-      real(0x112cd7fcLL<<24),real(-0xa9ad115cLL<<20),
+      -real(0xeb80f55LL<<28),-real(0x1858908cLL<<24),real(0x1e2afdd8LL<<24),
+      real(0x112cd7fcLL<<24),-real(0xa9ad115cLL<<20),
       reale(82943LL,0xc5c28ae8d7777LL),
       // C4[13], coeff of eps^18, polynomial in n of order 5
-      real(0x159a60cfLL<<28),real(0x721fec4LL<<28),real(-0x12aa2317LL<<28),
-      real(0x9ad4f32LL<<28),real(-0x199ce6dLL<<28),real(-0x13522ba8LL<<20),
+      real(0x159a60cfLL<<28),real(0x721fec4LL<<28),-real(0x12aa2317LL<<28),
+      real(0x9ad4f32LL<<28),-real(0x199ce6dLL<<28),-real(0x13522ba8LL<<20),
       reale(82943LL,0xc5c28ae8d7777LL),
       // C4[13], coeff of eps^17, polynomial in n of order 6
-      real(-0x7cff45cc8LL<<24),real(0x32d4ac134LL<<24),real(0x57cb65dLL<<28),
-      real(-0xc68d9d14LL<<24),real(-0x6973598LL<<24),real(0x4ada9e24LL<<24),
-      real(-0x1a98e3004LL<<20),reale(82943LL,0xc5c28ae8d7777LL),
+      -real(0x7cff45cc8LL<<24),real(0x32d4ac134LL<<24),real(0x57cb65dLL<<28),
+      -real(0xc68d9d14LL<<24),-real(0x6973598LL<<24),real(0x4ada9e24LL<<24),
+      -real(0x1a98e3004LL<<20),reale(82943LL,0xc5c28ae8d7777LL),
       // C4[13], coeff of eps^16, polynomial in n of order 7
-      real(0x1f56ae64eLL<<28),real(0x132b344d4LL<<28),real(-0x30d2fad16LL<<28),
-      real(0x2c89c35f8LL<<28),real(-0x168935c9aLL<<28),real(0x5932509cLL<<28),
-      real(-0xe61cfeLL<<28),real(-0x31e34911LL<<24),
+      real(0x1f56ae64eLL<<28),real(0x132b344d4LL<<28),-real(0x30d2fad16LL<<28),
+      real(0x2c89c35f8LL<<28),-real(0x168935c9aLL<<28),real(0x5932509cLL<<28),
+      -real(0xe61cfeLL<<28),-real(0x31e34911LL<<24),
       reale(580606LL,0x6851cc5de4441LL),
       // C4[13], coeff of eps^15, polynomial in n of order 8
-      real(0x3dcb4a886LL<<28),real(-0x4b489ee77cLL<<24),
-      real(0x42904411c8LL<<24),real(-0x232f8a41b4LL<<24),
-      real(-0x2305ff7dLL<<28),real(0x18aab34994LL<<24),
-      real(-0x196f7c6368LL<<24),real(0xdc5682b5cLL<<24),
-      real(-0x354402037cLL<<20),reale(580606LL,0x6851cc5de4441LL),
+      real(0x3dcb4a886LL<<28),-real(0x4b489ee77cLL<<24),
+      real(0x42904411c8LL<<24),-real(0x232f8a41b4LL<<24),
+      -real(0x2305ff7dLL<<28),real(0x18aab34994LL<<24),
+      -real(0x196f7c6368LL<<24),real(0xdc5682b5cLL<<24),
+      -real(0x354402037cLL<<20),reale(580606LL,0x6851cc5de4441LL),
       // C4[13], coeff of eps^14, polynomial in n of order 9
-      real(0x818a2ec5LL<<28),real(-0x12b6c5f08LL<<28),real(0x230938ccbLL<<28),
-      real(-0x351e2e0f6LL<<28),real(0x40a325c81LL<<28),
-      real(-0x3dd759604LL<<28),real(0x2cbf53447LL<<28),
-      real(-0x16dd817d2LL<<28),real(0x7467aa7dLL<<28),
-      real(-0x1126211dd8LL<<20),reale(580606LL,0x6851cc5de4441LL),
+      real(0x818a2ec5LL<<28),-real(0x12b6c5f08LL<<28),real(0x230938ccbLL<<28),
+      -real(0x351e2e0f6LL<<28),real(0x40a325c81LL<<28),
+      -real(0x3dd759604LL<<28),real(0x2cbf53447LL<<28),
+      -real(0x16dd817d2LL<<28),real(0x7467aa7dLL<<28),
+      -real(0x1126211dd8LL<<20),reale(580606LL,0x6851cc5de4441LL),
       // C4[13], coeff of eps^13, polynomial in n of order 10
-      real(0x25fe13c8LL<<24),real(-0x9850ba5cLL<<24),real(0x1e97df6aLL<<28),
-      real(-0x504eaa764LL<<24),real(0xae1c91d78LL<<24),
-      real(-0x139186d8ecLL<<24),real(0x1d12b9b75LL<<28),
-      real(-0x2313cf5ff4LL<<24),real(0x20bd27f328LL<<24),
-      real(-0x1401d14d7cLL<<24),real(0x589a55c4dcLL<<20),
+      real(0x25fe13c8LL<<24),-real(0x9850ba5cLL<<24),real(0x1e97df6aLL<<28),
+      -real(0x504eaa764LL<<24),real(0xae1c91d78LL<<24),
+      -real(0x139186d8ecLL<<24),real(0x1d12b9b75LL<<28),
+      -real(0x2313cf5ff4LL<<24),real(0x20bd27f328LL<<24),
+      -real(0x1401d14d7cLL<<24),real(0x589a55c4dcLL<<20),
       reale(580606LL,0x6851cc5de4441LL),
       // C4[14], coeff of eps^23, polynomial in n of order 0
       real(3464LL<<24),real(0x16f0fb486be35c9LL),
       // C4[14], coeff of eps^22, polynomial in n of order 1
-      real(0x1ca55aLL<<28),real(-0x2045e4cLL<<24),
+      real(0x1ca55aLL<<28),-real(0x2045e4cLL<<24),
       reale(36683LL,0x318959e11f277LL),
       // C4[14], coeff of eps^21, polynomial in n of order 2
-      real(0x2120deLL<<32),real(-531601LL<<32),real(109557LL<<28),
+      real(0x2120deLL<<32),-real(531601LL<<32),real(109557LL<<28),
       reale(36683LL,0x318959e11f277LL),
       // C4[14], coeff of eps^20, polynomial in n of order 3
-      real(-0x10a43e28LL<<28),real(0xb17829LL<<32),real(0x7eabb48LL<<28),
-      real(-0x45c00a9LL<<28),reale(623614LL,0x4a1ef7f3119e7LL),
+      -real(0x10a43e28LL<<28),real(0xb17829LL<<32),real(0x7eabb48LL<<28),
+      -real(0x45c00a9LL<<28),reale(623614LL,0x4a1ef7f3119e7LL),
       // C4[14], coeff of eps^19, polynomial in n of order 4
-      real(0x9eed74LL<<32),real(-0x11ba229LL<<32),real(0x8618baLL<<32),
-      real(-0x140563LL<<32),real(-0x161c61LL<<28),
+      real(0x9eed74LL<<32),-real(0x11ba229LL<<32),real(0x8618baLL<<32),
+      -real(0x140563LL<<32),-real(0x161c61LL<<28),
       reale(89087LL,0xc172236bddf21LL),
       // C4[14], coeff of eps^18, polynomial in n of order 5
-      real(0x244e10b28LL<<24),real(0x96e2042LL<<28),real(-0xb152f2e8LL<<24),
-      real(-0x13d4edfLL<<28),real(0x481c9f08LL<<24),real(-0x1864aaafLL<<24),
+      real(0x244e10b28LL<<24),real(0x96e2042LL<<28),-real(0xb152f2e8LL<<24),
+      -real(0x13d4edfLL<<28),real(0x481c9f08LL<<24),-real(0x1864aaafLL<<24),
       reale(89087LL,0xc172236bddf21LL),
       // C4[14], coeff of eps^17, polynomial in n of order 6
-      real(0x3b7e4894LL<<28),real(-0x6d6c0f9aLL<<28),real(0x5b1f61b8LL<<28),
-      real(-0x2b621ef6LL<<28),real(0x9eb72dcLL<<28),real(0x300baeLL<<28),
-      real(-0x68c8a16LL<<24),reale(89087LL,0xc172236bddf21LL),
+      real(0x3b7e4894LL<<28),-real(0x6d6c0f9aLL<<28),real(0x5b1f61b8LL<<28),
+      -real(0x2b621ef6LL<<28),real(0x9eb72dcLL<<28),real(0x300baeLL<<28),
+      -real(0x68c8a16LL<<24),reale(89087LL,0xc172236bddf21LL),
       // C4[14], coeff of eps^16, polynomial in n of order 7
-      real(-0x4707eab9dLL<<28),real(0x3a445131eLL<<28),
-      real(-0x1b0e43927LL<<28),real(-0x6498a9ecLL<<28),real(0x1875e934fLL<<28),
-      real(-0x178373ef6LL<<28),real(0xc71a15c5LL<<28),real(-0x2fcf2605aLL<<24),
+      -real(0x4707eab9dLL<<28),real(0x3a445131eLL<<28),
+      -real(0x1b0e43927LL<<28),-real(0x6498a9ecLL<<28),real(0x1875e934fLL<<28),
+      -real(0x178373ef6LL<<28),real(0xc71a15c5LL<<28),-real(0x2fcf2605aLL<<24),
       reale(623614LL,0x4a1ef7f3119e7LL),
       // C4[14], coeff of eps^15, polynomial in n of order 8
-      real(-0x150a734fLL<<32),real(0x24bdd9aeeLL<<28),real(-0x34a1435b4LL<<28),
-      real(0x3d2daa4aaLL<<28),real(-0x38737aa78LL<<28),real(0x27ba57866LL<<28),
-      real(-0x13e34173cLL<<28),real(0x63c69222LL<<28),real(-0xe8cf54faLL<<24),
+      -real(0x150a734fLL<<32),real(0x24bdd9aeeLL<<28),-real(0x34a1435b4LL<<28),
+      real(0x3d2daa4aaLL<<28),-real(0x38737aa78LL<<28),real(0x27ba57866LL<<28),
+      -real(0x13e34173cLL<<28),real(0x63c69222LL<<28),-real(0xe8cf54faLL<<24),
       reale(623614LL,0x4a1ef7f3119e7LL),
       // C4[14], coeff of eps^14, polynomial in n of order 9
-      real(-0xd0075fc8LL<<24),real(0x25c0dd3cLL<<28),real(-0x5b54718b8LL<<24),
-      real(0xb9680eedLL<<28),real(-0x13c5e421a8LL<<24),real(0x1c32b269eLL<<28),
-      real(-0x20fde01a98LL<<24),real(0x1e23fc24fLL<<28),
-      real(-0x123032a388LL<<24),real(0x50074535fLL<<24),
+      -real(0xd0075fc8LL<<24),real(0x25c0dd3cLL<<28),-real(0x5b54718b8LL<<24),
+      real(0xb9680eedLL<<28),-real(0x13c5e421a8LL<<24),real(0x1c32b269eLL<<28),
+      -real(0x20fde01a98LL<<24),real(0x1e23fc24fLL<<28),
+      -real(0x123032a388LL<<24),real(0x50074535fLL<<24),
       reale(623614LL,0x4a1ef7f3119e7LL),
       // C4[15], coeff of eps^23, polynomial in n of order 0
-      real(-88024LL<<24),real(0x6a44bb11ad2310dLL),
+      -real(88024LL<<24),real(0x6a44bb11ad2310dLL),
       // C4[15], coeff of eps^22, polynomial in n of order 1
-      real(-28003LL<<36),real(14196LL<<28),reale(39213LL,0x11a47a8f8b3bdLL),
+      -real(28003LL<<36),real(14196LL<<28),reale(39213LL,0x11a47a8f8b3bdLL),
       // C4[15], coeff of eps^21, polynomial in n of order 2
-      real(4972LL<<36),real(4498LL<<36),real(-577583LL<<28),
+      real(4972LL<<36),real(4498LL<<36),-real(577583LL<<28),
       reale(5601LL,0xddf2ecefef51bLL),
       // C4[15], coeff of eps^20, polynomial in n of order 3
-      real(-28101LL<<40),real(195944LL<<36),real(-1645LL<<40),
-      real(-637602LL<<28),reale(39213LL,0x11a47a8f8b3bdLL),
+      -real(28101LL<<40),real(195944LL<<36),-real(1645LL<<40),
+      -real(637602LL<<28),reale(39213LL,0x11a47a8f8b3bdLL),
       // C4[15], coeff of eps^19, polynomial in n of order 4
-      real(0x52f54cLL<<36),real(-0x43dbd7LL<<36),real(-866586LL<<36),
-      real(0x1e41a3LL<<36),real(-0x9d2313dLL<<28),
+      real(0x52f54cLL<<36),-real(0x43dbd7LL<<36),-real(866586LL<<36),
+      real(0x1e41a3LL<<36),-real(0x9d2313dLL<<28),
       reale(666622LL,0x2bec23883ef8dLL),
       // C4[15], coeff of eps^18, polynomial in n of order 5
-      real(-0x69663bLL<<36),real(0x515854LL<<36),real(-0x24a3fdLL<<36),
-      real(506378LL<<36),real(26273LL<<36),real(-0x60175cLL<<28),
+      -real(0x69663bLL<<36),real(0x515854LL<<36),-real(0x24a3fdLL<<36),
+      real(506378LL<<36),real(26273LL<<36),-real(0x60175cLL<<28),
       reale(95231LL,0xbd21bbeee46cbLL),
       // C4[15], coeff of eps^17, polynomial in n of order 6
-      real(0x73aa5faLL<<32),real(-0x2e45af9LL<<32),real(-0x15592c4LL<<32),
-      real(0x36c5691LL<<32),real(-0x31c2d02LL<<32),real(0x19d71fbLL<<32),
-      real(-0x62bf9592LL<<24),reale(95231LL,0xbd21bbeee46cbLL),
+      real(0x73aa5faLL<<32),-real(0x2e45af9LL<<32),-real(0x15592c4LL<<32),
+      real(0x36c5691LL<<32),-real(0x31c2d02LL<<32),real(0x19d71fbLL<<32),
+      -real(0x62bf9592LL<<24),reale(95231LL,0xbd21bbeee46cbLL),
       // C4[15], coeff of eps^16, polynomial in n of order 7
-      real(0xca51764LL<<32),real(-0x113d3e28LL<<32),real(0x1340502cLL<<32),
-      real(-0x1134cafLL<<36),real(0xbd0b734LL<<32),real(-0x5cee2b8LL<<32),
-      real(0x1cc39fcLL<<32),real(-0x4284616cLL<<24),
+      real(0xca51764LL<<32),-real(0x113d3e28LL<<32),real(0x1340502cLL<<32),
+      -real(0x1134cafLL<<36),real(0xbd0b734LL<<32),-real(0x5cee2b8LL<<32),
+      real(0x1cc39fcLL<<32),-real(0x4284616cLL<<24),
       reale(222207LL,0x63f9612d6a52fLL),
       // C4[15], coeff of eps^15, polynomial in n of order 8
-      real(0x2cf5a88LL<<32),real(-0x657473dLL<<32),real(0xc2a0b46LL<<32),
-      real(-0x13d53ee7LL<<32),real(0x1b4a4a44LL<<32),real(-0x1f149bb1LL<<32),
-      real(0x1bdd82c2LL<<32),real(-0x10a1185bLL<<32),real(0x48c0ca8e2LL<<24),
+      real(0x2cf5a88LL<<32),-real(0x657473dLL<<32),real(0xc2a0b46LL<<32),
+      -real(0x13d53ee7LL<<32),real(0x1b4a4a44LL<<32),-real(0x1f149bb1LL<<32),
+      real(0x1bdd82c2LL<<32),-real(0x10a1185bLL<<32),real(0x48c0ca8e2LL<<24),
       reale(666622LL,0x2bec23883ef8dLL),
       // C4[16], coeff of eps^23, polynomial in n of order 0
-      real(-8LL<<28),real(0x5f43434b6401e1LL),
+      -real(8LL<<28),real(0x5f43434b6401e1LL),
       // C4[16], coeff of eps^22, polynomial in n of order 1
-      real(4571LL<<36),real(-33945LL<<32),reale(5963LL,0x471b5f51fec25LL),
+      real(4571LL<<36),-real(33945LL<<32),reale(5963LL,0x471b5f51fec25LL),
       // C4[16], coeff of eps^21, polynomial in n of order 2
-      real(24269LL<<36),real(-46648LL<<32),real(-93624LL<<28),
+      real(24269LL<<36),-real(46648LL<<32),-real(93624LL<<28),
       reale(5963LL,0x471b5f51fec25LL),
       // C4[16], coeff of eps^20, polynomial in n of order 3
-      real(-224895LL<<36),real(-64554LL<<36),real(111531LL<<36),
-      real(-559300LL<<32),reale(41742LL,0xf1bf9b3df7503LL),
+      -real(224895LL<<36),-real(64554LL<<36),real(111531LL<<36),
+      -real(559300LL<<32),reale(41742LL,0xf1bf9b3df7503LL),
       // C4[16], coeff of eps^19, polynomial in n of order 4
-      real(0x1ddbcaLL<<36),real(-0xcc71e8LL<<32),real(162197LL<<36),
-      real(234248LL<<32),real(-0x2443f8LL<<28),
+      real(0x1ddbcaLL<<36),-real(0xcc71e8LL<<32),real(162197LL<<36),
+      real(234248LL<<32),-real(0x2443f8LL<<28),
       reale(41742LL,0xf1bf9b3df7503LL),
       // C4[16], coeff of eps^18, polynomial in n of order 5
-      real(-0xe8e70dLL<<36),real(-0xb96fb4LL<<36),real(0x1748505LL<<36),
-      real(-0x1431b3aLL<<36),real(0xa52337LL<<36),real(-0x27462ddLL<<32),
+      -real(0xe8e70dLL<<36),-real(0xb96fb4LL<<36),real(0x1748505LL<<36),
+      -real(0x1431b3aLL<<36),real(0xa52337LL<<36),-real(0x27462ddLL<<32),
       reale(709630LL,0xdb94f1d6c533LL),
       // C4[16], coeff of eps^17, polynomial in n of order 6
-      real(-0x736f1dLL<<36),real(0x7c69888LL<<32),real(-0x6c179eLL<<36),
-      real(0x489ecb8LL<<32),real(-0x231fdfLL<<36),real(0xabf3e8LL<<32),
-      real(-0x18a7ad8LL<<28),reale(101375LL,0xb8d15471eae75LL),
+      -real(0x736f1dLL<<36),real(0x7c69888LL<<32),-real(0x6c179eLL<<36),
+      real(0x489ecb8LL<<32),-real(0x231fdfLL<<36),real(0xabf3e8LL<<32),
+      -real(0x18a7ad8LL<<28),reale(101375LL,0xb8d15471eae75LL),
       // C4[16], coeff of eps^16, polynomial in n of order 7
-      real(-0x6e9fd12LL<<32),real(0xca0272cLL<<32),real(-0x13c7b4d6LL<<32),
-      real(0x1a5f9bc8LL<<32),real(-0x1d54411aLL<<32),real(0x19dc2e64LL<<32),
-      real(-0xf47ecdeLL<<32),real(0x4284616cLL<<28),
+      -real(0x6e9fd12LL<<32),real(0xca0272cLL<<32),-real(0x13c7b4d6LL<<32),
+      real(0x1a5f9bc8LL<<32),-real(0x1d54411aLL<<32),real(0x19dc2e64LL<<32),
+      -real(0xf47ecdeLL<<32),real(0x4284616cLL<<28),
       reale(709630LL,0xdb94f1d6c533LL),
       // C4[17], coeff of eps^23, polynomial in n of order 0
-      real(-8968LL<<28),real(0x6ef59e61feaaea7LL),
+      -real(8968LL<<28),real(0x6ef59e61feaaea7LL),
       // C4[17], coeff of eps^22, polynomial in n of order 1
-      real(-118LL<<36),real(-309LL<<32),real(0x14ce0db25fc00bf5LL),
+      -real(118LL<<36),-real(309LL<<32),real(0x14ce0db25fc00bf5LL),
       // C4[17], coeff of eps^21, polynomial in n of order 2
-      real(-10703LL<<36),real(243304LL<<32),real(-0x121118LL<<28),
+      -real(10703LL<<36),real(243304LL<<32),-real(0x121118LL<<28),
       reale(6324LL,0xb043d1b40e32fLL),
       // C4[17], coeff of eps^20, polynomial in n of order 3
-      real(-711108LL<<36),real(125720LL<<36),real(17108LL<<36),
-      real(-136206LL<<32),reale(44272LL,0xd1dabbec63649LL),
+      -real(711108LL<<36),real(125720LL<<36),real(17108LL<<36),
+      -real(136206LL<<32),reale(44272LL,0xd1dabbec63649LL),
       // C4[17], coeff of eps^19, polynomial in n of order 4
-      real(-815566LL<<36),real(0x152c178LL<<32),real(-0x11aa77LL<<36),
-      real(0x8e8828LL<<32),real(-0x21c8758LL<<28),
+      -real(815566LL<<36),real(0x152c178LL<<32),-real(0x11aa77LL<<36),
+      real(0x8e8828LL<<32),-real(0x21c8758LL<<28),
       reale(44272LL,0xd1dabbec63649LL),
       // C4[17], coeff of eps^18, polynomial in n of order 5
-      real(0x303beeLL<<36),real(-0x28dbf8LL<<36),real(0x1aeb02LL<<36),
-      real(-840924LL<<36),real(254646LL<<36),real(-580027LL<<32),
+      real(0x303beeLL<<36),-real(0x28dbf8LL<<36),real(0x1aeb02LL<<36),
+      -real(840924LL<<36),real(254646LL<<36),-real(580027LL<<32),
       reale(44272LL,0xd1dabbec63649LL),
       // C4[17], coeff of eps^17, polynomial in n of order 6
-      real(801009LL<<36),real(-0x127c0a8LL<<32),real(0x17f756LL<<36),
-      real(-0x1a17998LL<<32),real(0x16aa7bLL<<36),real(-0xd46988LL<<32),
+      real(801009LL<<36),-real(0x127c0a8LL<<32),real(0x17f756LL<<36),
+      -real(0x1a17998LL<<32),real(0x16aa7bLL<<36),-real(0xd46988LL<<32),
       real(0x39873f8LL<<28),reale(44272LL,0xd1dabbec63649LL),
       // C4[18], coeff of eps^23, polynomial in n of order 0
-      real(-712LL<<32),real(0x3351994085c8a607LL),
+      -real(712LL<<32),real(0x3351994085c8a607LL),
       // C4[18], coeff of eps^22, polynomial in n of order 1
-      real(763LL<<36),real(-3618LL<<32),real(0x15fe66403955fe03LL),
+      real(763LL<<36),-real(3618LL<<32),real(0x15fe66403955fe03LL),
       // C4[18], coeff of eps^21, polynomial in n of order 2
-      real(728LL<<36),real(140LL<<36),real(-940LL<<32),
+      real(728LL<<36),real(140LL<<36),-real(940LL<<32),
       real(0x15fe66403955fe03LL),
       // C4[18], coeff of eps^20, polynomial in n of order 3
-      real(0x1460d6LL<<36),real(-0x10745cLL<<36),real(537586LL<<36),
-      real(-0x1f0644LL<<32),reale(46802LL,0xb1f5dc9acf78fLL),
+      real(0x1460d6LL<<36),-real(0x10745cLL<<36),real(537586LL<<36),
+      -real(0x1f0644LL<<32),reale(46802LL,0xb1f5dc9acf78fLL),
       // C4[18], coeff of eps^19, polynomial in n of order 4
-      real(-51319LL<<40),real(531468LL<<36),real(-250040LL<<36),
-      real(75012LL<<36),real(-169764LL<<32),reale(15600LL,0xe5fc9ede45285LL),
+      -real(51319LL<<40),real(531468LL<<36),-real(250040LL<<36),
+      real(75012LL<<36),-real(169764LL<<32),reale(15600LL,0xe5fc9ede45285LL),
       // C4[18], coeff of eps^18, polynomial in n of order 5
-      real(-0x124a17LL<<36),real(0x172094LL<<36),real(-0x18b441LL<<36),
-      real(0x152ccaLL<<36),real(-806379LL<<36),real(0x351a62LL<<32),
+      -real(0x124a17LL<<36),real(0x172094LL<<36),-real(0x18b441LL<<36),
+      real(0x152ccaLL<<36),-real(806379LL<<36),real(0x351a62LL<<32),
       reale(46802LL,0xb1f5dc9acf78fLL),
       // C4[19], coeff of eps^23, polynomial in n of order 0
-      real(-7864LL<<32),real(0x3617bd362c26857dLL),
+      -real(7864LL<<32),real(0x3617bd362c26857dLL),
       // C4[19], coeff of eps^22, polynomial in n of order 1
-      real(4LL<<44),real(-378LL<<36),reale(2596LL,0x737a284739077LL),
+      real(4LL<<44),-real(378LL<<36),reale(2596LL,0x737a284739077LL),
       // C4[19], coeff of eps^21, polynomial in n of order 2
-      real(-473LL<<40),real(3736LL<<36),real(-14100LL<<32),
+      -real(473LL<<40),real(3736LL<<36),-real(14100LL<<32),
       real(0x172ebece12ebf011LL),
       // C4[19], coeff of eps^20, polynomial in n of order 3
-      real(4758LL<<40),real(-2212LL<<40),real(658LL<<40),real(-23688LL<<32),
+      real(4758LL<<40),-real(2212LL<<40),real(658LL<<40),-real(23688LL<<32),
       reale(2596LL,0x737a284739077LL),
       // C4[19], coeff of eps^19, polynomial in n of order 4
-      real(4810LL<<40),real(-80808LL<<36),real(4277LL<<40),real(-39480LL<<36),
+      real(4810LL<<40),-real(80808LL<<36),real(4277LL<<40),-real(39480LL<<36),
       real(169764LL<<32),reale(2596LL,0x737a284739077LL),
       // C4[20], coeff of eps^23, polynomial in n of order 0
-      real(-4LL<<36),real(0x1f5feefdb1f0c4fLL),
+      -real(4LL<<36),real(0x1f5feefdb1f0c4fLL),
       // C4[20], coeff of eps^22, polynomial in n of order 1
-      real(1516LL<<40),real(-357LL<<40),reale(2729LL,0x9a383778d2ed9LL),
+      real(1516LL<<40),-real(357LL<<40),reale(2729LL,0x9a383778d2ed9LL),
       // C4[20], coeff of eps^21, polynomial in n of order 2
-      real(-1992LL<<40),real(588LL<<40),real(-1316LL<<36),
+      -real(1992LL<<40),real(588LL<<40),-real(1316LL<<36),
       reale(2729LL,0x9a383778d2ed9LL),
       // C4[20], coeff of eps^20, polynomial in n of order 3
-      real(-4797LL<<40),real(4018LL<<40),real(-2303LL<<40),real(9870LL<<36),
+      -real(4797LL<<40),real(4018LL<<40),-real(2303LL<<40),real(9870LL<<36),
       reale(2729LL,0x9a383778d2ed9LL),
       // C4[21], coeff of eps^23, polynomial in n of order 0
-      real(-5308LL<<36),reale(2862LL,0xc0f646aa6cd3bLL),
+      -real(5308LL<<36),reale(2862LL,0xc0f646aa6cd3bLL),
       // C4[21], coeff of eps^22, polynomial in n of order 1
-      real(11LL<<44),real(-392LL<<36),real(0x3ba4052178e24469LL),
+      real(11LL<<44),-real(392LL<<36),real(0x3ba4052178e24469LL),
       // C4[21], coeff of eps^21, polynomial in n of order 2
-      real(3784LL<<40),real(-2156LL<<40),real(9212LL<<36),
+      real(3784LL<<40),-real(2156LL<<40),real(9212LL<<36),
       reale(2862LL,0xc0f646aa6cd3bLL),
       // C4[22], coeff of eps^23, polynomial in n of order 0
-      real(-2LL<<40),real(0x5ac8f5f3162ebfdLL),
+      -real(2LL<<40),real(0x5ac8f5f3162ebfdLL),
       // C4[22], coeff of eps^22, polynomial in n of order 1
-      real(-184LL<<40),real(49LL<<40),real(0x1105ae1d9428c3f7LL),
+      -real(184LL<<40),real(49LL<<40),real(0x1105ae1d9428c3f7LL),
       // C4[23], coeff of eps^23, polynomial in n of order 0
       real(2LL<<40),real(0xc5e28ed2c935abLL),
     };
@@ -1713,66 +1713,66 @@ namespace GeographicLib {
       // C4[0], coeff of eps^26, polynomial in n of order 0
       real(4654LL),real(0x1389ed75LL),
       // C4[0], coeff of eps^25, polynomial in n of order 1
-      real(-331600LL),real(247203LL),real(0x1321b8829LL),
+      -real(331600LL),real(247203LL),real(0x1321b8829LL),
       // C4[0], coeff of eps^24, polynomial in n of order 2
-      real(-0x723868100LL),real(0x38a8b9d80LL),real(0xdffa9ae8LL),
+      -real(0x723868100LL),real(0x38a8b9d80LL),real(0xdffa9ae8LL),
       real(0xbd65c2e6062dLL),
       // C4[0], coeff of eps^23, polynomial in n of order 3
-      real(-0x4a56872d110LL),real(0x30d818a0d20LL),real(-0x183639ebbb0LL),
+      -real(0x4a56872d110LL),real(0x30d818a0d20LL),-real(0x183639ebbb0LL),
       real(0x1207973318dLL),real(0x472c0a3d3d1ee9LL),
       // C4[0], coeff of eps^22, polynomial in n of order 4
-      real(-0x743607eea80LL),real(0x5536ade42a0LL),real(-0x37e9933c940LL),
+      -real(0x743607eea80LL),real(0x5536ade42a0LL),-real(0x37e9933c940LL),
       real(0x1bb15f964e0LL),real(0x6d39be23aaLL),real(0x472c0a3d3d1ee9LL),
       // C4[0], coeff of eps^21, polynomial in n of order 5
-      real(-0x1a80e82073690LL),real(0x1485d9e7af5c0LL),real(-0xf039fc9e8ff0LL),
-      real(0x9d5f26153ce0LL),real(-0x4ddf0f750f50LL),real(0x39e793daa6ebLL),
+      -real(0x1a80e82073690LL),real(0x1485d9e7af5c0LL),-real(0xf039fc9e8ff0LL),
+      real(0x9d5f26153ce0LL),-real(0x4ddf0f750f50LL),real(0x39e793daa6ebLL),
       real(0xadde5e94360277dLL),
       // C4[0], coeff of eps^20, polynomial in n of order 6
-      real(-0xe72f9d31220580LL),real(0xb817a196612bc0LL),
-      real(-0x8e0a680913c900LL),real(0x67a3067b290a40LL),
-      real(-0x43c43707776c80LL),real(0x217ef7b84400c0LL),
+      -real(0xe72f9d31220580LL),real(0xb817a196612bc0LL),
+      -real(0x8e0a680913c900LL),real(0x67a3067b290a40LL),
+      -real(0x43c43707776c80LL),real(0x217ef7b84400c0LL),
       real(0x83b895ad56e94LL),reale(16517LL,0x8519000aea763LL),
       // C4[0], coeff of eps^19, polynomial in n of order 7
-      real(-0x5be35cb0a188d670LL),real(0x49fb9f6e0e1fa420LL),
-      real(-0x3a970b1601b36050LL),real(0x2d0406e3051baec0LL),
-      real(-0x20bde41e80026c30LL),real(0x155cea808b65d160LL),
-      real(-0xa8bc4b2c853c610LL),real(0x7d3acd77deac86fLL),
+      -real(0x5be35cb0a188d670LL),real(0x49fb9f6e0e1fa420LL),
+      -real(0x3a970b1601b36050LL),real(0x2d0406e3051baec0LL),
+      -real(0x20bde41e80026c30LL),real(0x155cea808b65d160LL),
+      -real(0xa8bc4b2c853c610LL),real(0x7d3acd77deac86fLL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^18, polynomial in n of order 8
       reale(-2220LL,0x6aa37b2cb6f00LL),real(0x6f523368eabed3a0LL),
-      real(-0x58df9f4050ea48c0LL),real(0x45eb9b162449f0e0LL),
-      real(-0x35736f4da3b86880LL),real(0x26bb8b2d01772220LL),
-      real(-0x19350a3e2b857840LL),real(0xc6cd21a34a65f60LL),
+      -real(0x58df9f4050ea48c0LL),real(0x45eb9b162449f0e0LL),
+      -real(0x35736f4da3b86880LL),real(0x26bb8b2d01772220LL),
+      -real(0x19350a3e2b857840LL),real(0xc6cd21a34a65f60LL),
       real(0x30a9f24aaae2862LL),reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^17, polynomial in n of order 9
       reale(-3521LL,0x793be71994bd0LL),reale(2768LL,0x78979286ec480LL),
       reale(-2192LL,0x543644b2a6130LL),real(0x6c38e96882e6a560LL),
-      real(-0x54765a5d7300bb70LL),real(0x402d11108cfc5240LL),
-      real(-0x2e4c264c23518e10LL),real(0x1e09e0cfb5ca8720LL),
-      real(-0xec7bce3f9449ab0LL),real(0xaf0b9139605a58dLL),
+      -real(0x54765a5d7300bb70LL),real(0x402d11108cfc5240LL),
+      -real(0x2e4c264c23518e10LL),real(0x1e09e0cfb5ca8720LL),
+      -real(0xec7bce3f9449ab0LL),real(0xaf0b9139605a58dLL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^16, polynomial in n of order 10
       reale(-6137LL,0xadddc51340600LL),reale(4597LL,0xf56d1171d1b00LL),
       reale(-3532LL,0x1efef8069b800LL),reale(2747LL,0xc7a53bf3c9500LL),
       reale(-2143LL,0x63da405706a00LL),real(0x677abbdfa4dcef00LL),
-      real(-0x4e0ad45efdfc2400LL),real(0x37ff2b5bd74de900LL),
-      real(-0x2432b6ddc0003200LL),real(0x11c5dbb8178f4300LL),
+      -real(0x4e0ad45efdfc2400LL),real(0x37ff2b5bd74de900LL),
+      -real(0x2432b6ddc0003200LL),real(0x11c5dbb8178f4300LL),
       real(0x4536f43fdb6a550LL),reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^15, polynomial in n of order 11
       reale(-13103LL,0x6909fee14590LL),reale(8724LL,0xbd02d5fc04060LL),
       reale(-6235LL,0x97202aa8d6e30LL),reale(4636LL,0xd96d16348cb80LL),
       reale(-3526LL,0xb8daae79484d0LL),reale(2702LL,0xc781c601a46a0LL),
       reale(-2063LL,0x846e4aa048d70LL),real(0x60521f1f549575c0LL),
-      real(-0x44a70474ce1373f0LL),real(0x2c2e0084319d1ce0LL),
-      real(-0x15a2a473a1b17b50LL),real(0xff41fd49dab95d3LL),
+      -real(0x44a70474ce1373f0LL),real(0x2c2e0084319d1ce0LL),
+      -real(0x15a2a473a1b17b50LL),real(0xff41fd49dab95d3LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^14, polynomial in n of order 12
       reale(-63392LL,0x8f5b768236180LL),reale(23343LL,0xc5a3f9fbbcce0LL),
       reale(-13454LL,0xd872db320c540LL),reale(8911LL,0x777a0315423a0LL),
       reale(-6324LL,0xd8eb075800100LL),reale(4656LL,0xe8c5e07109660LL),
       reale(-3492LL,0xf941a026f1cc0LL),reale(2621LL,0xb84b17c4ad20LL),
-      real(-0x78f908534453df80LL),real(0x55814182d129efe0LL),
-      real(-0x36b7bc0c02deebc0LL),real(0x1ab5b755becbe6a0LL),
+      -real(0x78f908534453df80LL),real(0x55814182d129efe0LL),
+      -real(0x36b7bc0c02deebc0LL),real(0x1ab5b755becbe6a0LL),
       real(0x672760e43e7e5beLL),reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^13, polynomial in n of order 13
       reale(112706LL,0xdfd869d806ed0LL),reale(29093LL,0xf8d3fc140cbc0LL),
@@ -1780,8 +1780,8 @@ namespace GeographicLib {
       reale(-13823LL,0x2bd795d3b3c90LL),reale(9095LL,0xad3608e2bd280LL),
       reale(-6395LL,0xdbeb183113c70LL),reale(4646LL,0x4bdec656d47e0LL),
       reale(-3414LL,0x89f66294fb250LL),reale(2482LL,0x54f2fd0561940LL),
-      real(-0x6c7d891fb0df15d0LL),real(0x44efe2727b65d2a0LL),
-      real(-0x2183dc0de2efcff0LL),real(0x189262ba581c6bf1LL),
+      -real(0x6c7d891fb0df15d0LL),real(0x44efe2727b65d2a0LL),
+      -real(0x2183dc0de2efcff0LL),real(0x189262ba581c6bf1LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^12, polynomial in n of order 14
       reale(22421LL,0x80a7495217980LL),reale(-122682LL,0xda49329f8b540LL),
@@ -1790,7 +1790,7 @@ namespace GeographicLib {
       reale(-14210LL,0xb0aaeb2f34a00LL),reale(9268LL,0x742c2dd2c8fc0LL),
       reale(-6434LL,0xdd790f94c4f80LL),reale(4585LL,0x3348b70941340LL),
       reale(-3267LL,0xc4259dd2ce500LL),reale(2252LL,0x1340649a90ec0LL),
-      real(-0x589f5d02f1d02580LL),real(0x2adce3e44e715240LL),
+      -real(0x589f5d02f1d02580LL),real(0x2adce3e44e715240LL),
       real(0xa36591ccc5a22bcLL),reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^11, polynomial in n of order 15
       real(0x3845a63e874b7f90LL),reale(2990LL,0x790a9d44cfaa0LL),
@@ -1800,7 +1800,7 @@ namespace GeographicLib {
       reale(-14606LL,0x539211082b010LL),reale(9413LL,0x816443bfd6920LL),
       reale(-6416LL,0xcea11270f6b30LL),reale(4438LL,0xfed32587f3cc0LL),
       reale(-3003LL,0x5445fd3251450LL),real(0x74ba3cd78aa5e860LL),
-      real(-0x3812b2b32b2f8090LL),real(0x28bab2d4ac11f317LL),
+      -real(0x3812b2b32b2f8090LL),real(0x28bab2d4ac11f317LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^10, polynomial in n of order 16
       real(0xbcd4fd6df5b2600LL),real(0x17fed2a1d906c020LL),
@@ -1821,7 +1821,7 @@ namespace GeographicLib {
       reale(-78782LL,0xbf80f036e87b0LL),reale(27920LL,0xd85d0c9896a60LL),
       reale(-15348LL,0x42ae88954f010LL),reale(9468LL,0xaa167d507e040LL),
       reale(-5982LL,0x32ead41741270LL),reale(3570LL,0xf062f37e99e20LL),
-      real(-0x68dc53d94dbff530LL),real(0x4ae92c9a7a683bf5LL),
+      -real(0x68dc53d94dbff530LL),real(0x4ae92c9a7a683bf5LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[0], coeff of eps^8, polynomial in n of order 18
       real(0x1b54ebcbbde1f00LL),real(0x2947b9527677980LL),
@@ -1945,56 +1945,56 @@ namespace GeographicLib {
       // C4[1], coeff of eps^25, polynomial in n of order 1
       real(0x1516d30LL),real(0x543e3bLL),real(0xf784431927LL),
       // C4[1], coeff of eps^24, polynomial in n of order 2
-      real(0x6e1bbfa00LL),real(-0x3b5106500LL),real(0x29fefd0b8LL),
+      real(0x6e1bbfa00LL),-real(0x3b5106500LL),real(0x29fefd0b8LL),
       real(0x2383148b21287LL),
       // C4[1], coeff of eps^23, polynomial in n of order 3
-      real(0x165661ad6b70LL),real(-0x1009b31cabe0LL),real(0x7444963bdd0LL),
+      real(0x165661ad6b70LL),-real(0x1009b31cabe0LL),real(0x7444963bdd0LL),
       real(0x1d0511c64f5LL),real(0x42b94999694cfa7LL),
       // C4[1], coeff of eps^22, polynomial in n of order 4
-      real(0xa226b42100LL),real(-0x82b9c957c0LL),real(0x4dd9f4b480LL),
-      real(-0x2a87741140LL),real(0x1dc9ee09baLL),real(0x13691a10b39411LL),
+      real(0xa226b42100LL),-real(0x82b9c957c0LL),real(0x4dd9f4b480LL),
+      -real(0x2a87741140LL),real(0x1dc9ee09baLL),real(0x13691a10b39411LL),
       // C4[1], coeff of eps^21, polynomial in n of order 5
-      real(0x2b50c847e5bec70LL),real(-0x25172ad2adc8640LL),
-      real(0x187490c86e06510LL),real(-0x11cf5b364679120LL),
+      real(0x2b50c847e5bec70LL),-real(0x25172ad2adc8640LL),
+      real(0x187490c86e06510LL),-real(0x11cf5b364679120LL),
       real(0x7e9f37da26e7b0LL),real(0x1f979b01bfd5e3LL),
       reale(227941LL,0xc6590096a3923LL),
       // C4[1], coeff of eps^20, polynomial in n of order 6
-      real(0x84a641c077c100LL),real(-0x75601a6b667780LL),
-      real(0x51157a29d94600LL),real(-0x4247925ad10480LL),
-      real(0x269068d8c2ab00LL),real(-0x15748d5a64a980LL),
+      real(0x84a641c077c100LL),-real(0x75601a6b667780LL),
+      real(0x51157a29d94600LL),-real(0x4247925ad10480LL),
+      real(0x269068d8c2ab00LL),-real(0x15748d5a64a980LL),
       real(0xed190d6b360a4LL),reale(29731LL,0x892d0013a607fLL),
       // C4[1], coeff of eps^19, polynomial in n of order 7
-      real(0x57e3d5e3e8a64d50LL),real(-0x4ee151925712ac60LL),
-      real(0x379f60f9d8160ef0LL),real(-0x3036f6417460ec40LL),
-      real(0x1eece80c1c746690LL),real(-0x16f21d696f523420LL),
+      real(0x57e3d5e3e8a64d50LL),-real(0x4ee151925712ac60LL),
+      real(0x379f60f9d8160ef0LL),-real(0x3036f6417460ec40LL),
+      real(0x1eece80c1c746690LL),-real(0x16f21d696f523420LL),
       real(0x9ef6bfafd871830LL),real(0x27a3f6720674fabLL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^18, polynomial in n of order 8
-      reale(2128LL,0x469250df87e00LL),real(-0x76ff6f2ca68ee740LL),
-      real(0x544ea56af984a280LL),real(-0x4b3b3c5b1f3b3dc0LL),
-      real(0x324e822f05811f00LL),real(-0x29dd8ae6f4502040LL),
-      real(0x179c3b6434632b80LL),real(-0xd7628385c5d56c0LL),
+      reale(2128LL,0x469250df87e00LL),-real(0x76ff6f2ca68ee740LL),
+      real(0x544ea56af984a280LL),-real(0x4b3b3c5b1f3b3dc0LL),
+      real(0x324e822f05811f00LL),-real(0x29dd8ae6f4502040LL),
+      real(0x179c3b6434632b80LL),-real(0xd7628385c5d56c0LL),
       real(0x91fdd6e000a7926LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^17, polynomial in n of order 9
       reale(3396LL,0xc29d3f547be10LL),reale(-2964LL,0x99a8488284e80LL),
-      reale(2082LL,0xa3af2d55cd2f0LL),real(-0x74e3fc23ed074b20LL),
-      real(0x4f51e11c0cc64dd0LL),real(-0x45cc62cad46028c0LL),
-      real(0x2b210825284d5ab0LL),real(-0x20cfde05bc67de60LL),
+      reale(2082LL,0xa3af2d55cd2f0LL),-real(0x74e3fc23ed074b20LL),
+      real(0x4f51e11c0cc64dd0LL),-real(0x45cc62cad46028c0LL),
+      real(0x2b210825284d5ab0LL),-real(0x20cfde05bc67de60LL),
       real(0xdb6584e22cc2590LL),real(0x36aae0ede944991LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^16, polynomial in n of order 10
       reale(5994LL,0xfab7bd428a400LL),reale(-4920LL,0x276aa3c67f600LL),
       reale(3376LL,0x641d9d71fd000LL),reale(-2976LL,0xcdf2cc6d9ea00LL),
-      real(0x7dd1b5a4fb9ffc00LL),real(-0x712cdc1424704200LL),
-      real(0x486493a43f86e800LL),real(-0x3daeb06e6a40ce00LL),
-      real(0x21506b8426325400LL),real(-0x13a656589a61fa00LL),
+      real(0x7dd1b5a4fb9ffc00LL),-real(0x712cdc1424704200LL),
+      real(0x486493a43f86e800LL),-real(0x3daeb06e6a40ce00LL),
+      real(0x21506b8426325400LL),-real(0x13a656589a61fa00LL),
       real(0xcfa4dcbf923eff0LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^15, polynomial in n of order 11
       reale(13117LL,0x6cbddabc52ed0LL),reale(-9319LL,0x570c1564bb3e0LL),
       reale(6040LL,0x7b2fdab4ba7f0LL),reale(-5023LL,0xdd4767cbca180LL),
       reale(3330LL,0x281af37e2710LL),reale(-2969LL,0xba9176a5d3f20LL),
-      real(0x7764510336be0030LL),real(-0x6af4843f7d4f5f40LL),
-      real(0x3eba1ed514e18750LL),real(-0x31669b90045c25a0LL),
+      real(0x7764510336be0030LL),-real(0x6af4843f7d4f5f40LL),
+      real(0x3eba1ed514e18750LL),-real(0x31669b90045c25a0LL),
       real(0x13a17c0101ce1070LL),real(0x4e2a88c78d66acfLL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^14, polynomial in n of order 12
@@ -2002,8 +2002,8 @@ namespace GeographicLib {
       reale(13399LL,0xd5b954b9ffe80LL),reale(-9633LL,0xa008523a478c0LL),
       reale(6058LL,0x6185fb910e200LL),reale(-5123LL,0xdb0ce1cd90340LL),
       reale(3246LL,0x498e64bf8a580LL),reale(-2930LL,0x39f0ac65811c0LL),
-      real(0x6e041fee5d419100LL),real(-0x60b53ba76d5f13c0LL),
-      real(0x3113d4fc9085ec80LL),real(-0x1e6533c87b7d2540LL),
+      real(0x6e041fee5d419100LL),-real(0x60b53ba76d5f13c0LL),
+      real(0x3113d4fc9085ec80LL),-real(0x1e6533c87b7d2540LL),
       real(0x1357622acbb7b13aLL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^13, polynomial in n of order 13
       reale(-121533LL,0x1baeb1d428990LL),reale(-15941LL,0xe8aacebc2ecc0LL),
@@ -2011,7 +2011,7 @@ namespace GeographicLib {
       reale(13667LL,0x35bfe1bb73850LL),reale(-9985LL,0x1b0b3e3706880LL),
       reale(6033LL,0x4bb2ec6997cb0LL),reale(-5213LL,0xaba6ff9bbc060LL),
       reale(3108LL,0x7a1250dedaf10LL),reale(-2837LL,0x43aa0f4a62440LL),
-      real(0x605fcd3581f88b70LL),real(-0x4fb9f3b2da8b6fe0LL),
+      real(0x605fcd3581f88b70LL),-real(0x4fb9f3b2da8b6fe0LL),
       real(0x1d6444fcd70bcdd0LL),real(0x74c81d1452803b5LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^12, polynomial in n of order 14
@@ -2021,10 +2021,10 @@ namespace GeographicLib {
       reale(13898LL,0x35bd350d73c00LL),reale(-10385LL,0x6a6f64ae0c380LL),
       reale(5941LL,0x73f13b5b28500LL),reale(-5278LL,0xf9b7b76b40a80LL),
       reale(2891LL,0x688dd5accde00LL),reale(-2647LL,0xe431f84a18980LL),
-      real(0x4c6028727ac69700LL),real(-0x32eae1a8c2946f80LL),
+      real(0x4c6028727ac69700LL),-real(0x32eae1a8c2946f80LL),
       real(0x1ea30b56650e6834LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^11, polynomial in n of order 15
-      real(-0x26534490cad1dfb0LL),reale(-2195LL,0xeb57a14506a20LL),
+      -real(0x26534490cad1dfb0LL),reale(-2195LL,0xeb57a14506a20LL),
       reale(-18677LL,0x670e626e50cf0LL),reale(115088LL,0x35b741cc34140LL),
       reale(-134246LL,0x7df8512baaf90LL),reale(-12736LL,0xad44a3e04060LL),
       reale(77916LL,0x32c371fd8ec30LL),reale(-28919LL,0x4c92ea7340b80LL),
@@ -2034,19 +2034,19 @@ namespace GeographicLib {
       real(0x2e7aab3dc406b2b0LL),real(0xb7e588c69951913LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^10, polynomial in n of order 16
-      real(-0x6ec9ec72fa83400LL),real(-0xee6121f9ed5ac40LL),
-      real(-0x2698258da225a980LL),reale(-2224LL,0x7d6de58dd7f40LL),
+      -real(0x6ec9ec72fa83400LL),-real(0xee6121f9ed5ac40LL),
+      -real(0x2698258da225a980LL),reale(-2224LL,0x7d6de58dd7f40LL),
       reale(-19089LL,0xb046a19e77900LL),reale(119080LL,0xff5c72a1c6ec0LL),
       reale(-142118LL,0x83c214fc48b80LL),reale(-10118LL,0x917ce647b7a40LL),
       reale(82086LL,0xede392256e600LL),reale(-30796LL,0x12a37b61ef9c0LL),
       reale(14073LL,0x47ff3f3e080LL),reale(-11360LL,0x8927e4d9b4540LL),
       reale(5387LL,0x791e9eab0d300LL),reale(-5154LL,0x32223c714b4c0LL),
-      real(0x7fb4f5b53eb31580LL),real(-0x5fcfbdbbdde05fc0LL),
+      real(0x7fb4f5b53eb31580LL),-real(0x5fcfbdbbdde05fc0LL),
       real(0x34b713242f2d630eLL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^9, polynomial in n of order 17
-      real(-0x20f38bbaca812f0LL),real(-0x39b499036d51b00LL),
-      real(-0x6e4d3364d687b10LL),real(-0xee56650d93fe5a0LL),
-      real(-0x26cbb66f58b91d30LL),reale(-2251LL,0x167a106157bc0LL),
+      -real(0x20f38bbaca812f0LL),-real(0x39b499036d51b00LL),
+      -real(0x6e4d3364d687b10LL),-real(0xee56650d93fe5a0LL),
+      -real(0x26cbb66f58b91d30LL),reale(-2251LL,0x167a106157bc0LL),
       reale(-19511LL,0xcecb0f0cd52b0LL),reale(123456LL,0xc66bc06159520LL),
       reale(-151363LL,0x505ffa032090LL),reale(-6380LL,0xf55ff8a36f280LL),
       reale(86843LL,0xd7e050f079870LL),reale(-33197LL,0x80ee9e4da1fe0LL),
@@ -2055,22 +2055,22 @@ namespace GeographicLib {
       real(0x4e466dbc0d5cf410LL),real(0x132845ea2b7be139LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^8, polynomial in n of order 18
-      real(-0xcaab4ddd8d4600LL),real(-0x13c31d1cbb16d00LL),
-      real(-0x207a98d99de3000LL),real(-0x390c3dedd68b300LL),
-      real(-0x6d71551ca261a00LL),real(-0xed90e825b918900LL),
-      real(-0x26e62c786e462400LL),reale(-2275LL,0x445093a1ef100LL),
+      -real(0xcaab4ddd8d4600LL),-real(0x13c31d1cbb16d00LL),
+      -real(0x207a98d99de3000LL),-real(0x390c3dedd68b300LL),
+      -real(0x6d71551ca261a00LL),-real(0xed90e825b918900LL),
+      -real(0x26e62c786e462400LL),reale(-2275LL,0x445093a1ef100LL),
       reale(-19935LL,0xe24d995a09200LL),reale(128254LL,0x3ade3c4739b00LL),
-      reale(-162384LL,0x54cbec0ece800LL),real(-0x3992c873ce48ab00LL),
+      reale(-162384LL,0x54cbec0ece800LL),-real(0x3992c873ce48ab00LL),
       reale(92230LL,0x4a4593a3dbe00LL),reale(-36419LL,0xcbaefd1b4ff00LL),
       reale(13110LL,0x864dfe531f400LL),reale(-12476LL,0xf5c1226b77900LL),
       reale(3771LL,0xc13fa20286a00LL),reale(-3470LL,0xc9a2f8989a300LL),
       real(0x661b6984b64e65f8LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^7, polynomial in n of order 19
-      real(-0x5b1678b2b96e30LL),real(-0x83e7d604d6e1a0LL),
-      real(-0xc5c1bd21f06210LL),real(-0x135402446a1f500LL),
-      real(-0x1fd9e061288aff0LL),real(-0x381fb1c2d0ea860LL),
-      real(-0x6c176a9d32ee3d0LL),real(-0xebcbb379725c7c0LL),
-      real(-0x26dc285f96da89b0LL),reale(-2293LL,0x73b088641e0e0LL),
+      -real(0x5b1678b2b96e30LL),-real(0x83e7d604d6e1a0LL),
+      -real(0xc5c1bd21f06210LL),-real(0x135402446a1f500LL),
+      -real(0x1fd9e061288aff0LL),-real(0x381fb1c2d0ea860LL),
+      -real(0x6c176a9d32ee3d0LL),-real(0xebcbb379725c7c0LL),
+      -real(0x26dc285f96da89b0LL),reale(-2293LL,0x73b088641e0e0LL),
       reale(-20345LL,0x12b405f9bd270LL),reale(133496LL,0x33ba4ee858580LL),
       reale(-175743LL,0x9b38f6004a490LL),reale(7288LL,0xff81f26b85a20LL),
       reale(98139LL,0x5735ff04360b0LL),reale(-41011LL,0x93a23c36592c0LL),
@@ -2078,142 +2078,142 @@ namespace GeographicLib {
       reale(2204LL,0x9aaf76ecb66f0LL),real(0x2076d1ad78dbacf7LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^6, polynomial in n of order 20
-      real(-0x2d4d049c656700LL),real(-0x3e4af5e8d022c0LL),
-      real(-0x57ced7fe851580LL),real(-0x7f7034131ef240LL),
-      real(-0xbf83d85dea6c00LL),real(-0x12c465612feb5c0LL),
-      real(-0x1f04ac518a30280LL),real(-0x36d88216b840540LL),
-      real(-0x6a13494183c7100LL),real(-0xe8a2e478ed378c0LL),
-      real(-0x269ca36792944f80LL),reale(-2301LL,0x84520bafe57c0LL),
+      -real(0x2d4d049c656700LL),-real(0x3e4af5e8d022c0LL),
+      -real(0x57ced7fe851580LL),-real(0x7f7034131ef240LL),
+      -real(0xbf83d85dea6c00LL),-real(0x12c465612feb5c0LL),
+      -real(0x1f04ac518a30280LL),-real(0x36d88216b840540LL),
+      -real(0x6a13494183c7100LL),-real(0xe8a2e478ed378c0LL),
+      -real(0x269ca36792944f80LL),reale(-2301LL,0x84520bafe57c0LL),
       reale(-20715LL,0x8feafafd7ca00LL),reale(139156LL,0x8278406ccd440LL),
       reale(-192234LL,0xd634ab69a4380LL),reale(20133LL,0xdb20ab18364c0LL),
       reale(103930LL,0xc444b13858500LL),reale(-48023LL,0x7a63881fd7140LL),
       reale(8312LL,0x1287962dbf680LL),reale(-10955LL,0xe96efa02661c0LL),
       reale(3795LL,0x3bfe126c62e22LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^5, polynomial in n of order 21
-      real(-0x1802918882e770LL),real(-0x1fcd949a6860c0LL),
-      real(-0x2aeab9b7d2f010LL),real(-0x3b2acc792185e0LL),
-      real(-0x539feddcdda2b0LL),real(-0x79b43080aca700LL),
-      real(-0xb76e50170e2350LL),real(-0x1207f374f78a820LL),
-      real(-0x1de74f0a09e95f0LL),real(-0x351484156246d40LL),
-      real(-0x6722781c7da1e90LL),real(-0xe37fba15ed8da60LL),
-      real(-0x260d3a8a453ee130LL),reale(-2293LL,0xda737b59d2c80LL),
+      -real(0x1802918882e770LL),-real(0x1fcd949a6860c0LL),
+      -real(0x2aeab9b7d2f010LL),-real(0x3b2acc792185e0LL),
+      -real(0x539feddcdda2b0LL),-real(0x79b43080aca700LL),
+      -real(0xb76e50170e2350LL),-real(0x1207f374f78a820LL),
+      -real(0x1de74f0a09e95f0LL),-real(0x351484156246d40LL),
+      -real(0x6722781c7da1e90LL),-real(0xe37fba15ed8da60LL),
+      -real(0x260d3a8a453ee130LL),reale(-2293LL,0xda737b59d2c80LL),
       reale(-20990LL,0xcbee433bffe30LL),reale(145073LL,0x9b58d1932c360LL),
       reale(-212948LL,0xbbc1f33985b90LL),reale(41274LL,0x9a63d1cc50640LL),
       reale(107042LL,0xff9bf7f6712f0LL),reale(-59295LL,0xb696ab3f1120LL),
       reale(2833LL,0xc664f5dce0050LL),real(0x17b85ffcea47049dLL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^4, polynomial in n of order 22
-      real(-0xd20723e198100LL),real(-0x10e999b2026480LL),
-      real(-0x161c2993f30e00LL),real(-0x1d62585afd4f80LL),
-      real(-0x27ca0dc8a2fb00LL),real(-0x370cc97a8ce280LL),
-      real(-0x4e170b46a3d800LL),real(-0x7213d21df5ad80LL),
-      real(-0xac9b82d7503500LL),real(-0x1109444f53c4080LL),
-      real(-0x1c6019c5f02a200LL),real(-0x329a7eb49a52b80LL),
-      real(-0x62d84097135af00LL),real(-0xdb6f2c88eb4fe80LL),
-      real(-0x2502e63c01a3ec00LL),reale(-2257LL,0x7c761ad4fb680LL),
+      -real(0xd20723e198100LL),-real(0x10e999b2026480LL),
+      -real(0x161c2993f30e00LL),-real(0x1d62585afd4f80LL),
+      -real(0x27ca0dc8a2fb00LL),-real(0x370cc97a8ce280LL),
+      -real(0x4e170b46a3d800LL),-real(0x7213d21df5ad80LL),
+      -real(0xac9b82d7503500LL),-real(0x1109444f53c4080LL),
+      -real(0x1c6019c5f02a200LL),-real(0x329a7eb49a52b80LL),
+      -real(0x62d84097135af00LL),-real(0xdb6f2c88eb4fe80LL),
+      -real(0x2502e63c01a3ec00LL),reale(-2257LL,0x7c761ad4fb680LL),
       reale(-21064LL,0x3d6bd08981700LL),reale(150710LL,0x347c6ec646380LL),
       reale(-239156LL,0xeee1298e3ca00LL),reale(78297LL,0xeac3242447880LL),
       reale(97157LL,0xffcea47049d00LL),reale(-74488LL,0x33590a76b6580LL),
       reale(11841LL,0x219395a415cbcLL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^3, polynomial in n of order 23
-      real(-0x7207334f38cb0LL),real(-0x8fe6a0f540760LL),
-      real(-0xb7c4f4df6c510LL),real(-0xedcd97a176940LL),
-      real(-0x1384e0d9162770LL),real(-0x1a108f169c7320LL),
-      real(-0x2378674e3fafd0LL),real(-0x3154606a2c6100LL),
-      real(-0x465a9ded7c5a30LL),real(-0x675a79a8aa6ee0LL),
-      real(-0x9d4a8ab99e2290LL),real(-0xf9e328cb49d8c0LL),
-      real(-0x1a2ce594ece04f0LL),real(-0x2efbcc23543daa0LL),
-      real(-0x5c688ee5939fd50LL),real(-0xceb90d2fccdb080LL),
-      real(-0x2331240c282307b0LL),reale(-2174LL,0xba9d6617169a0LL),
+      -real(0x7207334f38cb0LL),-real(0x8fe6a0f540760LL),
+      -real(0xb7c4f4df6c510LL),-real(0xedcd97a176940LL),
+      -real(0x1384e0d9162770LL),-real(0x1a108f169c7320LL),
+      -real(0x2378674e3fafd0LL),-real(0x3154606a2c6100LL),
+      -real(0x465a9ded7c5a30LL),-real(0x675a79a8aa6ee0LL),
+      -real(0x9d4a8ab99e2290LL),-real(0xf9e328cb49d8c0LL),
+      -real(0x1a2ce594ece04f0LL),-real(0x2efbcc23543daa0LL),
+      -real(0x5c688ee5939fd50LL),-real(0xceb90d2fccdb080LL),
+      -real(0x2331240c282307b0LL),reale(-2174LL,0xba9d6617169a0LL),
       reale(-20717LL,0xbd20dfe74dff0LL),reale(154405LL,0x43613e2a37c0LL),
       reale(-270828LL,0x13bcc8d3cbd90LL),reale(146546LL,0xa61bf3c2f7de0LL),
       reale(26313LL,0x9ff2a1de69530LL),reale(-32564LL,0xe3aa247cc40fbLL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^2, polynomial in n of order 24
-      real(-0x39a9fc22d9600LL),real(-0x47a4ffa857140LL),
-      real(-0x59ea353148580LL),real(-0x721982b3023c0LL),
-      real(-0x9291e22ef9d00LL),real(-0xbeda9ea6fc240LL),
-      real(-0xfc517cd616480LL),real(-0x1535335443d4c0LL),
-      real(-0x1d14474c2c6400LL),real(-0x28c4706fdbe340LL),
-      real(-0x3aa43e35a32380LL),real(-0x56eefde83775c0LL),
-      real(-0x859522b6982b00LL),real(-0xd663f0e8861440LL),
-      real(-0x16b2ad2884e0280LL),real(-0x2932441ccc746c0LL),
-      real(-0x51f4ee722e73200LL),real(-0xb97e18f372a9540LL),
-      real(-0x1ff5b9ebacd64180LL),real(-0x7d04fcecbaaf87c0LL),
+      -real(0x39a9fc22d9600LL),-real(0x47a4ffa857140LL),
+      -real(0x59ea353148580LL),-real(0x721982b3023c0LL),
+      -real(0x9291e22ef9d00LL),-real(0xbeda9ea6fc240LL),
+      -real(0xfc517cd616480LL),-real(0x1535335443d4c0LL),
+      -real(0x1d14474c2c6400LL),-real(0x28c4706fdbe340LL),
+      -real(0x3aa43e35a32380LL),-real(0x56eefde83775c0LL),
+      -real(0x859522b6982b00LL),-real(0xd663f0e8861440LL),
+      -real(0x16b2ad2884e0280LL),-real(0x2932441ccc746c0LL),
+      -real(0x51f4ee722e73200LL),-real(0xb97e18f372a9540LL),
+      -real(0x1ff5b9ebacd64180LL),-real(0x7d04fcecbaaf87c0LL),
       reale(-19432LL,0x6670458324700LL),reale(150594LL,0xe619e547a59c0LL),
       reale(-294713LL,0x66fc1e44fdf80LL),reale(231559LL,0xe5f0c3a538740LL),
       reale(-65127LL,0xc75448f9881f6LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[1], coeff of eps^1, polynomial in n of order 25
-      real(-0x16b98c18c43f0LL),real(-0x1be76827efc80LL),
-      real(-0x2291674649910LL),real(-0x2b3d2747a6820LL),
-      real(-0x36a8d2fdcc830LL),real(-0x45e795ad137c0LL),
-      real(-0x5a8eeaa036550LL),real(-0x77007a4bcbf60LL),
-      real(-0x9ee5aa2960470LL),real(-0xd8045ac825300LL),
-      real(-0x12bb93df5b3990LL),real(-0x1a9b1c398546a0LL),
-      real(-0x26d2a92f5c98b0LL),real(-0x3a7858f998ee40LL),
-      real(-0x5b6e62f9c0b5d0LL),real(-0x959d5c24529de0LL),
-      real(-0x102f2d0b50524f0LL),real(-0x1e1472bfb1ba980LL),
-      real(-0x3d69bf9cb587a10LL),real(-0x8ee1210e8c36520LL),
-      real(-0x194d332fe8d44930LL),real(-0x6534ccbfa35124c0LL),
+      -real(0x16b98c18c43f0LL),-real(0x1be76827efc80LL),
+      -real(0x2291674649910LL),-real(0x2b3d2747a6820LL),
+      -real(0x36a8d2fdcc830LL),-real(0x45e795ad137c0LL),
+      -real(0x5a8eeaa036550LL),-real(0x77007a4bcbf60LL),
+      -real(0x9ee5aa2960470LL),-real(0xd8045ac825300LL),
+      -real(0x12bb93df5b3990LL),-real(0x1a9b1c398546a0LL),
+      -real(0x26d2a92f5c98b0LL),-real(0x3a7858f998ee40LL),
+      -real(0x5b6e62f9c0b5d0LL),-real(0x959d5c24529de0LL),
+      -real(0x102f2d0b50524f0LL),-real(0x1e1472bfb1ba980LL),
+      -real(0x3d69bf9cb587a10LL),-real(0x8ee1210e8c36520LL),
+      -real(0x194d332fe8d44930LL),-real(0x6534ccbfa35124c0LL),
       reale(-15789LL,0xd33b387a8d9b0LL),reale(115779LL,0xf2f861d29c3a0LL),
       reale(-173670LL,0x138b6d4415a90LL),reale(75980LL,0x9773003236861LL),
       reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[2], coeff of eps^26, polynomial in n of order 0
       real(0x2c2a8cLL),real(0xfe89d46f33LL),
       // C4[2], coeff of eps^25, polynomial in n of order 1
-      real(-0x835f00LL),real(0x557ff0LL),real(0x89825e2a6bLL),
+      -real(0x835f00LL),real(0x557ff0LL),real(0x89825e2a6bLL),
       // C4[2], coeff of eps^24, polynomial in n of order 2
-      real(-0x184be2a300LL),real(0x97a60f680LL),real(0x26a83de30LL),
+      -real(0x184be2a300LL),real(0x97a60f680LL),real(0x26a83de30LL),
       real(0xb18f66b7a5ca3LL),
       // C4[2], coeff of eps^23, polynomial in n of order 3
-      real(-0x265f8c17d00LL),real(0x13bddd35200LL),real(-0xcadd323f00LL),
+      -real(0x265f8c17d00LL),real(0x13bddd35200LL),-real(0xcadd323f00LL),
       real(0x80e0d83bf0LL),real(0xa1c12e8b2dd1e3LL),
       // C4[2], coeff of eps^22, polynomial in n of order 4
-      real(-0x46e25cf59280LL),real(0x290af5269020LL),real(-0x22f7c7b01940LL),
+      -real(0x46e25cf59280LL),real(0x290af5269020LL),-real(0x22f7c7b01940LL),
       real(0xd08f4d0d560LL),real(0x355c24081bcLL),real(0xc015674546693d9LL),
       // C4[2], coeff of eps^21, polynomial in n of order 5
-      real(-0x326f6045f923c80LL),real(0x1fb1615f9d3a600LL),
-      real(-0x1db1797638c1780LL),real(0xe9780531c07300LL),
-      real(-0x9d24cc38e5d280LL),real(0x60cf9034bf3868LL),
+      -real(0x326f6045f923c80LL),real(0x1fb1615f9d3a600LL),
+      -real(0x1db1797638c1780LL),real(0xe9780531c07300LL),
+      -real(0x9d24cc38e5d280LL),real(0x60cf9034bf3868LL),
       reale(379902LL,0xf53f00fb109e5LL),
       // C4[2], coeff of eps^20, polynomial in n of order 6
-      real(-0x4837c78c0550480LL),real(0x313ba08613af040LL),
-      real(-0x2ee33229a4bc300LL),real(0x1a152ee5f2ae9c0LL),
-      real(-0x172de5252da0180LL),real(0x824fa762c0c340LL),
+      -real(0x4837c78c0550480LL),real(0x313ba08613af040LL),
+      -real(0x2ee33229a4bc300LL),real(0x1a152ee5f2ae9c0LL),
+      -real(0x172de5252da0180LL),real(0x824fa762c0c340LL),
       real(0x2180172e018ad8LL),reale(379902LL,0xf53f00fb109e5LL),
       // C4[2], coeff of eps^19, polynomial in n of order 7
-      real(-0x5fc4bec46509e480LL),real(0x48096a7e75900b00LL),
-      real(-0x41caf1fb886dd580LL),real(0x28558a32a56ef200LL),
-      real(-0x26dce3ddd1a42680LL),real(0x120433e2d2025900LL),
-      real(-0xce36e1803df1780LL),real(0x7a135866f905bb8LL),
+      -real(0x5fc4bec46509e480LL),real(0x48096a7e75900b00LL),
+      -real(0x41caf1fb886dd580LL),real(0x28558a32a56ef200LL),
+      -real(0x26dce3ddd1a42680LL),real(0x120433e2d2025900LL),
+      -real(0xce36e1803df1780LL),real(0x7a135866f905bb8LL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^18, polynomial in n of order 8
       reale(-2177LL,0x1ea7a5015eb00LL),real(0x73bced2a00a143a0LL),
-      real(-0x5fca97395e84bfc0LL),real(0x418b4cd8fc5e04e0LL),
-      real(-0x3e6c34ea7ddb8a80LL),real(0x212422dcacab1620LL),
-      real(-0x1f0466b0c7211540LL),real(0xa12130d17045760LL),
+      -real(0x5fca97395e84bfc0LL),real(0x418b4cd8fc5e04e0LL),
+      -real(0x3e6c34ea7ddb8a80LL),real(0x212422dcacab1620LL),
+      -real(0x1f0466b0c7211540LL),real(0xa12130d17045760LL),
       real(0x29b0aa486315dbcLL),reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^17, polynomial in n of order 9
       reale(-3195LL,0xcbf6069e6fe00LL),reale(3129LL,0x198ba10e3f000LL),
       reale(-2212LL,0x135876d83e200LL),real(0x6cf94ec7bfac7400LL),
-      real(-0x5f04d2df84f0ba00LL),real(0x39318494ff85f800LL),
-      real(-0x38939121c731d600LL),real(0x1854a6f7e2957c00LL),
-      real(-0x12decef0b13a7200LL),real(0xa9861a018e14120LL),
+      -real(0x5f04d2df84f0ba00LL),real(0x39318494ff85f800LL),
+      -real(0x38939121c731d600LL),real(0x1854a6f7e2957c00LL),
+      -real(0x12decef0b13a7200LL),real(0xa9861a018e14120LL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^16, polynomial in n of order 10
       reale(-5173LL,0x473b4cca7c600LL),reale(5700LL,0x1d26bd0962f00LL),
       reale(-3249LL,0x75306f7043800LL),reale(3050LL,0xed985975b4100LL),
       reale(-2252LL,0x10691cdccaa00LL),real(0x6370a1a9e900d300LL),
-      real(-0x5c955afee309e400LL),real(0x2eb3ea14003fe500LL),
-      real(-0x2e844e36822a7200LL),real(0xd8a8b891f217700LL),
+      -real(0x5c955afee309e400LL),real(0x2eb3ea14003fe500LL),
+      -real(0x2e844e36822a7200LL),real(0xd8a8b891f217700LL),
       real(0x388df4ca3a6fb20LL),reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^15, polynomial in n of order 11
       reale(-11116LL,0x4d006e1393a00LL),reale(11728LL,0x761e1ef822c00LL),
       reale(-5179LL,0x65d829c0ade00LL),reale(5773LL,0x24fd2adb2f000LL),
       reale(-3329LL,0xa0f3ce38e0200LL),reale(2908LL,0x836ab328fb400LL),
       reale(-2292LL,0x9d62f8fb7a600LL),real(0x5681ee23b9ad7800LL),
-      real(-0x56cafdb120433600LL),real(0x21dbd9f992213c00LL),
-      real(-0x1d4bdf01a76d9200LL),real(0xf4e0cbd04176b20LL),
+      -real(0x56cafdb120433600LL),real(0x21dbd9f992213c00LL),
+      -real(0x1d4bdf01a76d9200LL),real(0xf4e0cbd04176b20LL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^14, polynomial in n of order 12
       reale(-73827LL,0x61b736418a780LL),reale(32637LL,0x887aa6de960e0LL),
@@ -2221,7 +2221,7 @@ namespace GeographicLib {
       reale(-5207LL,0xb9e55bea0c500LL),reale(5776LL,0x82c559a327660LL),
       reale(-3446LL,0xd48e4a10ec3c0LL),reale(2676LL,0xdbe2bf3d4c920LL),
       reale(-2314LL,0x93d76112ee280LL),real(0x45af1f46068fcbe0LL),
-      real(-0x4a646c774fde3ec0LL),real(0x127e48f8affd9ea0LL),
+      -real(0x4a646c774fde3ec0LL),real(0x127e48f8affd9ea0LL),
       real(0x4e336f38ab11704LL),reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^13, polynomial in n of order 13
       reale(130976LL,0x1a84c1eb6d80LL),reale(-14598LL,0xb0e2756e03a00LL),
@@ -2230,7 +2230,7 @@ namespace GeographicLib {
       reale(-5286LL,0xaab28c8cc3880LL),reale(5660LL,0xa57467d557d00LL),
       reale(-3610LL,0x163a4d9a91180LL),reale(2326LL,0xf26507322be00LL),
       reale(-2275LL,0x1951f47034a80LL),real(0x30f364de4c777f00LL),
-      real(-0x3139417308d0dc80LL),real(0x173bf41713ca3b88LL),
+      -real(0x3139417308d0dc80LL),real(0x173bf41713ca3b88LL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^12, polynomial in n of order 14
       reale(12302LL,0xe52cc8d8c2180LL),reale(-90163LL,0xdb821dbabdc40LL),
@@ -2249,7 +2249,7 @@ namespace GeographicLib {
       reale(-9772LL,0x4b82cb486ca80LL),reale(14177LL,0x876b1df11100LL),
       reale(-5845LL,0xa68f0ab906780LL),reale(4733LL,0x71ff0d3b37600LL),
       reale(-4035LL,0x511483b19e480LL),real(0x4b0e043dd17f5b00LL),
-      real(-0x5c6dac5851097e80LL),real(0x259ade3cf4689f28LL),
+      -real(0x5c6dac5851097e80LL),real(0x259ade3cf4689f28LL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^10, polynomial in n of order 16
       real(0x285b74a086cfe00LL),real(0x61629f583f6fc20LL),
@@ -2305,7 +2305,7 @@ namespace GeographicLib {
       reale(-89266LL,0xae2af5b0a8fe0LL),reale(184683LL,0x63f792d3912c0LL),
       reale(-110681LL,0x7635192f5ada0LL),reale(-62728LL,0xff020b803ec80LL),
       reale(91791LL,0x3f8035a7d3b60LL),reale(-22896LL,0x337bb36408640LL),
-      real(-0x5652aea374b626e0LL),real(-0x38edb32bcbdda4acLL),
+      -real(0x5652aea374b626e0LL),-real(0x38edb32bcbdda4acLL),
       reale(0x56f3f0LL,0x5eb10eb5f946bLL),
       // C4[2], coeff of eps^5, polynomial in n of order 21
       real(0x185346b40be80LL),real(0x234a30239ea00LL),real(0x345f5bcfbb580LL),
@@ -2360,65 +2360,65 @@ namespace GeographicLib {
       // C4[3], coeff of eps^25, polynomial in n of order 1
       real(0x48b3200LL),real(0x130f510LL),real(0x958a9334879LL),
       // C4[3], coeff of eps^24, polynomial in n of order 2
-      real(0x39ce1000LL),real(-0x2d16c800LL),real(0x197c4e20LL),
+      real(0x39ce1000LL),-real(0x2d16c800LL),real(0x197c4e20LL),
       real(0x33a763b318f5LL),
       // C4[3], coeff of eps^23, polynomial in n of order 3
-      real(0xe7cfd39aa00LL),real(-0xe6239d55400LL),real(0x44ffe5cce00LL),
+      real(0xe7cfd39aa00LL),-real(0xe6239d55400LL),real(0x44ffe5cce00LL),
       real(0x123fa804df0LL),real(0x73400ac32a3f24fLL),
       // C4[3], coeff of eps^22, polynomial in n of order 4
-      real(0x12e19d548000LL),real(-0x130f2c71c000LL),real(0x7e08a8b4000LL),
-      real(-0x69e0a004000LL),real(0x39175efa340LL),real(0x59a39697cb86721LL),
+      real(0x12e19d548000LL),-real(0x130f2c71c000LL),real(0x7e08a8b4000LL),
+      -real(0x69e0a004000LL),real(0x39175efa340LL),real(0x59a39697cb86721LL),
       // C4[3], coeff of eps^21, polynomial in n of order 5
-      real(0xe1a59555817c700LL),real(-0xce92ef160470400LL),
-      real(0x6a50b28bc94d100LL),real(-0x6ec5ce0328fa200LL),
+      real(0xe1a59555817c700LL),-real(0xce92ef160470400LL),
+      real(0x6a50b28bc94d100LL),-real(0x6ec5ce0328fa200LL),
       real(0x1e2919432b73b00LL),real(0x81169f96b647f8LL),
       reale(0x2893f8LL,0xb4b906dd74543LL),
       // C4[3], coeff of eps^20, polynomial in n of order 6
-      real(0x4a951ec0f743800LL),real(-0x39128060ba74400LL),
-      real(0x258d1de3ebd5000LL),real(-0x25e6a8ece22dc00LL),
-      real(0xe953314d336800LL),real(-0xd6fbba5b80b400LL),
+      real(0x4a951ec0f743800LL),-real(0x39128060ba74400LL),
+      real(0x258d1de3ebd5000LL),-real(0x25e6a8ece22dc00LL),
+      real(0xe953314d336800LL),-real(0xd6fbba5b80b400LL),
       real(0x6d3d6d3e79ea90LL),reale(531864LL,0x2425015f7daa7LL),
       // C4[3], coeff of eps^19, polynomial in n of order 7
-      real(0x7366685d2da15300LL),real(-0x46390dd9eadeba00LL),
-      real(0x3de3739917104900LL),real(-0x34e3ad131262bc00LL),
-      real(0x1ae64995e9a59f00LL),real(-0x1d6cea9b561f3e00LL),
+      real(0x7366685d2da15300LL),-real(0x46390dd9eadeba00LL),
+      real(0x3de3739917104900LL),-real(0x34e3ad131262bc00LL),
+      real(0x1ae64995e9a59f00LL),-real(0x1d6cea9b561f3e00LL),
       real(0x70d3407961b9500LL),real(0x1ea45bc7b594048LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^18, polynomial in n of order 8
-      reale(2991LL,0x40e0c1e8a0000LL),real(-0x5c0b6a6cd5328000LL),
-      real(0x6cf3b04ea6358000LL),real(-0x47da0c907a958000LL),
-      real(0x334344c895550000LL),real(-0x3257cd9b75628000LL),
-      real(0x11d874d9e96c8000LL),real(-0x1273b92365d58000LL),
+      reale(2991LL,0x40e0c1e8a0000LL),-real(0x5c0b6a6cd5328000LL),
+      real(0x6cf3b04ea6358000LL),-real(0x47da0c907a958000LL),
+      real(0x334344c895550000LL),-real(0x3257cd9b75628000LL),
+      real(0x11d874d9e96c8000LL),-real(0x1273b92365d58000LL),
       real(0x8b048eddb8dae80LL),reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^17, polynomial in n of order 9
       reale(4599LL,0x20675bc677c00LL),reale(-2191LL,0x95924f3b76000LL),
-      reale(3019LL,0xad2c946b04400LL),real(-0x5cc951aa5f7ff800LL),
-      real(0x61f2b89850d68c00LL),real(-0x49aa7ace4eb85000LL),
-      real(0x26482ceb1d4d5400LL),real(-0x2b88fb70a186a800LL),
+      reale(3019LL,0xad2c946b04400LL),-real(0x5cc951aa5f7ff800LL),
+      real(0x61f2b89850d68c00LL),-real(0x49aa7ace4eb85000LL),
+      real(0x26482ceb1d4d5400LL),-real(0x2b88fb70a186a800LL),
       real(0x8bf6f0c9a679c00LL),real(0x26ce624431e62e0LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^16, polynomial in n of order 10
-      real(0x383bee2531d2a000LL),real(-0x2821094d061d1000LL),
-      real(0x2c347b321d4c8000LL),real(-0x125d6736b20ff000LL),
-      real(0x1a6c4162f9ae6000LL),real(-0xdca07dd1a07d000LL),
-      real(0xba2cc7913be4000LL),real(-0xa8a49fd40deb000LL),
-      real(0x36dcb24ee422000LL),real(-0x4159df2ed6e9000LL),
+      real(0x383bee2531d2a000LL),-real(0x2821094d061d1000LL),
+      real(0x2c347b321d4c8000LL),-real(0x125d6736b20ff000LL),
+      real(0x1a6c4162f9ae6000LL),-real(0xdca07dd1a07d000LL),
+      real(0xba2cc7913be4000LL),-real(0xa8a49fd40deb000LL),
+      real(0x36dcb24ee422000LL),-real(0x4159df2ed6e9000LL),
       real(0x1bdad6784709c40LL),reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[3], coeff of eps^15, polynomial in n of order 11
       reale(7381LL,0x14c34c0c1f400LL),reale(-13258LL,0xa462523f3800LL),
       reale(7086LL,0x404eb1053bc00LL),reale(-4055LL,0x1b129d1616000LL),
-      reale(5287LL,0x17e93cc880400LL),real(-0x7bc6aed7afe87800LL),
-      reale(2758LL,0x364797381cc00LL),real(-0x676ee80244a35000LL),
-      real(0x3b6d32d9ca041400LL),real(-0x43e3e0c280942800LL),
+      reale(5287LL,0x17e93cc880400LL),-real(0x7bc6aed7afe87800LL),
+      reale(2758LL,0x364797381cc00LL),-real(0x676ee80244a35000LL),
+      real(0x3b6d32d9ca041400LL),-real(0x43e3e0c280942800LL),
       real(0xa86d2e316b1dc00LL),real(0x300bec0027818e0LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^14, polynomial in n of order 12
       reale(66948LL,0x4f30b3f870000LL),reale(-52647LL,0x9795c7cc58000LL),
       reale(7561LL,0xd0b8bda7a8000LL),reale(-13027LL,0x827613ff28000LL),
       reale(8130LL,0xd3b0b583a0000LL),reale(-3524LL,0x2d6f89c1d8000LL),
-      reale(5530LL,0x8b9708b698000LL),real(-0x7e52c154efd58000LL),
-      reale(2356LL,0x7673a06ad0000LL),real(-0x6f6a34d21b028000LL),
-      real(0x220d8444fca88000LL),real(-0x2fac85fa2e858000LL),
+      reale(5530LL,0x8b9708b698000LL),-real(0x7e52c154efd58000LL),
+      reale(2356LL,0x7673a06ad0000LL),-real(0x6f6a34d21b028000LL),
+      real(0x220d8444fca88000LL),-real(0x2fac85fa2e858000LL),
       real(0x11c823101280e280LL),reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^13, polynomial in n of order 13
       reale(-129174LL,0xa7b7643d7c700LL),reale(59789LL,0xf9dc41e63d400LL),
@@ -2426,7 +2426,7 @@ namespace GeographicLib {
       reale(8184LL,0x5e79915d1b00LL),reale(-12354LL,0x7c56a698f3800LL),
       reale(9463LL,0x4211f61d49500LL),reale(-2967LL,0x1ed471cad8a00LL),
       reale(5543LL,0x52a28a556ef00LL),reale(-2250LL,0x1e08b645e9c00LL),
-      real(0x6b0d1cda5c5fe900LL),real(-0x70ab303245f3d200LL),
+      real(0x6b0d1cda5c5fe900LL),-real(0x70ab303245f3d200LL),
       real(0xb596d16f1a34300LL),real(0x35b4de912478078LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^12, polynomial in n of order 14
@@ -2436,10 +2436,10 @@ namespace GeographicLib {
       reale(9601LL,0xec9983923a000LL),reale(-11043LL,0xbce846bd33400LL),
       reale(11048LL,0xa50acd625f800LL),reale(-2546LL,0x83680e9e89c00LL),
       reale(5107LL,0xc83f2d67d000LL),reale(-2698LL,0x7a1b733ac4400LL),
-      real(0x36af107261fea800LL),real(-0x57b6b3b8f7f45400LL),
+      real(0x36af107261fea800LL),-real(0x57b6b3b8f7f45400LL),
       real(0x1b355635bf037310LL),reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^11, polynomial in n of order 15
-      real(-0x718d19ce618f700LL),real(-0x22292bb4d2a0a600LL),
+      -real(0x718d19ce618f700LL),-real(0x22292bb4d2a0a600LL),
       reale(-6562LL,0x84471fa4f9b00LL),reale(61876LL,0xa080215cbc400LL),
       reale(-135760LL,0x93f5da0ef4d00LL),reale(81504LL,0x4116e653fae00LL),
       reale(58147LL,0xb03676e9edf00LL),reale(-73012LL,0x28a4ca281d800LL),
@@ -2449,8 +2449,8 @@ namespace GeographicLib {
       real(0x7343398f272e700LL),real(0x20b3728b7b6b2d8LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^10, polynomial in n of order 16
-      real(-0xaaaed768da0000LL),real(-0x1d8d58546174000LL),
-      real(-0x650ff776c6dc000LL),real(-0x1f0fa133b6eac000LL),
+      -real(0xaaaed768da0000LL),-real(0x1d8d58546174000LL),
+      -real(0x650ff776c6dc000LL),-real(0x1f0fa133b6eac000LL),
       reale(-6126LL,0x7974ea8448000LL),reale(59813LL,0x741ec012c000LL),
       reale(-138412LL,0x58b7c4d32c000LL),reale(95264LL,0x22057cd374000LL),
       reale(50003LL,0x3a5ca8a530000LL),reale(-81503LL,0x84cf1d8c000LL),
@@ -2459,177 +2459,177 @@ namespace GeographicLib {
       real(0x78ab12d1827bc000LL),reale(-2958LL,0x94db7ad074000LL),
       real(0x2bef42096127d7c0LL),reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^9, polynomial in n of order 17
-      real(-0x3cadc0edd6600LL),real(-0x8587ee4c4e000LL),
-      real(-0x14633459f95a00LL),real(-0x397bc2059d8400LL),
-      real(-0xc89f8adb490e00LL),real(-0x3f2a86a64b5a800LL),
-      real(-0x32218961953c0200LL),reale(8146LL,0xa930f21b73400LL),
+      -real(0x3cadc0edd6600LL),-real(0x8587ee4c4e000LL),
+      -real(0x14633459f95a00LL),-real(0x397bc2059d8400LL),
+      -real(0xc89f8adb490e00LL),-real(0x3f2a86a64b5a800LL),
+      -real(0x32218961953c0200LL),reale(8146LL,0xa930f21b73400LL),
       reale(-20016LL,0x74e96760e4a00LL),reale(15890LL,0x8aa3fb72d9000LL),
       reale(5271LL,0xbcd5aeda65600LL),reale(-12823LL,0x6bdb3dd51ec00LL),
-      reale(3774LL,0x46bb658aca200LL),real(-0x148a80159bb73800LL),
-      real(0x736580900f31ae00LL),real(-0x336f49c74ee95c00LL),
-      real(-0x249e756eeea0600LL),real(-0x13841fc89043bb0LL),
+      reale(3774LL,0x46bb658aca200LL),-real(0x148a80159bb73800LL),
+      real(0x736580900f31ae00LL),-real(0x336f49c74ee95c00LL),
+      -real(0x249e756eeea0600LL),-real(0x13841fc89043bb0LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[3], coeff of eps^8, polynomial in n of order 18
-      real(-0x5318540751000LL),real(-0xa0702ad537800LL),
-      real(-0x14a9549a688000LL),real(-0x2e31b9dc878800LL),
-      real(-0x72dceb1c83f000LL),real(-0x14a6c8c8df91800LL),
-      real(-0x49c3e43ec426000LL),real(-0x17df3e19aed32800LL),
+      -real(0x5318540751000LL),-real(0xa0702ad537800LL),
+      -real(0x14a9549a688000LL),-real(0x2e31b9dc878800LL),
+      -real(0x72dceb1c83f000LL),-real(0x14a6c8c8df91800LL),
+      -real(0x49c3e43ec426000LL),-real(0x17df3e19aed32800LL),
       reale(-5018LL,0x6431109e13000LL),reale(53301LL,0x74feac5bf4800LL),
       reale(-140140LL,0xa8f9e9b6bc000LL),reale(129320LL,0x1fd8eca933800LL),
       reale(16403LL,0x87db178e25000LL),reale(-95279LL,0xe19a1987da800LL),
-      reale(40665LL,0x6f4b03ec9e000LL),real(-0x1c82af8b65ac6800LL),
+      reale(40665LL,0x6f4b03ec9e000LL),-real(0x1c82af8b65ac6800LL),
       reale(8049LL,0x334ede6a77000LL),reale(-7541LL,0xfa4ef74ea0800LL),
       real(0x49ca297e3ffdbce0LL),reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^7, polynomial in n of order 19
-      real(-0x11fa490472e00LL),real(-0x1fe0e98340400LL),
-      real(-0x3b2a552443a00LL),real(-0x73f5544ad2000LL),
-      real(-0xf2e5765f90600LL),real(-0x2290ce0f423c00LL),
-      real(-0x57b83400ee1200LL),real(-0x1023f65b9bfd800LL),
-      real(-0x3b36c6db61bde00LL),real(-0x13c7b72049527400LL),
+      -real(0x11fa490472e00LL),-real(0x1fe0e98340400LL),
+      -real(0x3b2a552443a00LL),-real(0x73f5544ad2000LL),
+      -real(0xf2e5765f90600LL),-real(0x2290ce0f423c00LL),
+      -real(0x57b83400ee1200LL),-real(0x1023f65b9bfd800LL),
+      -real(0x3b36c6db61bde00LL),-real(0x13c7b72049527400LL),
       reale(-4324LL,0x8c4173b351600LL),reale(48359LL,0x7d21dc7197000LL),
       reale(-137344LL,0x3e76a768c4a00LL),reale(148676LL,0xd51cb5c775400LL),
       reale(-14755LL,0x5760f43613e00LL),reale(-92176LL,0xcc2ef6d3ab800LL),
       reale(60290LL,0x88af4d43b7200LL),reale(-5856LL,0x7368e62f71c00LL),
-      real(-0x48b16aa4982d9a00LL),real(-0x51dba59b00547450LL),
+      -real(0x48b16aa4982d9a00LL),-real(0x51dba59b00547450LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^6, polynomial in n of order 20
-      real(-0x3f0527da8000LL),real(-0x69410a894000LL),real(-0xb5f68cf74000LL),
-      real(-0x14766cd18c000LL),real(-0x2696134420000LL),
-      real(-0x4cf42ca274000LL),real(-0xa45199d7cc000LL),
-      real(-0x17e337e696c000LL),real(-0x3e169088698000LL),
-      real(-0xbbd1c494494000LL),real(-0x2c70014b4ca4000LL),
-      real(-0xf67e7406420c000LL),reale(-3525LL,0x349c0ad9f0000LL),
+      -real(0x3f0527da8000LL),-real(0x69410a894000LL),-real(0xb5f68cf74000LL),
+      -real(0x14766cd18c000LL),-real(0x2696134420000LL),
+      -real(0x4cf42ca274000LL),-real(0xa45199d7cc000LL),
+      -real(0x17e337e696c000LL),-real(0x3e169088698000LL),
+      -real(0xbbd1c494494000LL),-real(0x2c70014b4ca4000LL),
+      -real(0xf67e7406420c000LL),reale(-3525LL,0x349c0ad9f0000LL),
       reale(41859LL,0x1cfdfa000c000LL),reale(-129840LL,0x6d28af104000LL),
       reale(166586LL,0x5d10da3394000LL),reale(-59707LL,0xa04083fc78000LL),
       reale(-68021LL,0x5fb808ba6c000LL),reale(75721LL,0x1307a9002c000LL),
       reale(-24385LL,0x3f4ba28674000LL),real(0x6534ccbfa35124c0LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^5, polynomial in n of order 21
-      real(-0xcd30266b700LL),real(-0x147d4e1fec00LL),real(-0x21a6b4a64100LL),
-      real(-0x390579acce00LL),real(-0x6423741d2b00LL),real(-0xb749b833f000LL),
-      real(-0x1602ad6953500LL),real(-0x2ccfc753d1200LL),
-      real(-0x61e5d62301f00LL),real(-0xe995b2fcff400LL),
-      real(-0x270c826fb7a900LL),real(-0x7a09e7f3045600LL),
-      real(-0x1dfb4c385ed9300LL),real(-0xaddceca1091f800LL),
+      -real(0xcd30266b700LL),-real(0x147d4e1fec00LL),-real(0x21a6b4a64100LL),
+      -real(0x390579acce00LL),-real(0x6423741d2b00LL),-real(0xb749b833f000LL),
+      -real(0x1602ad6953500LL),-real(0x2ccfc753d1200LL),
+      -real(0x61e5d62301f00LL),-real(0xe995b2fcff400LL),
+      -real(0x270c826fb7a900LL),-real(0x7a09e7f3045600LL),
+      -real(0x1dfb4c385ed9300LL),-real(0xaddceca1091f800LL),
       reale(-2625LL,0x3ba17c0246300LL),reale(33433LL,0x20d0a109f6600LL),
       reale(-114657LL,0x5c2192fdc7900LL),reale(175907LL,0x1d4b03fe80400LL),
       reale(-116169LL,0x84e81ccb0ef00LL),reale(-3811LL,0xe1e3d16502200LL),
       reale(45340LL,0x664f5dce00500LL),reale(-17206LL,0xf008bd8c1d988LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[3], coeff of eps^4, polynomial in n of order 22
-      real(-0xb6a5fc8800LL),real(-0x11a0a388400LL),real(-0x1bda05d7000LL),
-      real(-0x2d25cb21c00LL),real(-0x4b5283d5800LL),real(-0x81d5381f400LL),
-      real(-0xe84e582c000LL),real(-0x1b2017768c00LL),real(-0x354f35942800LL),
-      real(-0x6f49195e6400LL),real(-0xf9ffb1d81000LL),real(-0x267769207fc00LL),
-      real(-0x6a9801634f800LL),real(-0x15adc2fc41d400LL),
-      real(-0x5947d2bb916000LL),real(-0x222d7eabcda6c00LL),
-      real(-0x22707489da53c800LL),reale(7620LL,0x3c385d35fbc00LL),
+      -real(0xb6a5fc8800LL),-real(0x11a0a388400LL),-real(0x1bda05d7000LL),
+      -real(0x2d25cb21c00LL),-real(0x4b5283d5800LL),-real(0x81d5381f400LL),
+      -real(0xe84e582c000LL),-real(0x1b2017768c00LL),-real(0x354f35942800LL),
+      -real(0x6f49195e6400LL),-real(0xf9ffb1d81000LL),-real(0x267769207fc00LL),
+      -real(0x6a9801634f800LL),-real(0x15adc2fc41d400LL),
+      -real(0x5947d2bb916000LL),-real(0x222d7eabcda6c00LL),
+      -real(0x22707489da53c800LL),reale(7620LL,0x3c385d35fbc00LL),
       reale(-29198LL,0x7793d371d5000LL),reale(53341LL,0xa58a8c79e2400LL),
       reale(-51818LL,0x6680b95db6800LL),reale(25908LL,0xccbfa35124c00LL),
       reale(-5263LL,0x466912d384890LL),reale(0x2893f8LL,0xb4b906dd74543LL),
       // C4[3], coeff of eps^3, polynomial in n of order 23
-      real(-0x388cfdf100LL),real(-0x5500729200LL),real(-0x8250066300LL),
-      real(-0xcc2d29dc00LL),real(-0x147bd04f500LL),real(-0x21c7b15a600LL),
-      real(-0x396d13e6700LL),real(-0x650be18b000LL),real(-0xb8f375f7900LL),
-      real(-0x16253c45ba00LL),real(-0x2cc1928ceb00LL),real(-0x6065d92f8400LL),
-      real(-0xe04f74737d00LL),real(-0x23eadf138ce00LL),
-      real(-0x682920857ef00LL),real(-0x1651f4aee45800LL),
-      real(-0x61a68e7d270100LL),real(-0x281b43aa424e200LL),
-      real(-0x2bddd20238857300LL),reale(10668LL,0x544ee8e52d400LL),
+      -real(0x388cfdf100LL),-real(0x5500729200LL),-real(0x8250066300LL),
+      -real(0xcc2d29dc00LL),-real(0x147bd04f500LL),-real(0x21c7b15a600LL),
+      -real(0x396d13e6700LL),-real(0x650be18b000LL),-real(0xb8f375f7900LL),
+      -real(0x16253c45ba00LL),-real(0x2cc1928ceb00LL),-real(0x6065d92f8400LL),
+      -real(0xe04f74737d00LL),-real(0x23eadf138ce00LL),
+      -real(0x682920857ef00LL),-real(0x1651f4aee45800LL),
+      -real(0x61a68e7d270100LL),-real(0x281b43aa424e200LL),
+      -real(0x2bddd20238857300LL),reale(10668LL,0x544ee8e52d400LL),
       reale(-45341LL,0x99b0a231ffb00LL),reale(90680LL,0xcc9ebb9c00a00LL),
       reale(-84204LL,0x66912d3848900LL),reale(28944LL,0xfcbe1874a70e8LL),
       reale(0x79bbeaLL,0x1e2b14985cfc9LL),
       // C4[4], coeff of eps^26, polynomial in n of order 0
       real(0x46c5200LL),real(0x377b3e1aa351LL),
       // C4[4], coeff of eps^25, polynomial in n of order 1
-      real(-0x51ae800LL),real(0x28cb780LL),real(0x7a5a1b59863LL),
+      -real(0x51ae800LL),real(0x28cb780LL),real(0x7a5a1b59863LL),
       // C4[4], coeff of eps^24, polynomial in n of order 2
-      real(-0x5d090f66800LL),real(0x15cb8432c00LL),real(0x5ff8163080LL),
+      -real(0x5d090f66800LL),real(0x15cb8432c00LL),real(0x5ff8163080LL),
       real(0x3e897844a5071ebLL),
       // C4[4], coeff of eps^23, polynomial in n of order 3
-      real(-0xbff3f70d800LL),real(0x44c7b31b000LL),real(-0x48108b34800LL),
+      -real(0xbff3f70d800LL),real(0x44c7b31b000LL),-real(0x48108b34800LL),
       real(0x21db9c9a980LL),real(0x4fc9e010f5dcf23LL),
       // C4[4], coeff of eps^22, polynomial in n of order 4
-      real(-0xd6b769b7e000LL),real(0x72b1142e1800LL),real(-0x82aa7be7f000LL),
+      -real(0xd6b769b7e000LL),real(0x72b1142e1800LL),-real(0x82aa7be7f000LL),
       real(0x1aa8532e0800LL),real(0x779e97cc600LL),real(0x40d4060dc7c384c7LL),
       // C4[4], coeff of eps^21, polynomial in n of order 5
-      real(-0x474af3a87693800LL),real(0x3c389a0df442000LL),
-      real(-0x37e1a3d92db8800LL),real(0x12d1db00bd71000LL),
-      real(-0x15fc16a85bcd800LL),real(0x99491c279c9880LL),
+      -real(0x474af3a87693800LL),real(0x3c389a0df442000LL),
+      -real(0x37e1a3d92db8800LL),real(0x12d1db00bd71000LL),
+      -real(0x15fc16a85bcd800LL),real(0x99491c279c9880LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[4], coeff of eps^20, polynomial in n of order 6
-      real(-0x303d69b47fe22400LL),real(0x3f4d2c93a259b200LL),
-      real(-0x29be542895db1800LL),real(0x17eb54d9d2a59e00LL),
-      real(-0x1b89924120220c00LL),real(0x4aa7a22c8d50a00LL),
+      -real(0x303d69b47fe22400LL),real(0x3f4d2c93a259b200LL),
+      -real(0x29be542895db1800LL),real(0x17eb54d9d2a59e00LL),
+      -real(0x1b89924120220c00LL),real(0x4aa7a22c8d50a00LL),
       real(0x157745851f3d4c0LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^19, polynomial in n of order 7
-      real(-0x44c3305a70de1000LL),real(0x6d1c9adfcac5e000LL),
-      real(-0x312f88327b293000LL),real(0x3351684a1a554000LL),
-      real(-0x2ab43a21fd0e5000LL),real(0xdaac481cc1ca000LL),
-      real(-0x120b854707e97000LL),real(0x7289c72302f3500LL),
+      -real(0x44c3305a70de1000LL),real(0x6d1c9adfcac5e000LL),
+      -real(0x312f88327b293000LL),real(0x3351684a1a554000LL),
+      -real(0x2ab43a21fd0e5000LL),real(0xdaac481cc1ca000LL),
+      -real(0x120b854707e97000LL),real(0x7289c72302f3500LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^18, polynomial in n of order 8
       reale(-2257LL,0x84afe20dc8000LL),reale(2620LL,0x5abb698ccf000LL),
-      real(-0x3cfd86157c22a000LL),real(0x656f30f9d7a5d000LL),
-      real(-0x3529aafa1251c000LL),real(0x23979dd758c6b000LL),
-      real(-0x27cfd52f91a0e000LL),real(0x52c1297ffdf9000LL),
+      -real(0x3cfd86157c22a000LL),real(0x656f30f9d7a5d000LL),
+      -real(0x3529aafa1251c000LL),real(0x23979dd758c6b000LL),
+      -real(0x27cfd52f91a0e000LL),real(0x52c1297ffdf9000LL),
       real(0x1899e61f0915c00LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^17, polynomial in n of order 9
       reale(-5648LL,0x6d69d3f987000LL),reale(3064LL,0xd620df9a18000LL),
-      real(-0x73b5708edb717000LL),reale(2782LL,0xf8e2a6bab2000LL),
-      real(-0x3aa55028ed4d5000LL),real(0x54f5b0489ac0c000LL),
-      real(-0x3a8372ad6ebf3000LL),real(0x128f31db99de6000LL),
-      real(-0x1bbb3cddeb8b1000LL),real(0x9c3f5d344ffbb00LL),
+      -real(0x73b5708edb717000LL),reale(2782LL,0xf8e2a6bab2000LL),
+      -real(0x3aa55028ed4d5000LL),real(0x54f5b0489ac0c000LL),
+      -real(0x3a8372ad6ebf3000LL),real(0x128f31db99de6000LL),
+      -real(0x1bbb3cddeb8b1000LL),real(0x9c3f5d344ffbb00LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^16, polynomial in n of order 10
       reale(-12547LL,0x2f9a6b7e09000LL),reale(2321LL,0x6f75c5bce2800LL),
       reale(-5210LL,0x3640452d54000LL),reale(3693LL,0x4f3d4dd785800LL),
-      real(-0x59b26230b2e61000LL),reale(2785LL,0x7ef843b608800LL),
-      real(-0x4086b5731d656000LL),real(0x3b22d2695822b800LL),
-      real(-0x3bbf747f663cb000LL),real(0x50e2c41c71ae800LL),
+      -real(0x59b26230b2e61000LL),reale(2785LL,0x7ef843b608800LL),
+      -real(0x4086b5731d656000LL),real(0x3b22d2695822b800LL),
+      -real(0x3bbf747f663cb000LL),real(0x50e2c41c71ae800LL),
       real(0x19182d9cca60700LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^15, polynomial in n of order 11
       reale(-14656LL,0x5833084c1d000LL),reale(5703LL,0xb41e60048e000LL),
       reale(-13724LL,0xf905debc4f000LL),reale(2794LL,0x80dd2a6158000LL),
       reale(-4435LL,0x42429a62a1000LL),reale(4398LL,0x1bf890b722000LL),
-      real(-0x462f1f0759b2d000LL),reale(2504LL,0xfcfacf17ac000LL),
-      real(-0x4eb2a95e9a75b000LL),real(0x1bef3eef6f4b6000LL),
-      real(-0x2d8008caddc29000LL),real(0xdbb189dc4eba300LL),
+      -real(0x462f1f0759b2d000LL),reale(2504LL,0xfcfacf17ac000LL),
+      -real(0x4eb2a95e9a75b000LL),real(0x1bef3eef6f4b6000LL),
+      -real(0x2d8008caddc29000LL),real(0xdbb189dc4eba300LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^14, polynomial in n of order 12
       reale(-31111LL,0x2f5aeecd0c000LL),reale(76716LL,0x887753c58b000LL),
       reale(-19286LL,0x3027a0a80a000LL),reale(3558LL,0x4fcfd1ab09000LL),
       reale(-14555LL,0x40d2f53608000LL),reale(3850LL,0x9631322307000LL),
       reale(-3314LL,0x6f07544006000LL),reale(4999LL,0xf3c6aed085000LL),
-      real(-0x44308029330fc000LL),real(0x72cd2f325ae83000LL),
-      real(-0x5cc3eeffca3fe000LL),real(0x2f990ef34001000LL),
+      -real(0x44308029330fc000LL),real(0x72cd2f325ae83000LL),
+      -real(0x5cc3eeffca3fe000LL),real(0x2f990ef34001000LL),
       real(0xedd65cb262fc00LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^13, polynomial in n of order 13
       reale(109832LL,0xfe67f2664d000LL),reale(-101415LL,0xc9a26ad01c000LL),
       reale(-21579LL,0xd38200228b000LL),reale(81484LL,0xfb5b01862000LL),
       reale(-25829LL,0x8520bb4969000LL),real(0x527645ab2c368000LL),
       reale(-14627LL,0x5f0a484327000LL),reale(5668LL,0x89f8307d6e000LL),
-      real(-0x7c6deea8217fb000LL),reale(5148LL,0xb3c77272b4000LL),
-      real(-0x5ea4f23e05fbd000LL),real(0x33d79ea3e6f7a000LL),
-      real(-0x512f5a2dc7bdf000LL),real(0x13f171801c8d4d00LL),
+      -real(0x7c6deea8217fb000LL),reale(5148LL,0xb3c77272b4000LL),
+      -real(0x5ea4f23e05fbd000LL),real(0x33d79ea3e6f7a000LL),
+      -real(0x512f5a2dc7bdf000LL),real(0x13f171801c8d4d00LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^12, polynomial in n of order 14
       reale(3290LL,0xf070eb97f3400LL),reale(-37926LL,0xeb33f78d44e00LL),
       reale(108756LL,0x262a302ba0800LL),reale(-111140LL,0x45b6109f34200LL),
       reale(-8979LL,0x691a509cedc00LL),reale(85061LL,0xe9667b666b600LL),
-      reale(-34831LL,0x4af77b29eb000LL),real(-0x1ae66991075c5600LL),
+      reale(-34831LL,0x4af77b29eb000LL),-real(0x1ae66991075c5600LL),
       reale(-13338LL,0x2d28d4daa8400LL),reale(8254LL,0x43d2c57af1e00LL),
-      real(-0x39646320240ca800LL),reale(4333LL,0x5a8eb4efe1200LL),
-      reale(-2318LL,0xc78fad2da2c00LL),real(-0x4971411b9aa7a00LL),
-      real(-0x239dc6f1135e6c0LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
+      -real(0x39646320240ca800LL),reale(4333LL,0x5a8eb4efe1200LL),
+      reale(-2318LL,0xc78fad2da2c00LL),-real(0x4971411b9aa7a00LL),
+      -real(0x239dc6f1135e6c0LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^11, polynomial in n of order 15
       real(0x22fb18f3d6fc800LL),real(0xc812a63656dd000LL),
       reale(2929LL,0x54e6120875800LL),reale(-35122LL,0xb72fa39d42000LL),
       reale(106528LL,0xc02be4bd3e800LL),reale(-121105LL,0x35724ce667000LL),
       reale(7480LL,0x3b39caec37800LL),reale(86076LL,0xd8784a9f2c000LL),
-      reale(-46729LL,0x24906ba440800LL),real(-0x1e17ea5787b8f000LL),
+      reale(-46729LL,0x24906ba440800LL),-real(0x1e17ea5787b8f000LL),
       reale(-10013LL,0xff9cfd7c39800LL),reale(11072LL,0xcb500e9316000LL),
-      real(-0x3d2315ebbfcfd800LL),reale(2196LL,0x522d08f7fb000LL),
+      -real(0x3d2315ebbfcfd800LL),reale(2196LL,0x522d08f7fb000LL),
       reale(-2583LL,0xd6bd372f7b800LL),real(0x1dbc900c41177d80LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^10, polynomial in n of order 16
@@ -2640,8 +2640,8 @@ namespace GeographicLib {
       reale(28618LL,0x913148900c000LL),reale(82224LL,0x225affaa4a800LL),
       reale(-61372LL,0x8e7c958c49000LL),reale(3358LL,0xd2d9334507800LL),
       reale(-4437LL,0xae8eb3ee06000LL),reale(12409LL,0x2e12e0f984800LL),
-      reale(-3100LL,0x4a639fe0c3000LL),real(-0x185351aa9adbe800LL),
-      real(-0xfcd867cd32b4e00LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
+      reale(-3100LL,0x4a639fe0c3000LL),-real(0x185351aa9adbe800LL),
+      -real(0xfcd867cd32b4e00LL),reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^9, polynomial in n of order 17
       real(0x3b98569230800LL),real(0x954e9f9ae8000LL),real(0x1a387f0ed5f800LL),
       real(0x561911aabbb000LL),real(0x163673b1889e800LL),
@@ -2661,7 +2661,7 @@ namespace GeographicLib {
       reale(-143686LL,0xc7e6fcd50ec00LL),reale(86217LL,0x78ea8eac47800LL),
       reale(43622LL,0x50ec504da8400LL),reale(-86858LL,0x1b1c4c8725000LL),
       reale(34767LL,0x1af4459111c00LL),real(0x470ee9f8c8f42800LL),
-      real(-0xf0a395fd8dd4c00LL),real(-0x55da5cd875ef3c80LL),
+      -real(0xf0a395fd8dd4c00LL),-real(0x55da5cd875ef3c80LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
       // C4[4], coeff of eps^7, polynomial in n of order 19
       real(0x114b06357800LL),real(0x2239f3629000LL),real(0x475e8ebd2800LL),
@@ -2670,7 +2670,7 @@ namespace GeographicLib {
       real(0xb0d866e91e3800LL),real(0x48b6aeda5425000LL),
       real(0x4ec10b7f840de800LL),reale(-18694LL,0x2576e33244000LL),
       reale(76065LL,0x2aaa760409800LL),reale(-141962LL,0x3c08cd5de3000LL),
-      reale(119123LL,0xd1c84be04800LL),real(-0x7f4b67756e45e000LL),
+      reale(119123LL,0xd1c84be04800LL),-real(0x7f4b67756e45e000LL),
       reale(-76607LL,0x185979f96f800LL),reale(56790LL,0xce45bec021000LL),
       reale(-14599LL,0x3bc9e9b8ea800LL),real(0x23b84843a30d9480LL),
       reale(0x9c83e3LL,0xdda51a7ac0b27LL),
@@ -2712,77 +2712,77 @@ namespace GeographicLib {
       // C4[5], coeff of eps^25, polynomial in n of order 1
       real(0x46ce30800LL),real(0x146425580LL),real(0x1580fd4afdbe65LL),
       // C4[5], coeff of eps^24, polynomial in n of order 2
-      real(0x2ba61448000LL),real(-0x378568c4000LL),real(0x16cc31e2a00LL),
+      real(0x2ba61448000LL),-real(0x378568c4000LL),real(0x16cc31e2a00LL),
       real(0x4c6f2137745e091LL),
       // C4[5], coeff of eps^23, polynomial in n of order 3
-      real(0xef2f223e3800LL),real(-0x110fb2e7bf000LL),real(0x282bb4606800LL),
+      real(0xef2f223e3800LL),-real(0x110fb2e7bf000LL),real(0x282bb4606800LL),
       real(0xbe30d7a6780LL),reale(2828LL,0xfcd03d1974f5LL),
       // C4[5], coeff of eps^22, polynomial in n of order 4
-      real(0x5e4a1598000LL),real(-0x48b6e92a000LL),real(0x1757a4ac000LL),
-      real(-0x20e8326e000LL),real(0xc6156d2d00LL),real(0x2081a7235aaf593LL),
+      real(0x5e4a1598000LL),-real(0x48b6e92a000LL),real(0x1757a4ac000LL),
+      -real(0x20e8326e000LL),real(0xc6156d2d00LL),real(0x2081a7235aaf593LL),
       // C4[5], coeff of eps^21, polynomial in n of order 5
-      real(0x40db2f49b455f800LL),real(-0x1e99bb32c4c22000LL),
-      real(0x173ba0294630c800LL),real(-0x194707e3169c1000LL),
+      real(0x40db2f49b455f800LL),-real(0x1e99bb32c4c22000LL),
+      real(0x173ba0294630c800LL),-real(0x194707e3169c1000LL),
       real(0x2d83efe695c9800LL),real(0xdf3e0617af3080LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^20, polynomial in n of order 6
-      real(0x216feaa994ce0000LL),real(-0xab5f967e8690000LL),
-      real(0x11e48889bb540000LL),real(-0xb74a91dab5f0000LL),
-      real(0x3c54ceff81a0000LL),real(-0x5d7cb98f1a50000LL),
+      real(0x216feaa994ce0000LL),-real(0xab5f967e8690000LL),
+      real(0x11e48889bb540000LL),-real(0xb74a91dab5f0000LL),
+      real(0x3c54ceff81a0000LL),-real(0x5d7cb98f1a50000LL),
       real(0x1f9a69370b20800LL),reale(0x3fc3f4LL,0x89b50ac9b6cd7LL),
       // C4[5], coeff of eps^19, polynomial in n of order 7
-      real(0x737c719d74a11000LL),real(-0x33cb00709b02e000LL),
-      real(0x64aa4f647e063000LL),real(-0x22d04f5347fb4000LL),
-      real(0x244213a9e6215000LL),real(-0x2372b83384fba000LL),
+      real(0x737c719d74a11000LL),-real(0x33cb00709b02e000LL),
+      real(0x64aa4f647e063000LL),-real(0x22d04f5347fb4000LL),
+      real(0x244213a9e6215000LL),-real(0x2372b83384fba000LL),
       real(0x29c5a12d1767000LL),real(0xd64e2b028e9d00LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^18, polynomial in n of order 8
       real(0x4d6c482dac2a0000LL),reale(-2330LL,0x4e01d8dc24000LL),
-      reale(2244LL,0xda129de1b8000LL),real(-0x25b9c94d1ec14000LL),
-      real(0x5915813997350000LL),real(-0x2b18411354f8c000LL),
-      real(0x1038d20e1fbe8000LL),real(-0x1a9977b2ea9c4000LL),
+      reale(2244LL,0xda129de1b8000LL),-real(0x25b9c94d1ec14000LL),
+      real(0x5915813997350000LL),-real(0x2b18411354f8c000LL),
+      real(0x1038d20e1fbe8000LL),-real(0x1a9977b2ea9c4000LL),
       real(0x7df995f732ef600LL),reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^17, polynomial in n of order 9
       real(0x514388ef27d31000LL),reale(-6021LL,0xd41baf36e8000LL),
-      real(0x6fa66bdc836df000LL),real(-0x67912be26fab2000LL),
-      reale(2539LL,0xf65fb2006d000LL),real(-0x237e1033f4d8c000LL),
-      real(0x3efb5ba75c79b000LL),real(-0x32b52fd83cbe6000LL),
+      real(0x6fa66bdc836df000LL),-real(0x67912be26fab2000LL),
+      reale(2539LL,0xf65fb2006d000LL),-real(0x237e1033f4d8c000LL),
+      real(0x3efb5ba75c79b000LL),-real(0x32b52fd83cbe6000LL),
       real(0x17d40e2c1a29000LL),real(0x7dfd16a9c2e300LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^16, polynomial in n of order 10
       reale(12470LL,0xf777d5cb70000LL),reale(-8995LL,0xcb00690428000LL),
       real(0x22d781d11b8c0000LL),reale(-5685LL,0x5cae489458000LL),
-      reale(2676LL,0xe4b7624210000LL),real(-0x3b4e8fe27b2f8000LL),
-      reale(2525LL,0xe113384060000LL),real(-0x317b33e66b8c8000LL),
-      real(0x1afebbc488cb0000LL),real(-0x2abc78cdb6418000LL),
+      reale(2676LL,0xe4b7624210000LL),-real(0x3b4e8fe27b2f8000LL),
+      reale(2525LL,0xe113384060000LL),-real(0x317b33e66b8c8000LL),
+      real(0x1afebbc488cb0000LL),-real(0x2abc78cdb6418000LL),
       real(0xab0b32cc6da3c00LL),reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^15, polynomial in n of order 11
       reale(45753LL,0x27312c684b000LL),real(0x6b25908081df2000LL),
       reale(10080LL,0x3e3c4e94e9000LL),reale(-11484LL,0xcfad66f9a8000LL),
       real(0x186dcc47df2a7000LL),reale(-4655LL,0x1684cc365e000LL),
-      reale(3765LL,0x192eb8a145000LL),real(-0x1ea7f016e242c000LL),
-      real(0x7c08a9e80a083000LL),real(-0x48a61c5124e36000LL),
-      real(-0x1ab8464a6fdf000LL),real(-0xc3b3128c53f500LL),
+      reale(3765LL,0x192eb8a145000LL),-real(0x1ea7f016e242c000LL),
+      real(0x7c08a9e80a083000LL),-real(0x48a61c5124e36000LL),
+      -real(0x1ab8464a6fdf000LL),-real(0xc3b3128c53f500LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^14, polynomial in n of order 12
       reale(-29854LL,0x680415f70000LL),reale(-72662LL,0x4d1ac37df4000LL),
-      reale(55735LL,0xd505afdac8000LL),real(-0x19eb9cd373704000LL),
+      reale(55735LL,0xd505afdac8000LL),-real(0x19eb9cd373704000LL),
       reale(6447LL,0x407ca0dba0000LL),reale(-13736LL,0x6cb0ae15c4000LL),
       real(0x503c7c1e17a78000LL),reale(-2911LL,0x70f0f99ccc000LL),
-      reale(4611LL,0xa07ae6cfd0000LL),real(-0x28ec95124696c000LL),
-      real(0x386dc5f3bf428000LL),real(-0x49a3cdb95c464000LL),
+      reale(4611LL,0xa07ae6cfd0000LL),-real(0x28ec95124696c000LL),
+      real(0x386dc5f3bf428000LL),-real(0x49a3cdb95c464000LL),
       real(0xec86977ad08e600LL),reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^13, polynomial in n of order 13
       reale(-77965LL,0xfd8dfa5e43000LL),reale(116550LL,0x911cc360c4000LL),
       reale(-45606LL,0x5472139be5000LL),reale(-66196LL,0x3621e725ee000LL),
       reale(66624LL,0xae21593727000LL),reale(-5577LL,0xfc909c53d8000LL),
       real(0x6f2264aae1649000LL),reale(-14833LL,0xd36bf488c2000LL),
-      reale(3661LL,0xe0e147ff8b000LL),real(-0x37687d20b9d14000LL),
-      reale(4430LL,0xd2ef37d92d000LL),real(-0x61330ed553f6a000LL),
-      real(-0x8fc7d2821691000LL),real(-0x4de8f81581e0b00LL),
+      reale(3661LL,0xe0e147ff8b000LL),-real(0x37687d20b9d14000LL),
+      reale(4430LL,0xd2ef37d92d000LL),-real(0x61330ed553f6a000LL),
+      -real(0x8fc7d2821691000LL),-real(0x4de8f81581e0b00LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^12, polynomial in n of order 14
-      real(-0x520b481798460000LL),reale(18997LL,0x2a845a090000LL),
+      -real(0x520b481798460000LL),reale(18997LL,0x2a845a090000LL),
       reale(-73061LL,0x14338a7640000LL),reale(119587LL,0x641c11f8f0000LL),
       reale(-63451LL,0xb0d24e0000LL),reale(-54597LL,0xab5ebfb650000LL),
       reale(77203LL,0x99135d6980000LL),reale(-15162LL,0x99696a3ab0000LL),
@@ -2791,41 +2791,41 @@ namespace GeographicLib {
       reale(2498LL,0xb270ac8f60000LL),reale(-2208LL,0x1a1eb845d0000LL),
       real(0x146e5a4ec1af3800LL),reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^11, polynomial in n of order 15
-      real(-0x8e2d12e55cc800LL),real(-0x3c744345ee05000LL),
-      real(-0x436e3347c2885800LL),reale(16354LL,0x603aee4aee000LL),
+      -real(0x8e2d12e55cc800LL),-real(0x3c744345ee05000LL),
+      -real(0x436e3347c2885800LL),reale(16354LL,0x603aee4aee000LL),
       reale(-66896LL,0xca9e46ad91800LL),reale(120525LL,0x7fafccca1000LL),
       reale(-82889LL,0x93187d3c58800LL),reale(-36027LL,0x48cf357af4000LL),
       reale(84916LL,0xe33bbac3af800LL),reale(-30330LL,0x65e7df59c7000LL),
       reale(-5004LL,0x98dbeb9376800LL),reale(-8176LL,0x5ae0cbecfa000LL),
-      reale(10601LL,0xdf58b3eb8d800LL),real(-0x51534d8656793000LL),
-      real(-0x13f74fe07242b800LL),real(-0x1338322158bf8680LL),
+      reale(10601LL,0xdf58b3eb8d800LL),-real(0x51534d8656793000LL),
+      -real(0x13f74fe07242b800LL),-real(0x1338322158bf8680LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^10, polynomial in n of order 16
-      real(-0x5e9d97de20000LL),real(-0x15f51b48a5a000LL),
-      real(-0x679f3a6a83c000LL),real(-0x2da38dbb53ee000LL),
-      real(-0x351287a208998000LL),reale(13549LL,0xfdc5cc829e000LL),
+      -real(0x5e9d97de20000LL),-real(0x15f51b48a5a000LL),
+      -real(0x679f3a6a83c000LL),-real(0x2da38dbb53ee000LL),
+      -real(0x351287a208998000LL),reale(13549LL,0xfdc5cc829e000LL),
       reale(-59299LL,0xca14375c8c000LL),reale(118312LL,0x8f7a13080a000LL),
       reale(-102645LL,0xf416a7e8f0000LL),reale(-8664LL,0xcd7c174b16000LL),
       reale(85056LL,0xa0c3d6fa54000LL),reale(-50542LL,0xa701315a82000LL),
-      real(0x9e0314066f78000LL),real(-0x56026edfbaf2000LL),
+      real(0x9e0314066f78000LL),-real(0x56026edfbaf2000LL),
       reale(9162LL,0x6ada71271c000LL),reale(-4515LL,0xc070d4197a000LL),
       real(0x19aa7dbc9bd2b100LL),reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^9, polynomial in n of order 17
-      real(-0x689b7f794800LL),real(-0x12aa316a68000LL),
-      real(-0x3c5fe03b7b800LL),real(-0xe70662316b000LL),
-      real(-0x468257445d2800LL),real(-0x204dea1c904e000LL),
-      real(-0x275c24b79c179800LL),reale(10640LL,0x725f868a0f000LL),
+      -real(0x689b7f794800LL),-real(0x12aa316a68000LL),
+      -real(0x3c5fe03b7b800LL),-real(0xe70662316b000LL),
+      -real(0x468257445d2800LL),-real(0x204dea1c904e000LL),
+      -real(0x275c24b79c179800LL),reale(10640LL,0x725f868a0f000LL),
       reale(-50164LL,0x7c98f9d6af800LL),reale(111598LL,0xa3db986ecc000LL),
       reale(-120106LL,0xe50b1b57c8800LL),reale(28289LL,0xbddfd64f09000LL),
       reale(70122LL,0x41f96206f1800LL),reale(-70105LL,0x32e30edbe6000LL),
       reale(17631LL,0x83f469b94a800LL),reale(3507LL,0xd4dd7e683000LL),
-      real(0x234fa818af3f3800LL),real(-0x5217ce807fb7e980LL),
+      real(0x234fa818af3f3800LL),-real(0x5217ce807fb7e980LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^8, polynomial in n of order 18
-      real(-0x8baa3048000LL),real(-0x155e3991c000LL),real(-0x38b7bd240000LL),
-      real(-0xa66484064000LL),real(-0x22acb24838000LL),
-      real(-0x89475b1e6c000LL),real(-0x2b8ce25f7b0000LL),
-      real(-0x14dd31b8f8b4000LL),real(-0x1acbb07dd4628000LL),
+      -real(0x8baa3048000LL),-real(0x155e3991c000LL),-real(0x38b7bd240000LL),
+      -real(0xa66484064000LL),-real(0x22acb24838000LL),
+      -real(0x89475b1e6c000LL),-real(0x2b8ce25f7b0000LL),
+      -real(0x14dd31b8f8b4000LL),-real(0x1acbb07dd4628000LL),
       reale(7723LL,0xe6c1cd6b44000LL),reale(-39541LL,0x4e2f6566e0000LL),
       reale(98832LL,0x70f12b47fc000LL),reale(-130554LL,0xb8b3b5a9e8000LL),
       reale(72091LL,0x9d4697d7f4000LL),reale(31173LL,0xcb977f1d70000LL),
@@ -2833,34 +2833,34 @@ namespace GeographicLib {
       reale(-8984LL,0x24cb05fba4000LL),real(0x7851cafec6ea600LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^7, polynomial in n of order 19
-      real(-0xbc3b1c3800LL),real(-0x19fd8659000LL),real(-0x3ce45316800LL),
-      real(-0x98e89f08000LL),real(-0x1a16c5239800LL),real(-0x4ef4224b7000LL),
-      real(-0x11089a8d8c800LL),real(-0x461e8219c6000LL),
-      real(-0x1740d89936f800LL),real(-0xbb97ef56095000LL),
-      real(-0xffd8608f0242800LL),reale(4956LL,0x2ae7ba647c000LL),
+      -real(0xbc3b1c3800LL),-real(0x19fd8659000LL),-real(0x3ce45316800LL),
+      -real(0x98e89f08000LL),-real(0x1a16c5239800LL),-real(0x4ef4224b7000LL),
+      -real(0x11089a8d8c800LL),-real(0x461e8219c6000LL),
+      -real(0x1740d89936f800LL),-real(0xbb97ef56095000LL),
+      -real(0xffd8608f0242800LL),reale(4956LL,0x2ae7ba647c000LL),
       reale(-27804LL,0x77793f179a800LL),reale(78703LL,0x691d56f30d000LL),
       reale(-126582LL,0x4d53dadbc7800LL),reale(111405LL,0x65dae188be000LL),
       reale(-33041LL,0x37d0713be4800LL),reale(-31123LL,0x5ae3e7032f000LL),
       reale(33849LL,0xe315529991800LL),reale(-10097LL,0x3035514bac080LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^6, polynomial in n of order 20
-      real(-0xd6ed08000LL),real(-0x1b8fe4a000LL),real(-0x3b33274000LL),
-      real(-0x860230e000LL),real(-0x142709a0000LL),real(-0x341c17b2000LL),
-      real(-0x92ee7ecc000LL),real(-0x1ccf17876000LL),real(-0x6786d9e38000LL),
-      real(-0x1bdf19e19a000LL),real(-0x9bb8377424000LL),
-      real(-0x5352681ef5e000LL),real(-0x79ce0dfd0cd0000LL),
+      -real(0xd6ed08000LL),-real(0x1b8fe4a000LL),-real(0x3b33274000LL),
+      -real(0x860230e000LL),-real(0x142709a0000LL),-real(0x341c17b2000LL),
+      -real(0x92ee7ecc000LL),-real(0x1ccf17876000LL),-real(0x6786d9e38000LL),
+      -real(0x1bdf19e19a000LL),-real(0x9bb8377424000LL),
+      -real(0x5352681ef5e000LL),-real(0x79ce0dfd0cd0000LL),
       reale(2563LL,0x29027cc1fe000LL),reale(-15918LL,0x531738b84000LL),
       reale(51375LL,0x61bf7d963a000LL),reale(-99437LL,0xc6f0784898000LL),
       reale(119998LL,0xa6d5e6f116000LL),reale(-88556LL,0xd863841e2c000LL),
       reale(36577LL,0x210e8c3652000LL),reale(-6478LL,0xccd0172bb6d00LL),
       reale(0xbf4bddLL,0x9d1f205d24685LL),
       // C4[5], coeff of eps^5, polynomial in n of order 21
-      real(-0x973b7800LL),real(-0x125656000LL),real(-0x24ee64800LL),
-      real(-0x4d94b7000LL),real(-0xaaf721800LL),real(-0x18e0978000LL),
-      real(-0x3dbc68e800LL),real(-0xa52d939000LL),real(-0x1e3bc54b800LL),
-      real(-0x62f2289a000LL),real(-0x174e12bf8800LL),real(-0x69ee83c3b000LL),
-      real(-0x2753bfa335800LL),real(-0x1693a2298bc000LL),
-      real(-0x23ce232de3a2800LL),real(0x33ca29bdcdd43000LL),
+      -real(0x973b7800LL),-real(0x125656000LL),-real(0x24ee64800LL),
+      -real(0x4d94b7000LL),-real(0xaaf721800LL),-real(0x18e0978000LL),
+      -real(0x3dbc68e800LL),-real(0xa52d939000LL),-real(0x1e3bc54b800LL),
+      -real(0x62f2289a000LL),-real(0x174e12bf8800LL),-real(0x69ee83c3b000LL),
+      -real(0x2753bfa335800LL),-real(0x1693a2298bc000LL),
+      -real(0x23ce232de3a2800LL),real(0x33ca29bdcdd43000LL),
       reale(-5755LL,0x96c59eaa20800LL),reale(21176LL,0x3b8f28c122000LL),
       reale(-47647LL,0x79fde44d73800LL),reale(67058LL,0x11f0010e41000LL),
       reale(-51818LL,0x6680b95db6800LL),reale(16192LL,0xfff7c612b6f80LL),
@@ -2868,77 +2868,77 @@ namespace GeographicLib {
       // C4[6], coeff of eps^26, polynomial in n of order 0
       real(0x43f7200LL),real(0x75209f8d91abLL),
       // C4[6], coeff of eps^25, polynomial in n of order 1
-      real(-0x3c404000LL),real(0x15c35400LL),real(0x64173937d043LL),
+      -real(0x3c404000LL),real(0x15c35400LL),real(0x64173937d043LL),
       // C4[6], coeff of eps^24, polynomial in n of order 2
-      real(-0x10389da9c000LL),real(0x19e75ef2000LL),real(0x821f98bc00LL),
+      -real(0x10389da9c000LL),real(0x19e75ef2000LL),real(0x821f98bc00LL),
       real(0xd767bab38dc330dLL),
       // C4[6], coeff of eps^23, polynomial in n of order 3
-      real(-0x142d81502c000LL),real(0x6dee9f4b8000LL),real(-0xae181cf64000LL),
+      -real(0x142d81502c000LL),real(0x6dee9f4b8000LL),-real(0xae181cf64000LL),
       real(0x39153b46b400LL),reale(3342LL,0x41381bc9272f3LL),
       // C4[6], coeff of eps^22, polynomial in n of order 4
-      real(-0x13480fca8c000LL),real(0x16106a2c37000LL),
-      real(-0x1502d2e846000LL),real(0x16180c1bd000LL),real(0x74238242a00LL),
+      -real(0x13480fca8c000LL),real(0x16106a2c37000LL),
+      -real(0x1502d2e846000LL),real(0x16180c1bd000LL),real(0x74238242a00LL),
       reale(3342LL,0x41381bc9272f3LL),
       // C4[6], coeff of eps^21, polynomial in n of order 5
-      real(-0x1c0b06f2aed0000LL),real(0x44926ab731c0000LL),
-      real(-0x2031c71e85b0000LL),real(0xca25cdaf0e0000LL),
-      real(-0x14c7d62b6490000LL),real(0x61052e04125000LL),
+      -real(0x1c0b06f2aed0000LL),real(0x44926ab731c0000LL),
+      -real(0x2031c71e85b0000LL),real(0xca25cdaf0e0000LL),
+      -real(0x14c7d62b6490000LL),real(0x61052e04125000LL),
       reale(0x1163fcLL,0xdfbd02f131dafLL),
       // C4[6], coeff of eps^20, polynomial in n of order 6
-      real(-0x3c147e5183b90000LL),real(0x5c8a793ab7a08000LL),
-      real(-0x14e3709880260000LL),real(0x26583d412b938000LL),
-      real(-0x1ec1409e52930000LL),real(0xd82d55b5068000LL),
+      -real(0x3c147e5183b90000LL),real(0x5c8a793ab7a08000LL),
+      -real(0x14e3709880260000LL),real(0x26583d412b938000LL),
+      -real(0x1ec1409e52930000LL),real(0xd82d55b5068000LL),
       real(0x4a1c5add9a3000LL),reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^19, polynomial in n of order 7
       reale(-2885LL,0x6888986810000LL),real(0x5dcb94a5bbaa0000LL),
-      real(-0x2147754a866d0000LL),real(0x59b9e153ee1c0000LL),
-      real(-0x1d3317b06cdb0000LL),real(0xfd67f86b28e0000LL),
-      real(-0x193b89a255c90000LL),real(0x662541f54195000LL),
+      -real(0x2147754a866d0000LL),real(0x59b9e153ee1c0000LL),
+      -real(0x1d3317b06cdb0000LL),real(0xfd67f86b28e0000LL),
+      -real(0x193b89a255c90000LL),real(0x662541f54195000LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^18, polynomial in n of order 8
       reale(-5405LL,0xa1991e06d0000LL),real(0x194c5bcfa9f36000LL),
       reale(-2202LL,0xb0dcf6bb1c000LL),reale(2053LL,0x73a8845e02000LL),
-      real(-0x127ebba7aac98000LL),real(0x433c97a5782ce000LL),
-      real(-0x29997437ffc4c000LL),real(-0xb36408ece66000LL),
-      real(-0x4eb946c9b6ac00LL),reale(0xe213d7LL,0x5c99263f881e3LL),
+      -real(0x127ebba7aac98000LL),real(0x433c97a5782ce000LL),
+      -real(0x29997437ffc4c000LL),-real(0xb36408ece66000LL),
+      -real(0x4eb946c9b6ac00LL),reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^17, polynomial in n of order 9
       reale(-2830LL,0xa8bb37a568000LL),real(0x53fda6bff9540000LL),
       reale(-5947LL,0x3e8620cd18000LL),real(0x424987c8bd3f0000LL),
-      real(-0x4d6fba1e72f38000LL),reale(2362LL,0x7a9b39aaa0000LL),
-      real(-0x1a7dd6520d788000LL),real(0x1ca5a49549150000LL),
-      real(-0x279b8ad82b3d8000LL),real(0x8624b660e613800LL),
+      -real(0x4d6fba1e72f38000LL),reale(2362LL,0x7a9b39aaa0000LL),
+      -real(0x1a7dd6520d788000LL),real(0x1ca5a49549150000LL),
+      -real(0x279b8ad82b3d8000LL),real(0x8624b660e613800LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^16, polynomial in n of order 10
       reale(3052LL,0x1cc54fce28000LL),reale(15175LL,0x33b0e2aba4000LL),
-      reale(-5745LL,0xf3abbf2820000LL),real(-0xd3fdde9c4364000LL),
+      reale(-5745LL,0xf3abbf2820000LL),-real(0xd3fdde9c4364000LL),
       reale(-5628LL,0xbd4d5ba218000LL),reale(2296LL,0xc920e17994000LL),
-      real(-0x15ef23de88bf0000LL),reale(2060LL,0x9b7c8a7a8c000LL),
-      real(-0x3634e9b2229f8000LL),real(-0x3eaac877287c000LL),
-      real(-0x1ee323a1ca0c800LL),reale(0xe213d7LL,0x5c99263f881e3LL),
+      -real(0x15ef23de88bf0000LL),reale(2060LL,0x9b7c8a7a8c000LL),
+      -real(0x3634e9b2229f8000LL),-real(0x3eaac877287c000LL),
+      -real(0x1ee323a1ca0c800LL),reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^15, polynomial in n of order 11
       reale(-77305LL,0x14b26f7638000LL),reale(21636LL,0x8867f71d90000LL),
       reale(6061LL,0x1026579ee8000LL),reale(12960LL,0x5a843c8140000LL),
-      reale(-9404LL,0xfda467ab98000LL),real(-0x35c5d916ffb10000LL),
+      reale(-9404LL,0xfda467ab98000LL),-real(0x35c5d916ffb10000LL),
       reale(-4115LL,0xc2ec441448000LL),reale(3690LL,0x5a8c0420a0000LL),
-      real(-0x7db1fc00af08000LL),real(0x3ee56918f4c50000LL),
-      real(-0x41d90b24a2658000LL),real(0xb0f65a4ddefb800LL),
+      -real(0x7db1fc00af08000LL),real(0x3ee56918f4c50000LL),
+      -real(0x41d90b24a2658000LL),real(0xb0f65a4ddefb800LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^14, polynomial in n of order 12
       reale(84445LL,0xef949ea0f8000LL),reale(19627LL,0xf0e541fbce000LL),
       reale(-80834LL,0xa08bedc824000LL),reale(34575LL,0x1644d05d7a000LL),
       reale(6828LL,0x4cfbe5cb50000LL),reale(8288LL,0x561945cd26000LL),
       reale(-12839LL,0x92c1cd7e7c000LL),real(0x15c5608ef0ed2000LL),
-      real(-0x653ba29de4a58000LL),reale(4217LL,0x4b5d86267e000LL),
-      real(-0x3b46409683b2c000LL),real(-0x974d654f27d6000LL),
-      real(-0x674dea252558c00LL),reale(0xe213d7LL,0x5c99263f881e3LL),
+      -real(0x653ba29de4a58000LL),reale(4217LL,0x4b5d86267e000LL),
+      -real(0x3b46409683b2c000LL),-real(0x974d654f27d6000LL),
+      -real(0x674dea252558c00LL),reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^13, polynomial in n of order 13
       reale(45373LL,0x376f121df0000LL),reale(-98872LL,0x1cf2432040000LL),
-      reale(96522LL,0x4174515a90000LL),real(-0x2d5b0f36d6d20000LL),
+      reale(96522LL,0x4174515a90000LL),-real(0x2d5b0f36d6d20000LL),
       reale(-79484LL,0xacd8facf30000LL),reale(50297LL,0xf87ac09580000LL),
       reale(3071LL,0x5d816f2bd0000LL),real(0x5cfb30543d820000LL),
       reale(-14133LL,0xb3e4e32070000LL),reale(3907LL,0xfc9bf30ac0000LL),
       real(0x1e5e0fff75d10000LL),reale(2700LL,0x7f35ecdd60000LL),
-      real(-0x74992b46f6e50000LL),real(0xe2f417f6bbc1000LL),
+      -real(0x74992b46f6e50000LL),real(0xe2f417f6bbc1000LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^12, polynomial in n of order 14
       real(0x1b3ddeae39bf0000LL),reale(-7840LL,0x9d9685eca8000LL),
@@ -2947,8 +2947,8 @@ namespace GeographicLib {
       reale(-70222LL,0x72a254240000LL),reale(66679LL,0x434a03a4f8000LL),
       reale(-7927LL,0x3e84b5b9b0000LL),reale(-5105LL,0xb39463d268000LL),
       reale(-10826LL,0x68d0386120000LL),reale(8339LL,0xae0935c7d8000LL),
-      real(-0xb5e35652d770000LL),real(-0xb97cf166cab8000LL),
-      real(-0x1484ac4370939000LL),reale(0xe213d7LL,0x5c99263f881e3LL),
+      -real(0xb5e35652d770000LL),-real(0xb97cf166cab8000LL),
+      -real(0x1484ac4370939000LL),reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^11, polynomial in n of order 15
       real(0x1da928c9710000LL),real(0xef3463c3520000LL),
       real(0x1433e03669f30000LL),reale(-6122LL,0x376a120b40000LL),
@@ -2967,7 +2967,7 @@ namespace GeographicLib {
       reale(-83692LL,0xbe01c1fd51000LL),reale(-14376LL,0x52590d21aa000LL),
       reale(76590LL,0xeb60670083000LL),reale(-52129LL,0x656e27c31c000LL),
       reale(7010LL,0x5a128dfcb5000LL),reale(3866LL,0xf6d75c088e000LL),
-      real(0x469f50315e7e7000LL),real(-0x4bbe9f188165a200LL),
+      real(0x469f50315e7e7000LL),-real(0x4bbe9f188165a200LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^9, polynomial in n of order 17
       real(0x8ddfb274000LL),real(0x1ccea7740000LL),real(0x6b145a40c000LL),
@@ -2977,13 +2977,13 @@ namespace GeographicLib {
       reale(107702LL,0xd776bbe6c000LL),reale(-107580LL,0x1cbface6b8000LL),
       reale(33813LL,0xa464b8b604000LL),reale(48035LL,0x81a4fa0dd0000LL),
       reale(-64048LL,0x5bd9a37f9c000LL),reale(31225LL,0xe027c1dce8000LL),
-      reale(-5636LL,0x2a297fc734000LL),real(-0x50368754849c400LL),
+      reale(-5636LL,0x2a297fc734000LL),-real(0x50368754849c400LL),
       reale(0xe213d7LL,0x5c99263f881e3LL),
       // C4[6], coeff of eps^8, polynomial in n of order 18
       real(0x7240494000LL),real(0x13aa0f5a000LL),real(0x3b2b77a0000LL),
       real(0xc68497e6000LL),real(0x2fcbb8aac000LL),real(0xdd4302e72000LL),
       real(0x534405e9b8000LL),real(0x30298b6eefe000LL),
-      real(0x4c5dcf34c0c4000LL),real(-0x6d574da684a76000LL),
+      real(0x4c5dcf34c0c4000LL),-real(0x6d574da684a76000LL),
       reale(11873LL,0x12afe73bd0000LL),reale(-42010LL,0xaf63f69e16000LL),
       reale(89073LL,0x6259ee06dc000LL),reale(-115684LL,0x519b5d84a2000LL),
       reale(82889LL,0x8f2a67cde8000LL),reale(-11936LL,0x4e23ac852e000LL),
@@ -2994,17 +2994,17 @@ namespace GeographicLib {
       real(0x1feb1c0000LL),real(0x6346964000LL),real(0x1597d188000LL),
       real(0x56a252ac000LL),real(0x1a3bcf550000LL),real(0xa648bd1f4000LL),
       real(0x65fb114118000LL),real(0xacffeca0b3c000LL),
-      real(-0x10c1b440c2720000LL),real(0x7d0a1c0732284000LL),
+      -real(0x10c1b440c2720000LL),real(0x7d0a1c0732284000LL),
       reale(-7962LL,0xe4c185e0a8000LL),reale(19682LL,0xa4af1c3bcc000LL),
       reale(-31918LL,0x3337107c70000LL),reale(34094LL,0x3798b7b14000LL),
       reale(-23102LL,0xa7c0ead038000LL),reale(8983LL,0xdb34fa045c000LL),
-      real(-0x5f40c0b45d798c00LL),reale(0x4b5bf2LL,0x74330cbfd80a1LL),
+      -real(0x5f40c0b45d798c00LL),reale(0x4b5bf2LL,0x74330cbfd80a1LL),
       // C4[6], coeff of eps^6, polynomial in n of order 20
       real(0x26d5c000LL),real(0x58391000LL),real(0xd2f06000LL),
       real(0x216bfb000LL),real(0x5aaab0000LL),real(0x10a5565000LL),
       real(0x35c765a000LL),real(0xc335dcf000LL),real(0x334e2804000LL),
       real(0x106060339000LL),real(0x6e2b415ae000LL),real(0x484c62e3a3000LL),
-      real(0x848c0aa1558000LL),real(-0xe0b56a0582f3000LL),
+      real(0x848c0aa1558000LL),-real(0xe0b56a0582f3000LL),
       real(0x745df25523d02000LL),reale(-8379LL,0x93d80ded77000LL),
       reale(23938LL,0x5996b3a2ac000LL),reale(-45882LL,0x299f27b2e1000LL),
       reale(58395LL,0x10d8591c56000LL),reale(-42674LL,0xaec45c6b4b000LL),
@@ -3014,59 +3014,59 @@ namespace GeographicLib {
       // C4[7], coeff of eps^25, polynomial in n of order 1
       real(0x3a6d50000LL),real(0x138f18400LL),real(0x4082f7e0f93b2fLL),
       // C4[7], coeff of eps^24, polynomial in n of order 2
-      real(0x5599e7780000LL),real(-0x8cfe739c0000LL),real(0x28b139bd9800LL),
+      real(0x5599e7780000LL),-real(0x8cfe739c0000LL),real(0x28b139bd9800LL),
       reale(3231LL,0x13f0854e6fdc3LL),
       // C4[7], coeff of eps^23, polynomial in n of order 3
-      real(0x2cef3d4baf0000LL),real(-0x23eaa989be0000LL),
+      real(0x2cef3d4baf0000LL),-real(0x23eaa989be0000LL),
       real(0xef66e7c50000LL),real(0x5431e6572400LL),
       reale(119549LL,0xe1c344562ad2fLL),
       // C4[7], coeff of eps^22, polynomial in n of order 4
-      real(0x33ca8094LL<<20),real(-0x1146ab51LL<<20),real(0x951494aLL<<20),
-      real(-0xee7ce1bLL<<20),real(0x3ccfc393c000LL),
+      real(0x33ca8094LL<<20),-real(0x1146ab51LL<<20),real(0x951494aLL<<20),
+      -real(0xee7ce1bLL<<20),real(0x3ccfc393c000LL),
       reale(3856LL,0x72a333c0b70f1LL),
       // C4[7], coeff of eps^21, polynomial in n of order 5
-      real(0x4e0ae513ee240000LL),real(-0xc0c2e3c4cfLL<<20),
-      real(0x2891fd50f97c0000LL),real(-0x1a095b35a9f80000LL),
-      real(-0x52187764ac0000LL),real(-0x22c21c78f4d000LL),
+      real(0x4e0ae513ee240000LL),-real(0xc0c2e3c4cfLL<<20),
+      real(0x2891fd50f97c0000LL),-real(0x1a095b35a9f80000LL),
+      -real(0x52187764ac0000LL),-real(0x22c21c78f4d000LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^20, polynomial in n of order 6
-      real(0x2faca7f6766LL<<20),real(-0x28623ac8329LL<<20),
-      real(0x55c963456a4LL<<20),real(-0x11bb996f2dfLL<<20),
-      real(0x108bab390a2LL<<20),real(-0x17b5bd88f85LL<<20),
+      real(0x2faca7f6766LL<<20),-real(0x28623ac8329LL<<20),
+      real(0x55c963456a4LL<<20),-real(0x11bb996f2dfLL<<20),
+      real(0x108bab390a2LL<<20),-real(0x17b5bd88f85LL<<20),
       real(0x53401a2130be000LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^19, polynomial in n of order 7
-      real(-0x83a0cdc49940000LL),reale(-2693LL,0x7731e95580000LL),
-      real(0x5a9e6c539a840000LL),real(-0xc24642d3d7LL<<20),
-      real(0x4606e5f7741c0000LL),real(-0x210591b042380000LL),
-      real(-0x1ee58ad2bcc0000LL),real(-0xe57fab5d571000LL),
+      -real(0x83a0cdc49940000LL),reale(-2693LL,0x7731e95580000LL),
+      real(0x5a9e6c539a840000LL),-real(0xc24642d3d7LL<<20),
+      real(0x4606e5f7741c0000LL),-real(0x210591b042380000LL),
+      -real(0x1ee58ad2bcc0000LL),-real(0xe57fab5d571000LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^18, polynomial in n of order 8
       reale(3472LL,0x3c58cb98LL<<20),reale(-5077LL,0x2e5a0d05LL<<20),
-      real(-0x23c291494eLL<<20),real(-0x6a9c1a13021LL<<20),
-      reale(2051LL,0xf8c055ccLL<<20),real(-0xa41376ff47LL<<20),
-      real(0x1f44e68cce6LL<<20),real(-0x245598aac6dLL<<20),
+      -real(0x23c291494eLL<<20),-real(0x6a9c1a13021LL<<20),
+      reale(2051LL,0xf8c055ccLL<<20),-real(0xa41376ff47LL<<20),
+      real(0x1f44e68cce6LL<<20),-real(0x245598aac6dLL<<20),
       real(0x69deaea556c4000LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^17, polynomial in n of order 9
-      reale(15000LL,0xe6601a91a0000LL),real(-0x261369ca72fLL<<20),
+      reale(15000LL,0xe6601a91a0000LL),-real(0x261369ca72fLL<<20),
       real(0x42e9870754860000LL),reale(-5749LL,0x340bba88c0000LL),
-      real(0x3d07c1e90b320000LL),real(-0x1f816cb77f780000LL),
-      real(0x7fb986a3c79e0000LL),real(-0x26578914f47c0000LL),
-      real(-0x4ae4d5f0bb60000LL),real(-0x2b86668e596d800LL),
+      real(0x3d07c1e90b320000LL),-real(0x1f816cb77f780000LL),
+      real(0x7fb986a3c79e0000LL),-real(0x26578914f47c0000LL),
+      -real(0x4ae4d5f0bb60000LL),-real(0x2b86668e596d800LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^16, polynomial in n of order 10
-      real(-0x73f9d78b0d9LL<<20),real(0x4e7a9c7503280000LL),
+      -real(0x73f9d78b0d9LL<<20),real(0x4e7a9c7503280000LL),
       reale(15740LL,0x2392a74cLL<<20),reale(-4249LL,0xcc7c095580000LL),
-      real(-0x407b444d4cfLL<<20),reale(-4969LL,0xc0c67a4080000LL),
+      -real(0x407b444d4cfLL<<20),reale(-4969LL,0xc0c67a4080000LL),
       reale(2638LL,0x3b83d7e6LL<<20),real(0x88c04a730380000LL),
-      real(0x44a3b895a7bLL<<20),real(-0x3a51363dc5180000LL),
+      real(0x44a3b895a7bLL<<20),-real(0x3a51363dc5180000LL),
       real(0x855f1c455087000LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^15, polynomial in n of order 11
       reale(61154LL,0xdd701642e0000LL),reale(-66912LL,0x73fb09c140000LL),
       reale(7800LL,0xcd3506c5a0000LL),reale(6879LL,0x58cd2b71LL<<20),
       reale(13340LL,0xebc72e5460000LL),reale(-8996LL,0xe1a48b80c0000LL),
-      real(-0x58226c8c268e0000LL),reale(-2528LL,0xf4a2f95880000LL),
-      reale(3789LL,0xabee5235e0000LL),real(-0x1eca7dff19fc0000LL),
-      real(-0x7ff214bf2760000LL),real(-0x75bce0e31735800LL),
+      -real(0x58226c8c268e0000LL),reale(-2528LL,0xf4a2f95880000LL),
+      reale(3789LL,0xabee5235e0000LL),-real(0x1eca7dff19fc0000LL),
+      -real(0x7ff214bf2760000LL),-real(0x75bce0e31735800LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^14, polynomial in n of order 12
       reale(-101657LL,0x71ae74f4LL<<20),reale(53043LL,0x223d2095LL<<20),
@@ -3074,19 +3074,19 @@ namespace GeographicLib {
       reale(23050LL,0x5b912df8LL<<20),reale(9407LL,0xe5488f19LL<<20),
       reale(7022LL,0xeb6bec7aLL<<20),reale(-12739LL,0xf0edb55bLL<<20),
       real(0x4df9e23a6fcLL<<20),real(0x118e235259dLL<<20),
-      reale(2782LL,0x4bc9e97eLL<<20),real(-0x61e77094421LL<<20),
+      reale(2782LL,0x4bc9e97eLL<<20),-real(0x61e77094421LL<<20),
       real(0x9e768b34c754000LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^13, polynomial in n of order 13
       reale(-21346LL,0x393f573540000LL),reale(63537LL,0xd254ce1fLL<<20),
       reale(-101991LL,0xec282a30c0000LL),reale(73206LL,0xb939804c80000LL),
       reale(21832LL,0x8bfbf3440000LL),reale(-78786LL,0x910c2aeaLL<<20),
       reale(42984LL,0xe415720fc0000LL),reale(4706LL,0x1b30244780000LL),
-      real(-0x6fb64418f6cc0000LL),reale(-11953LL,0x9ad612b5LL<<20),
+      -real(0x6fb64418f6cc0000LL),reale(-11953LL,0x9ad612b5LL<<20),
       reale(6137LL,0x3819368ec0000LL),real(0x1ceca02d88280000LL),
-      real(-0x2d5a1d362dc0000LL),real(-0x14a7906c9982d000LL),
+      -real(0x2d5a1d362dc0000LL),-real(0x14a7906c9982d000LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^12, polynomial in n of order 14
-      real(-0x767f211b2aLL<<20),reale(2615LL,0x8698ee3LL<<20),
+      -real(0x767f211b2aLL<<20),reale(2615LL,0x8698ee3LL<<20),
       reale(-16755LL,0x8d55257cLL<<20),reale(54113LL,0x58a8d2e5LL<<20),
       reale(-98063LL,0x29302962LL<<20),reale(91200LL,0xa6fbe637LL<<20),
       reale(-9604LL,0xcc190aa8LL<<20),reale(-69012LL,0xe24608f9LL<<20),
@@ -3095,29 +3095,29 @@ namespace GeographicLib {
       reale(7974LL,0x231c3faLL<<20),reale(-2669LL,0xd8692f1fLL<<20),
       real(0x8b8039451326000LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^11, polynomial in n of order 15
-      real(-0x4fc4c2e840000LL),real(-0x2f63f986280000LL),
-      real(-0x4cec268118c0000LL),real(0x702c4e5b497LL<<20),
+      -real(0x4fc4c2e840000LL),-real(0x2f63f986280000LL),
+      -real(0x4cec268118c0000LL),real(0x702c4e5b497LL<<20),
       reale(-12305LL,0xaa8fdfeec0000LL),reale(43346LL,0x51cc5fb080000LL),
       reale(-88872LL,0xa25817fe40000LL),reale(103468LL,0x37d02f3aLL<<20),
       reale(-46366LL,0x45288ce5c0000LL),reale(-41350LL,0xda855d8380000LL),
       reale(72365LL,0x9597fe7540000LL),reale(-36581LL,0x66b4b4ddLL<<20),
       real(0x3033fbc727cc0000LL),reale(3419LL,0x57c1ab9680000LL),
-      real(0x5d00262e0cc40000LL),real(-0x44e0e913b4a79000LL),
+      real(0x5d00262e0cc40000LL),-real(0x44e0e913b4a79000LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^10, polynomial in n of order 16
-      real(-0x1526f7LL<<24),real(-0x68a88b9LL<<20),real(-0x2a358682LL<<20),
-      real(-0x1a3e60a4bLL<<20),real(-0x2ce197fb94LL<<20),
+      -real(0x1526f7LL<<24),-real(0x68a88b9LL<<20),-real(0x2a358682LL<<20),
+      -real(0x1a3e60a4bLL<<20),-real(0x2ce197fb94LL<<20),
       real(0x4592e53c723LL<<20),reale(-8215LL,0x6decc35aLL<<20),
       reale(31749LL,0xea580d91LL<<20),reale(-73862LL,0xa3060848LL<<20),
       reale(105371LL,0xded9faffLL<<20),reale(-81326LL,0xa57bc536LL<<20),
       reale(5533LL,0x9b69716dLL<<20),reale(54935LL,0x1e8a6c24LL<<20),
       reale(-54850LL,0xf340a2dbLL<<20),reale(23331LL,0xfc74cf12LL<<20),
-      reale(-3572LL,0xc712b149LL<<20),real(-0xa766ab1fb094000LL),
+      reale(-3572LL,0xc712b149LL<<20),-real(0xa766ab1fb094000LL),
       reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^9, polynomial in n of order 17
-      real(-0x8d7a970000LL),real(-0x209c2bLL<<20),real(-0x8adb5490000LL),
-      real(-0x2cb1dafa0000LL),real(-0x12da13bdb0000LL),
-      real(-0xc549443040000LL),real(-0x1658a10fa0d0000LL),
+      -real(0x8d7a970000LL),-real(0x209c2bLL<<20),-real(0x8adb5490000LL),
+      -real(0x2cb1dafa0000LL),-real(0x12da13bdb0000LL),
+      -real(0xc549443040000LL),-real(0x1658a10fa0d0000LL),
       real(0x250f39cc17720000LL),reale(-4743LL,0xffd1f9c610000LL),
       reale(20239LL,0xc76fee6a80000LL),reale(-53603LL,0xd95b5dbaf0000LL),
       reale(92339LL,0x3cdcf0cde0000LL),reale(-101237LL,0xf904c301d0000LL),
@@ -3125,21 +3125,21 @@ namespace GeographicLib {
       reale(-32945LL,0x793fa374a0000LL),reale(24775LL,0x5aee521590000LL),
       reale(-6658LL,0x521f990157400LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^8, polynomial in n of order 18
-      real(-0x3d7880000LL),real(-0xbe0fc0000LL),real(-165572LL<<20),
-      real(-0x9aa4840000LL),real(-0x2adb4f80000LL),real(-0xe6e14cc0000LL),
-      real(-0x666b5b3LL<<20),real(-0x46e9da3540000LL),
-      real(-0x89237b88680000LL),real(0xf5289483e640000LL),
+      -real(0x3d7880000LL),-real(0xbe0fc0000LL),-real(165572LL<<20),
+      -real(0x9aa4840000LL),-real(0x2adb4f80000LL),-real(0xe6e14cc0000LL),
+      -real(0x666b5b3LL<<20),-real(0x46e9da3540000LL),
+      -real(0x89237b88680000LL),real(0xf5289483e640000LL),
       reale(-2142LL,0x9739a99eLL<<20),reale(10163LL,0xf2a381edc0000LL),
       reale(-30732LL,0x5cd062280000LL),reale(63101LL,0xdb7b98c940000LL),
       reale(-89757LL,0x471a126fLL<<20),reale(87316LL,0x63109160c0000LL),
       reale(-55354LL,0xda1bbeb80000LL),reale(20534LL,0x8754849c40000LL),
       reale(-3369LL,0xdcc223e5d800LL),reale(0x104dbd1LL,0x1c132c21ebd41LL),
       // C4[7], coeff of eps^7, polynomial in n of order 19
-      real(-0x12550000LL),real(-0x32460000LL),real(-0x94070000LL),
-      real(-7579LL<<20),real(-0x689d90000LL),real(-0x1a131a0000LL),
-      real(-0x790f8b0000LL),real(-0x2ae74440000LL),real(-0x1427d8dd0000LL),
-      real(-0xee3402ee0000LL),real(-0x1efc2a618f0000LL),
-      real(0x3c3fa7bdb280000LL),real(-0x243e4ae81d610000LL),
+      -real(0x12550000LL),-real(0x32460000LL),-real(0x94070000LL),
+      -real(7579LL<<20),-real(0x689d90000LL),-real(0x1a131a0000LL),
+      -real(0x790f8b0000LL),-real(0x2ae74440000LL),-real(0x1427d8dd0000LL),
+      -real(0xee3402ee0000LL),-real(0x1efc2a618f0000LL),
+      real(0x3c3fa7bdb280000LL),-real(0x243e4ae81d610000LL),
       reale(3081LL,0xb7f72703e0000LL),reale(-10640LL,0xbbbd057ed0000LL),
       reale(25534LL,0x3d6d8c6940000LL),reale(-43525LL,0xba33d0a9b0000LL),
       reale(51336LL,0x52534b86a0000LL),reale(-35936LL,0x932c17ee90000LL),
@@ -3147,61 +3147,61 @@ namespace GeographicLib {
       // C4[8], coeff of eps^26, polynomial in n of order 0
       real(0xd4e0000LL),real(0x7c72a9866ac5bLL),
       // C4[8], coeff of eps^25, polynomial in n of order 1
-      real(-177229LL<<20),real(0xb18730000LL),real(0x491cf6cbc520f1LL),
+      -real(177229LL<<20),real(0xb18730000LL),real(0x491cf6cbc520f1LL),
       // C4[8], coeff of eps^24, polynomial in n of order 2
-      real(-0x93f6bc6840000LL),real(-0x14f4b1f20000LL),real(-0x88fc23ec000LL),
+      -real(0x93f6bc6840000LL),-real(0x14f4b1f20000LL),-real(0x88fc23ec000LL),
       reale(40280LL,0xc561288d94a7fLL),
       // C4[8], coeff of eps^23, polynomial in n of order 3
-      real(-0x161894ee480000LL),real(0x12aa85331LL<<20),
-      real(-0x1b65cf99180000LL),real(0x62bf29e3e8000LL),
+      -real(0x161894ee480000LL),real(0x12aa85331LL<<20),
+      -real(0x1b65cf99180000LL),real(0x62bf29e3e8000LL),
       reale(135489LL,0xddbb2b5096ef1LL),
       // C4[8], coeff of eps^22, polynomial in n of order 4
-      real(-0xb7278f038LL<<20),real(0x3d693f0c92LL<<20),
-      real(-0x1f4e13827cLL<<20),real(-0x1842f819aLL<<20),
-      real(-0xacc29a2990000LL),reale(0x1ae058LL,0x42813317aa23dLL),
+      -real(0xb7278f038LL<<20),real(0x3d693f0c92LL<<20),
+      -real(0x1f4e13827cLL<<20),-real(0x1842f819aLL<<20),
+      -real(0xacc29a2990000LL),reale(0x1ae058LL,0x42813317aa23dLL),
       // C4[8], coeff of eps^21, polynomial in n of order 5
-      real(-0x354a11b9e2580000LL),real(0x4dd877fc48aLL<<20),
-      real(-0x8f791d3a3680000LL),real(0x11c215e6335LL<<20),
-      real(-0x161c113e61780000LL),real(0x4429220c0f48000LL),
+      -real(0x354a11b9e2580000LL),real(0x4dd877fc48aLL<<20),
+      -real(0x8f791d3a3680000LL),real(0x11c215e6335LL<<20),
+      -real(0x161c113e61780000LL),real(0x4429220c0f48000LL),
       reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^20, polynomial in n of order 6
       reale(-2935LL,0xe58446bfLL<<20),real(0x351db209cd880000LL),
-      real(-0xd982d18896LL<<20),real(0x46b48a654db80000LL),
-      real(-0x1951684536bLL<<20),real(-0x2829437b4180000LL),
-      real(-0x1536c8746170000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      -real(0xd982d18896LL<<20),real(0x46b48a654db80000LL),
+      -real(0x1951684536bLL<<20),-real(0x2829437b4180000LL),
+      -real(0x1536c8746170000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^19, polynomial in n of order 7
-      reale(-3512LL,0x918ea85280000LL),real(-0x204aea957e3LL<<20),
+      reale(-3512LL,0x918ea85280000LL),-real(0x204aea957e3LL<<20),
       reale(-2146LL,0xdb7d866f80000LL),real(0x67ab1c5581eLL<<20),
-      real(-0x13d8d488380000LL),real(0x21f191654dfLL<<20),
-      real(-0x2114d7448e680000LL),real(0x53ff9bb26958000LL),
+      -real(0x13d8d488380000LL),real(0x21f191654dfLL<<20),
+      -real(0x2114d7448e680000LL),real(0x53ff9bb26958000LL),
       reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^18, polynomial in n of order 8
       reale(2327LL,0xd507b61LL<<24),reale(3002LL,0x513d8c0aLL<<20),
-      reale(-5099LL,0xd4e3b86cLL<<20),real(-0x25ceba7a2LL<<20),
-      real(-0x31e92424bf8LL<<20),real(0x799d0d96612LL<<20),
-      real(-0x19490c8c4dcLL<<20),real(-0x490dda8e9aLL<<20),
-      real(-0x33e11620e250000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      reale(-5099LL,0xd4e3b86cLL<<20),-real(0x25ceba7a2LL<<20),
+      -real(0x31e92424bf8LL<<20),real(0x799d0d96612LL<<20),
+      -real(0x19490c8c4dcLL<<20),-real(0x490dda8e9aLL<<20),
+      -real(0x33e11620e250000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^17, polynomial in n of order 9
       reale(-6704LL,0xd4115b5880000LL),reale(14458LL,0x65ca13f4LL<<20),
-      real(-0x3b9765d55080000LL),real(-0x9192a65f9LL<<20),
+      -real(0x3b9765d55080000LL),-real(0x9192a65f9LL<<20),
       reale(-5283LL,0x27cb55f680000LL),real(0x6668ccb1d7aLL<<20),
       real(0xd2bcdb640d80000LL),real(0x48aecde6f2dLL<<20),
-      real(-0x3353b5e7c2b80000LL),real(0x650db91f67c8000LL),
+      -real(0x3353b5e7c2b80000LL),real(0x650db91f67c8000LL),
       reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^16, polynomial in n of order 10
       reale(-41675LL,0xbe119ede80000LL),reale(-7594LL,0x9ca8964e40000LL),
       real(0x45ab72cec72LL<<20),reale(15266LL,0x7545b9b5c0000LL),
-      reale(-4857LL,0x86556f8580000LL),real(-0x76ec691ccd2c0000LL),
+      reale(-4857LL,0x86556f8580000LL),-real(0x76ec691ccd2c0000LL),
       reale(-3303LL,0x6ff9fcb9LL<<20),reale(3252LL,0xd63fbdd4c0000LL),
-      real(-0xa56dc66b5380000LL),real(-0x5b75ff5133c0000LL),
-      real(-0x7d0ead839928000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      -real(0xa56dc66b5380000LL),-real(0x5b75ff5133c0000LL),
+      -real(0x7d0ead839928000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^15, polynomial in n of order 11
       reale(6774LL,0xfe31cddf80000LL),reale(68916LL,0x2d269395LL<<20),
       reale(-58359LL,0x7051a71280000LL),reale(3030LL,0x95a6df84LL<<20),
       reale(8321LL,0x3ad7949580000LL),reale(11199LL,0x3b4c11f3LL<<20),
-      reale(-10211LL,0xf3ffaac880000LL),real(-0x2197fd386beLL<<20),
-      real(-0x88d945e9f480000LL),reale(2764LL,0x777313d1LL<<20),
-      real(-0x51f911c354180000LL),real(0x6eb0baaefa68000LL),
+      reale(-10211LL,0xf3ffaac880000LL),-real(0x2197fd386beLL<<20),
+      -real(0x88d945e9f480000LL),reale(2764LL,0x777313d1LL<<20),
+      -real(0x51f911c354180000LL),real(0x6eb0baaefa68000LL),
       reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^14, polynomial in n of order 12
       reale(80789LL,0x4afe5ef8LL<<20),reale(-92414LL,0x96a1aa2aLL<<20),
@@ -3210,37 +3210,37 @@ namespace GeographicLib {
       reale(9867LL,0xdc15875cLL<<20),reale(2235LL,0x613d3636LL<<20),
       reale(-11864LL,0xbcde17a8LL<<20),reale(4226LL,0xe3b4e8faLL<<20),
       real(0x31b8c0ba174LL<<20),real(0x4eeb4b1fdeLL<<20),
-      real(-0x1429c96cdeb90000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      -real(0x1429c96cdeb90000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^13, polynomial in n of order 13
       reale(7986LL,0x4cd10c1180000LL),reale(-31050LL,0x5a7fe822LL<<20),
       reale(71398LL,0xc143b88280000LL),reale(-96608LL,0x1b16cd97LL<<20),
       reale(60036LL,0xdbd0ec4380000LL),reale(24533LL,0x47d2cc6cLL<<20),
       reale(-73259LL,0x19a1ef7480000LL),reale(45499LL,0xc587f2c1LL<<20),
-      real(-0x1f535f83dca80000LL),reale(-6269LL,0x8c8d0eb6LL<<20),
+      -real(0x1f535f83dca80000LL),reale(-6269LL,0x8c8d0eb6LL<<20),
       reale(-5890LL,0x10af2ca680000LL),reale(7129LL,0x77d5fe6bLL<<20),
       reale(-2061LL,0x3b31cee780000LL),real(0x4aa8326c4b38000LL),
       reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^12, polynomial in n of order 14
-      real(0x19b7c4e0f7LL<<20),real(-0x2af3a20d75d80000LL),
+      real(0x19b7c4e0f7LL<<20),-real(0x2af3a20d75d80000LL),
       reale(5489LL,0xbd385526LL<<20),reale(-23108LL,0xdabe65c980000LL),
       reale(59020LL,0x343e88d5LL<<20),reale(-93670LL,0x3beae65080000LL),
       reale(83160LL,0x242e42c4LL<<20),reale(-14192LL,0x406831f780000LL),
       reale(-55803LL,0xf73b11b3LL<<20),reale(63340LL,0xe56b447e80000LL),
       reale(-24300LL,0xdb812462LL<<20),reale(-2686LL,0xc38ce5a580000LL),
       reale(2706LL,0x4a412191LL<<20),real(0x69f4dee012c80000LL),
-      real(-0x3e4f75bd92cb0000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      -real(0x3e4f75bd92cb0000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^11, polynomial in n of order 15
       real(0xa6c2bf580000LL),real(0x73fcd1afLL<<20),real(0xe000999c080000LL),
-      real(-0x18cc7eefd8aLL<<20),reale(3397LL,0x57665c9b80000LL),
+      -real(0x18cc7eefd8aLL<<20),reale(3397LL,0x57665c9b80000LL),
       reale(-15562LL,0x2b59a6fdLL<<20),reale(44311LL,0x617f59e680000LL),
       reale(-82041LL,0x83d2aea4LL<<20),reale(95750LL,0x6b882f0180000LL),
       reale(-56327LL,0x49f5d8cbLL<<20),reale(-14076LL,0x3175e14c80000LL),
       reale(56094LL,0x8aaf24d2LL<<20),reale(-46281LL,0x1a6a8e2780000LL),
       reale(17576LL,0xfb594219LL<<20),reale(-2262LL,0x39d01af280000LL),
-      real(-0xc8e19a260718000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
+      -real(0xc8e19a260718000LL),reale(0x127a3caLL,0xdb8d32044f89fLL),
       // C4[8], coeff of eps^10, polynomial in n of order 16
       real(106398LL<<24),real(0x9377d6LL<<20),real(0x44feec4LL<<20),
-      real(0x326cada2LL<<20),real(0x67002b868LL<<20),real(-0xc295517d72LL<<20),
+      real(0x326cada2LL<<20),real(0x67002b868LL<<20),-real(0xc295517d72LL<<20),
       real(0x7045d79918cLL<<20),reale(-9007LL,0x977a7f5aLL<<20),
       reale(28706LL,0x584fd4fLL<<24),reale(-61777LL,0xaecc34c6LL<<20),
       reale(90600LL,0x34124d54LL<<20),reale(-86126LL,0xe1950b92LL<<20),
@@ -3250,7 +3250,7 @@ namespace GeographicLib {
       // C4[8], coeff of eps^9, polynomial in n of order 17
       real(0x5cef80000LL),real(99288LL<<20),real(0x75c8080000LL),
       real(0x2bad8dLL<<20),real(0x1576c2180000LL),real(0x1092b662LL<<20),
-      real(0x2405b55f280000LL),real(-0x490d2ef189LL<<20),
+      real(0x2405b55f280000LL),-real(0x490d2ef189LL<<20),
       real(0x2dc13d73c1380000LL),reale(-4044LL,0xdf9645ecLL<<20),
       reale(14485LL,0x7f6528a480000LL),reale(-36112LL,0xadb9dce1LL<<20),
       reale(64526LL,0x4ec29dc580000LL),reale(-82902LL,0x61fc1376LL<<20),
@@ -3261,8 +3261,8 @@ namespace GeographicLib {
       real(0x10740000LL),real(0x38fa0000LL),real(3498LL<<20),
       real(0x3b6460000LL),real(0x12dccc0000LL),real(0x759a120000LL),
       real(0x3d0fff80000LL),real(0x3224b15e0000LL),real(0x74cfa8d240000LL),
-      real(-0x100412726d60000LL),real(0xaf94f028d5LL<<20),
-      real(-0x433703efa18a0000LL),reale(4345LL,0xa637f297c0000LL),
+      -real(0x100412726d60000LL),real(0xaf94f028d5LL<<20),
+      -real(0x433703efa18a0000LL),reale(4345LL,0xa637f297c0000LL),
       reale(-12474LL,0x608555e420000LL),reale(26308LL,0x13a90aa80000LL),
       reale(-40980LL,0x3929b258e0000LL),reale(45533LL,0x15d1ab9d40000LL),
       reale(-30802LL,0x35013915a0000LL),reale(8983LL,0xdb34fa045c000LL),
@@ -3270,53 +3270,53 @@ namespace GeographicLib {
       // C4[9], coeff of eps^26, polynomial in n of order 0
       real(0x1cbe0000LL),real(0xf744df0e6c69LL),
       // C4[9], coeff of eps^25, polynomial in n of order 1
-      real(-48841LL<<20),real(-0x5237d0000LL),real(0x19892cc90d5217fLL),
+      -real(48841LL<<20),-real(0x5237d0000LL),real(0x19892cc90d5217fLL),
       // C4[9], coeff of eps^24, polynomial in n of order 2
-      real(0x5e11584LL<<24),real(-0x7ae8f52LL<<24),real(0x18b06bafLL<<20),
+      real(0x5e11584LL<<24),-real(0x7ae8f52LL<<24),real(0x18b06bafLL<<20),
       reale(45019LL,0xaf6c96bc5ad9dLL),
       // C4[9], coeff of eps^23, polynomial in n of order 3
-      real(0x2afbd497b3080000LL),real(-0x115bb8ed6d9LL<<20),
-      real(-0x171a49d86a80000LL),real(-0xb7278b5afc8000LL),
+      real(0x2afbd497b3080000LL),-real(0x115bb8ed6d9LL<<20),
+      -real(0x171a49d86a80000LL),-real(0xb7278b5afc8000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^22, polynomial in n of order 4
-      real(0x61ad926cf8LL<<20),real(-0x408c282a2LL<<20),
-      real(0x1bc97c585cLL<<20),real(-0x1dcf828996LL<<20),
+      real(0x61ad926cf8LL<<20),-real(0x408c282a2LL<<20),
+      real(0x1bc97c585cLL<<20),-real(0x1dcf828996LL<<20),
       real(0x517eabcb370000LL),reale(0x1e09ccLL,0xe17edcf27917LL),
       // C4[9], coeff of eps^21, polynomial in n of order 5
-      real(0x14eee8a775280000LL),real(-0x13e3b5a8a36LL<<20),
-      real(0x454e86f699180000LL),real(-0x12a27ad79ebLL<<20),
-      real(-0x2a8afba4bf80000LL),real(-0x1a278f54ba58000LL),
+      real(0x14eee8a775280000LL),-real(0x13e3b5a8a36LL<<20),
+      real(0x454e86f699180000LL),-real(0x12a27ad79ebLL<<20),
+      -real(0x2a8afba4bf80000LL),-real(0x1a278f54ba58000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^20, polynomial in n of order 6
-      real(-0x1e186c22038LL<<20),reale(-2450LL,0x46146d24LL<<20),
+      -real(0x1e186c22038LL<<20),reale(-2450LL,0x46146d24LL<<20),
       real(0x4d9b33e84bLL<<24),real(0x5381480dfcLL<<20),
-      real(0x24355d37098LL<<20),real(-0x1df4fe903ecLL<<20),
+      real(0x24355d37098LL<<20),-real(0x1df4fe903ecLL<<20),
       real(0x42edd4687ca0000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^19, polynomial in n of order 7
       reale(4708LL,0xb1e8552280000LL),reale(-3968LL,0xd2254fedLL<<20),
-      real(-0x2552f5e566080000LL),real(-0x46718ec5982LL<<20),
-      real(0x6fe7320794c80000LL),real(-0xee4b32a131LL<<20),
-      real(-0x3f5905d6b680000LL),real(-0x392f1a561e88000LL),
+      -real(0x2552f5e566080000LL),-real(0x46718ec5982LL<<20),
+      real(0x6fe7320794c80000LL),-real(0xee4b32a131LL<<20),
+      -real(0x3f5905d6b680000LL),-real(0x392f1a561e88000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^18, polynomial in n of order 8
       reale(10651LL,0x8768b13LL<<24),reale(2483LL,0x450654eeLL<<20),
       real(0x5c595ba5184LL<<20),reale(-5107LL,0x5014808aLL<<20),
       real(0x316556e0b98LL<<20),real(0xa4c5f0e846LL<<20),
-      real(0x4adc873ac2cLL<<20),real(-0x2d0002ebf1eLL<<20),
+      real(0x4adc873ac2cLL<<20),-real(0x2d0002ebf1eLL<<20),
       real(0x4cd03e8801b0000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^17, polynomial in n of order 9
       reale(-12599LL,0xef10737480000LL),reale(-5706LL,0x74b78194LL<<20),
-      reale(14434LL,0xee01835380000LL),real(-0x53c43a7b401LL<<20),
-      real(-0x61ad28bb29d80000LL),reale(-3832LL,0x8df1c64aLL<<20),
+      reale(14434LL,0xee01835380000LL),-real(0x53c43a7b401LL<<20),
+      -real(0x61ad28bb29d80000LL),reale(-3832LL,0x8df1c64aLL<<20),
       reale(2686LL,0x31eaa90180000LL),real(0x3be070e5d5LL<<20),
-      real(-0x33650f7a6f80000LL),real(-0x7fc3df35f858000LL),
+      -real(0x33650f7a6f80000LL),-real(0x7fc3df35f858000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^16, polynomial in n of order 10
       reale(73082LL,0x4e564b9LL<<24),reale(-36373LL,0x7f41b758LL<<20),
       reale(-8447LL,0xc935334LL<<24),reale(3801LL,0xf6d72828LL<<20),
       reale(13381LL,0x1077fefLL<<24),reale(-7346LL,0x22839078LL<<20),
-      real(-0x6256df74a6LL<<24),real(-0x25f5d15e8b8LL<<20),
-      reale(2675LL,0x8c635e5LL<<24),real(-0x44947d61c68LL<<20),
+      -real(0x6256df74a6LL<<24),-real(0x25f5d15e8b8LL<<20),
+      reale(2675LL,0x8c635e5LL<<24),-real(0x44947d61c68LL<<20),
       real(0x4cdddf4aa2c0000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^15, polynomial in n of order 11
       reale(-70229LL,0xa07f0ae380000LL),reale(-3666LL,0xc491e03dLL<<20),
@@ -3324,7 +3324,7 @@ namespace GeographicLib {
       reale(5918LL,0xe3bb81a980000LL),reale(10294LL,0xb5678d8bLL<<20),
       reale(5723LL,0x46912f8480000LL),reale(-10994LL,0x9023e3d2LL<<20),
       reale(2675LL,0xc09c102f80000LL),real(0x3a39e82b059LL<<20),
-      real(0xb502c3128a80000LL),real(-0x1358f80d9c038000LL),
+      real(0xb502c3128a80000LL),-real(0x1358f80d9c038000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^14, polynomial in n of order 12
       reale(-45940LL,0x24dbede8LL<<20),reale(81202LL,0xab78046eLL<<20),
@@ -3332,7 +3332,7 @@ namespace GeographicLib {
       reale(46736LL,0xfe25c5fLL<<24),reale(-68203LL,0x7452da6LL<<20),
       reale(29667LL,0x5b15eb94LL<<20),reale(5608LL,0x4d3a29b2LL<<20),
       reale(-4402LL,0x5668a1f8LL<<20),reale(-6764LL,0x13320a5eLL<<20),
-      reale(6284LL,0xed7a38dcLL<<20),real(-0x63dfacb5896LL<<20),
+      reale(6284LL,0xed7a38dcLL<<20),-real(0x63dfacb5896LL<<20),
       real(0x21519ecdd470000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^13, polynomial in n of order 13
       reale(-2322LL,0x2b20b06180000LL),reale(11407LL,0x435cd442LL<<20),
@@ -3341,20 +3341,20 @@ namespace GeographicLib {
       reale(10736LL,0xf4ed55a480000LL),reale(-61424LL,0x2a22c811LL<<20),
       reale(52845LL,0xa6156a8580000LL),reale(-15061LL,0x5525d816LL<<20),
       reale(-4429LL,0xec2fec5680000LL),real(0x7ac3d0f14dbLL<<20),
-      real(0x70761ded2b780000LL),real(-0x3854598234228000LL),
+      real(0x70761ded2b780000LL),-real(0x3854598234228000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^12, polynomial in n of order 14
-      real(-0x449768678LL<<20),real(0x88f54af434LL<<20),
-      real(-0x539fb48063LL<<24),reale(7105LL,0xb995afacLL<<20),
+      -real(0x449768678LL<<20),real(0x88f54af434LL<<20),
+      -real(0x539fb48063LL<<24),reale(7105LL,0xb995afacLL<<20),
       reale(-24000LL,0x547ebb18LL<<20),reale(54661LL,0x26ae4964LL<<20),
       reale(-84323LL,0xfcd087eLL<<24),reale(82245LL,0x3cac3bdcLL<<20),
       reale(-34605LL,0xaa152aa8LL<<20),reale(-26938LL,0xf8d90194LL<<20),
       reale(54122LL,0x9f886dfLL<<24),reale(-38796LL,0xa25c150cLL<<20),
-      reale(13349LL,0x83391c38LL<<20),real(-0x58411cd0f3cLL<<20),
-      real(-0xd052410afde0000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
+      reale(13349LL,0x83391c38LL<<20),-real(0x58411cd0f3cLL<<20),
+      -real(0xd052410afde0000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^11, polynomial in n of order 15
-      real(-0xfec42280000LL),real(-0xcdf9a71LL<<20),real(-0x1d4c8ca4780000LL),
-      real(0x3e336d9db6LL<<20),real(-0x28c1ec22f9c80000LL),
+      -real(0xfec42280000LL),-real(0xcdf9a71LL<<20),-real(0x1d4c8ca4780000LL),
+      real(0x3e336d9db6LL<<20),-real(0x28c1ec22f9c80000LL),
       reale(3762LL,0xdc36d29dLL<<20),reale(-14050LL,0x6323bbe80000LL),
       reale(36325LL,0x8201c224LL<<20),reale(-66630LL,0x3d526fa980000LL),
       reale(85703LL,0xfd7eda2bLL<<20),reale(-71811LL,0x4c937c0480000LL),
@@ -3362,81 +3362,81 @@ namespace GeographicLib {
       reale(-29449LL,0xc84d0b39LL<<20),reale(18689LL,0x65a6b58a80000LL),
       reale(-4755LL,0xcf6a7c02c8000LL),reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[9], coeff of eps^10, polynomial in n of order 16
-      real(-1786LL<<24),real(-185250LL<<20),real(-0x18668cLL<<20),
-      real(-0x14cc9c6LL<<20),real(-0x323a0eb8LL<<20),real(0x72034e536LL<<20),
-      real(-0x50a5b1f364LL<<20),real(0x1fc80a59612LL<<20),
+      -real(1786LL<<24),-real(185250LL<<20),-real(0x18668cLL<<20),
+      -real(0x14cc9c6LL<<20),-real(0x323a0eb8LL<<20),real(0x72034e536LL<<20),
+      -real(0x50a5b1f364LL<<20),real(0x1fc80a59612LL<<20),
       reale(-2109LL,0x8ef2603LL<<24),reale(6191LL,0x3c40258eLL<<20),
       reale(-13345LL,0xc8b3e0c4LL<<20),reale(21384LL,0xf627f06aLL<<20),
       reale(-25320LL,0x349d8318LL<<20),reale(21525LL,0xd9c7d366LL<<20),
       reale(-12381LL,0xc32fbbecLL<<20),reale(4285LL,0x77832b42LL<<20),
-      real(-0x29d9aac7ec250000LL),reale(0x6e23ecLL,0x33ad12a23bbffLL),
+      -real(0x29d9aac7ec250000LL),reale(0x6e23ecLL,0x33ad12a23bbffLL),
       // C4[9], coeff of eps^9, polynomial in n of order 17
-      real(-0x1e480000LL),real(-2280LL<<20),real(-0x312b80000LL),
-      real(-85595LL<<20),real(-0xbe2a280000LL),real(-0xabe12eLL<<20),
-      real(-0x1bb208a980000LL),real(0x43aa3de3fLL<<20),
-      real(-0x3404792da080000LL),real(0x168a78c6f8cLL<<20),
-      real(-0x68406e983e780000LL),reale(5560LL,0x170a6259LL<<20),
+      -real(0x1e480000LL),-real(2280LL<<20),-real(0x312b80000LL),
+      -real(85595LL<<20),-real(0xbe2a280000LL),-real(0xabe12eLL<<20),
+      -real(0x1bb208a980000LL),real(0x43aa3de3fLL<<20),
+      -real(0x3404792da080000LL),real(0x168a78c6f8cLL<<20),
+      -real(0x68406e983e780000LL),reale(5560LL,0x170a6259LL<<20),
       reale(-13901LL,0xc6660a2180000LL),reale(26517LL,0x5a318646LL<<20),
       reale(-38451LL,0xd6d1ca1a80000LL),reale(40711LL,0xef5e1af3LL<<20),
       reale(-26785LL,0xd50c31a380000LL),reale(7700LL,0x72bfb1ba98000LL),
       reale(0x14a6bc4LL,0x9b0737e6b33fdLL),
       // C4[10], coeff of eps^26, polynomial in n of order 0
-      real(-0x4f040000LL),real(0x10edb70f760db7LL),
+      -real(0x4f040000LL),real(0x10edb70f760db7LL),
       // C4[10], coeff of eps^25, polynomial in n of order 1
-      real(-9802LL<<24),real(28314LL<<20),real(0x4082f7e0f93b2fLL),
+      -real(9802LL<<24),real(28314LL<<20),real(0x4082f7e0f93b2fLL),
       // C4[10], coeff of eps^24, polynomial in n of order 2
-      real(-0x1092926LL<<24),real(-0x1f7f63LL<<24),real(-0x11a4d3aLL<<20),
+      -real(0x1092926LL<<24),-real(0x1f7f63LL<<24),-real(0x11a4d3aLL<<20),
       reale(7108LL,0x5f112546294adLL),
       // C4[10], coeff of eps^23, polynomial in n of order 3
-      real(0x2b4d78f6LL<<24),real(0x2e8b64984LL<<24),real(-0x2b39cf62eLL<<24),
+      real(0x2b4d78f6LL<<24),real(0x2e8b64984LL<<24),-real(0x2b39cf62eLL<<24),
       real(0x699f0055eLL<<20),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[10], coeff of eps^22, polynomial in n of order 4
-      real(-0x1c8e0b16cfcLL<<20),real(0x422ec2346b3LL<<20),
-      real(-0xcfd2a114feLL<<20),real(-0x28865c39efLL<<20),
-      real(-0x1da3031e4b60000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
+      -real(0x1c8e0b16cfcLL<<20),real(0x422ec2346b3LL<<20),
+      -real(0xcfd2a114feLL<<20),-real(0x28865c39efLL<<20),
+      -real(0x1da3031e4b60000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^21, polynomial in n of order 5
       reale(-2586LL,0xd6a2e6ecLL<<20),real(0x34bcb74007LL<<24),
       real(0x6e07e246f4LL<<20),real(0x25e0133cb38LL<<20),
-      real(-0x1b065081a04LL<<20),real(0x357f8d3e3c40000LL),
+      -real(0x1b065081a04LL<<20),real(0x357f8d3e3c40000LL),
       reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^20, polynomial in n of order 6
-      reale(-2657LL,0xdeecdcecLL<<20),real(-0x3538c298b86LL<<20),
-      real(-0x5912f177eb8LL<<20),real(0x640b15f2316LL<<20),
-      real(-0x6d9a831e5cLL<<20),real(-0x31ad449d4eLL<<20),
-      real(-0x3c512000d040000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
+      reale(-2657LL,0xdeecdcecLL<<20),-real(0x3538c298b86LL<<20),
+      -real(0x5912f177eb8LL<<20),real(0x640b15f2316LL<<20),
+      -real(0x6d9a831e5cLL<<20),-real(0x31ad449d4eLL<<20),
+      -real(0x3c512000d040000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^19, polynomial in n of order 7
       reale(3432LL,0x4e74f9d4LL<<20),reale(2930LL,0x87085408LL<<20),
       reale(-4578LL,0x70547bcLL<<20),real(0x81973624bLL<<24),
       real(0x32ee2212a4LL<<20),real(0x4b5e677d958LL<<20),
-      real(-0x275d5b5d774LL<<20),real(0x3a718439ef40000LL),
+      -real(0x275d5b5d774LL<<20),real(0x3a718439ef40000LL),
       reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^18, polynomial in n of order 8
       reale(-11085LL,0x8fea54b8LL<<20),reale(11858LL,0x4428ce71LL<<20),
-      real(0x4a8bfaee90aLL<<20),real(-0x307c82cee9dLL<<20),
+      real(0x4a8bfaee90aLL<<20),-real(0x307c82cee9dLL<<20),
       reale(-4104LL,0xd1c95e5cLL<<20),reale(2140LL,0x80faa1d5LL<<20),
-      real(0xcfb44449aeLL<<20),real(-0xca4a87f39LL<<20),
-      real(-0x7f8004b3e7a0000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
+      real(0xcfb44449aeLL<<20),-real(0xca4a87f39LL<<20),
+      -real(0x7f8004b3e7a0000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^17, polynomial in n of order 9
       reale(-16526LL,0x6c5d10b8LL<<20),reale(-12874LL,0x88ee71cLL<<24),
-      real(-0x5e7810d2938LL<<20),reale(13789LL,0x243b975LL<<24),
-      reale(-4638LL,0x964d9ad8LL<<20),real(-0x7fb9ba5572LL<<24),
-      real(-0x4173ffec718LL<<20),reale(2541LL,0x1cb9027LL<<24),
-      real(-0x39666317308LL<<20),real(0x349e63a5ac80000LL),
+      -real(0x5e7810d2938LL<<20),reale(13789LL,0x243b975LL<<24),
+      reale(-4638LL,0x964d9ad8LL<<20),-real(0x7fb9ba5572LL<<24),
+      -real(0x4173ffec718LL<<20),reale(2541LL,0x1cb9027LL<<24),
+      -real(0x39666317308LL<<20),real(0x349e63a5ac80000LL),
       reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^16, polynomial in n of order 10
       reale(-4542LL,0x7bb81428LL<<20),reale(9880LL,0x570203e4LL<<20),
-      reale(-5570LL,0x1d13282LL<<24),real(-0x2717ac11fa4LL<<20),
+      reale(-5570LL,0x1d13282LL<<24),-real(0x2717ac11fa4LL<<20),
       real(0x48f10632c18LL<<20),real(0x49be65276d4LL<<20),
-      real(-0x56ac461dbfLL<<24),real(0xd204c29b4cLL<<20),
+      -real(0x56ac461dbfLL<<24),real(0xd204c29b4cLL<<20),
       real(0x8778499408LL<<20),real(0x254e1d61c4LL<<20),
-      real(-0x2a036589e880000LL),reale(0x342bf6LL,0x9f3708d39590dLL),
+      -real(0x2a036589e880000LL),reale(0x342bf6LL,0x9f3708d39590dLL),
       // C4[10], coeff of eps^15, polynomial in n of order 11
       reale(82722LL,0xe9e9d128LL<<20),reale(-64702LL,0xc3657b3LL<<24),
       real(0xd88117da38LL<<20),reale(58506LL,0xbc1f3dcLL<<24),
       reale(-58414LL,0x316e6548LL<<20),reale(16792LL,0x62b2905LL<<24),
       reale(8555LL,0x57b78e58LL<<20),reale(-2318LL,0x5fa80eeLL<<24),
       reale(-7195LL,0xfa5c7168LL<<20),reale(5493LL,0x7232557LL<<24),
-      real(-0x4dba35cd588LL<<20),real(0x6c0ce28f480000LL),
+      -real(0x4dba35cd588LL<<20),real(0x6c0ce28f480000LL),
       reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^14, polynomial in n of order 12
       reale(18981LL,0x5e862c64LL<<20),reale(-46079LL,0x5efb0881LL<<20),
@@ -3445,7 +3445,7 @@ namespace GeographicLib {
       reale(-61327LL,0xb287efb2LL<<20),reale(42595LL,0xdff09bafLL<<20),
       reale(-8327LL,0x1c2b6eccLL<<20),reale(-5140LL,0x12845269LL<<20),
       real(0x508a8bb3be6LL<<20),real(0x72b007891a3LL<<20),
-      real(-0x33009c87a9620000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
+      -real(0x33009c87a9620000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^13, polynomial in n of order 13
       real(0x1f9ffe8656cLL<<20),reale(-3063LL,0x94b5dedLL<<24),
       reale(11988LL,0xe264f34LL<<20),reale(-32440LL,0xf0983358LL<<20),
@@ -3453,11 +3453,11 @@ namespace GeographicLib {
       reale(67313LL,0xfb9bddc4LL<<20),reale(-16749LL,0xcbdb6868LL<<20),
       reale(-34833LL,0xd656e8cLL<<20),reale(50577LL,0xf8434fLL<<24),
       reale(-32451LL,0xf163f854LL<<20),reale(10213LL,0xef301578LL<<20),
-      real(-0x352a1ac4ee4LL<<20),real(-0xcb30b375e9c0000LL),
+      -real(0x352a1ac4ee4LL<<20),-real(0xcb30b375e9c0000LL),
       reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^12, polynomial in n of order 14
-      real(0x83f3fa8cLL<<20),real(-0x1374d9c49eLL<<20),
-      real(0xe49b68b678LL<<20),real(-0x5d5e50a4b72LL<<20),
+      real(0x83f3fa8cLL<<20),-real(0x1374d9c49eLL<<20),
+      real(0xe49b68b678LL<<20),-real(0x5d5e50a4b72LL<<20),
       reale(6402LL,0x71afd664LL<<20),reale(-19348LL,0xea14f2baLL<<20),
       reale(42585LL,0xebe6545LL<<24),reale(-68667LL,0x703137e6LL<<20),
       reale(79038LL,0xd1606a3cLL<<20),reale(-58931LL,0x700ae612LL<<20),
@@ -3466,17 +3466,17 @@ namespace GeographicLib {
       reale(-4107LL,0x18224be0c0000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^11, polynomial in n of order 15
       real(0xfd374LL<<20),real(0xec45e8LL<<20),real(0x273df7dcLL<<20),
-      real(-0x62a0474fLL<<24),real(0x4dcbe47944LL<<20),
-      real(-0x227b761e3c8LL<<20),reale(2600LL,0x153d35acLL<<20),
+      -real(0x62a0474fLL<<24),real(0x4dcbe47944LL<<20),
+      -real(0x227b761e3c8LL<<20),reale(2600LL,0x153d35acLL<<20),
       reale(-8793LL,0x286c976LL<<24),reale(22203LL,0x5eab8b14LL<<20),
       reale(-42669LL,0xccca9a88LL<<20),reale(62615LL,0x2adb577cLL<<20),
       reale(-69318LL,0x88b7c3bLL<<24),reale(56036LL,0xcf17f8e4LL<<20),
       reale(-31066LL,0x7860b0d8LL<<20),reale(10475LL,0x95eb4d4cLL<<20),
-      real(-0x6470cd13038c0000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
+      -real(0x6470cd13038c0000LL),reale(0x16d33beLL,0x5a813dc916f5bLL),
       // C4[10], coeff of eps^10, polynomial in n of order 16
       real(133LL<<24),real(15675LL<<20),real(155078LL<<20),
-      real(0x255a91LL<<20),real(0x6998a3cLL<<20),real(-0x11c570399LL<<20),
-      real(0xf255cbcb2LL<<20),real(-0x753ac8aa43LL<<20),
+      real(0x255a91LL<<20),real(0x6998a3cLL<<20),-real(0x11c570399LL<<20),
+      real(0xf255cbcb2LL<<20),-real(0x753ac8aa43LL<<20),
       real(0x262569ee428LL<<20),reale(-2315LL,0xcce58993LL<<20),
       reale(6672LL,0x1ba60f9eLL<<20),reale(-14970LL,0x86e40ae9LL<<20),
       reale(26346LL,0x45cace14LL<<20),reale(-36033LL,0x9904fcbfLL<<20),
@@ -3485,61 +3485,61 @@ namespace GeographicLib {
       // C4[11], coeff of eps^26, polynomial in n of order 0
       real(4888LL<<20),real(0xe6baee73ea363LL),
       // C4[11], coeff of eps^25, polynomial in n of order 1
-      real(-306388LL<<24),real(-0x30085eLL<<20),real(0x477bca00497fe9bfLL),
+      -real(306388LL<<24),-real(0x30085eLL<<20),real(0x477bca00497fe9bfLL),
       // C4[11], coeff of eps^24, polynomial in n of order 2
-      real(0xb66a2aLL<<28),real(-0x94166dLL<<28),real(0x1456e5bcLL<<20),
+      real(0xb66a2aLL<<28),-real(0x94166dLL<<28),real(0x1456e5bcLL<<20),
       reale(54497LL,0x83837319e73d9LL),
       // C4[11], coeff of eps^23, polynomial in n of order 3
-      real(0x3dc8d3e3fcLL<<24),real(-0x852738cf8LL<<24),
-      real(-0x23d2c912cLL<<24),real(-0x200440db02LL<<20),
+      real(0x3dc8d3e3fcLL<<24),-real(0x852738cf8LL<<24),
+      -real(0x23d2c912cLL<<24),-real(0x200440db02LL<<20),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^22, polynomial in n of order 4
       real(0x1eafb2d2LL<<32),real(0x6001f8fcLL<<28),real(0x26e8d367LL<<32),
-      real(-0x1850eab0cLL<<28),real(0x2ad9fbf9a8LL<<20),
+      -real(0x1850eab0cLL<<28),real(0x2ad9fbf9a8LL<<20),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^21, polynomial in n of order 5
-      real(-0x34c400805d8LL<<20),real(-0x67cc1b5366LL<<24),
-      real(0x57398ecb018LL<<20),real(-0xc95bb863LL<<24),
-      real(-0x22721e20f8LL<<20),real(-0x3de76ba4f240000LL),
+      -real(0x34c400805d8LL<<20),-real(0x67cc1b5366LL<<24),
+      real(0x57398ecb018LL<<20),-real(0xc95bb863LL<<24),
+      -real(0x22721e20f8LL<<20),-real(0x3de76ba4f240000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^20, polynomial in n of order 6
       reale(4082LL,0x67f98f4LL<<24),reale(-3844LL,0x2c9ab0aLL<<24),
-      real(-0x159f6b3e48LL<<24),real(-0x5e777d4baLL<<24),
-      real(0x4a85b6d5fcLL<<24),real(-0x22657e61deLL<<24),
+      -real(0x159f6b3e48LL<<24),-real(0x5e777d4baLL<<24),
+      real(0x4a85b6d5fcLL<<24),-real(0x22657e61deLL<<24),
       real(0x2c64fe303880000LL),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^19, polynomial in n of order 7
       reale(8515LL,0x37f5b918LL<<20),reale(2727LL,0x3380253LL<<24),
       real(0xb19d71edc8LL<<20),reale(-4155LL,0x995a0c2LL<<24),
       real(0x66bdc071d78LL<<20),real(0x12a53914f1LL<<24),
-      real(0x167e4eca28LL<<20),real(-0x7d57ec14bd40000LL),
+      real(0x167e4eca28LL<<20),-real(0x7d57ec14bd40000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^18, polynomial in n of order 8
       reale(-12506LL,97541LL<<32),reale(-6195LL,0x2e1145LL<<28),
       reale(12920LL,0x2b7254LL<<28),reale(-2329LL,577767LL<<28),
-      reale(-2122LL,0x282168LL<<28),real(-0x58b5939bfLL<<28),
-      reale(2380LL,0xeae3dcLL<<28),real(-0x30188e75dLL<<28),
+      reale(-2122LL,0x282168LL<<28),-real(0x58b5939bfLL<<28),
+      reale(2380LL,0xeae3dcLL<<28),-real(0x30188e75dLL<<28),
       real(0x230ec3334eLL<<20),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^17, polynomial in n of order 9
       reale(63004LL,0x820dc15LL<<24),reale(-23254LL,0x2b51348LL<<24),
       reale(-10034LL,0x6d8993bLL<<24),reale(4968LL,0xd50d56LL<<24),
       reale(9826LL,0xfc2da81LL<<24),reale(-8261LL,0x55baaa4LL<<24),
       real(0x233dd63227LL<<24),real(0x37fd376f72LL<<24),
-      real(0x141eaf7a6dLL<<24),real(-0x115cb8e6aa880000LL),
+      real(0x141eaf7a6dLL<<24),-real(0x115cb8e6aa880000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^16, polynomial in n of order 10
       reale(-42752LL,0xfd09668LL<<24),reale(-21693LL,0x75aae5cLL<<24),
       reale(62310LL,0xfec662LL<<28),reale(-46930LL,0xc9a1864LL<<24),
       reale(7047LL,0xf651fd8LL<<24),reale(9444LL,0xbbaab2cLL<<24),
-      real(-0x1703b736fLL<<28),reale(-7301LL,0x7c7a434LL<<24),
-      reale(4777LL,0xce4e748LL<<24),real(-0x3caad8bf04LL<<24),
-      real(-0xa540e2085LL<<20),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
+      -real(0x1703b736fLL<<28),reale(-7301LL,0x7c7a434LL<<24),
+      reale(4777LL,0xce4e748LL<<24),-real(0x3caad8bf04LL<<24),
+      -real(0xa540e2085LL<<20),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^15, polynomial in n of order 11
       reale(-54976LL,0xf8ad2dfLL<<24),reale(76586LL,0x4c1b29aLL<<24),
       reale(-65944LL,0xd8907c5LL<<24),reale(16034LL,0xc1436c8LL<<24),
       reale(40019LL,0x76688bLL<<24),reale(-57817LL,0x54999f6LL<<24),
       reale(33374LL,0xea6cb71LL<<24),reale(-3539LL,0xfaa2c64LL<<24),
       reale(-5248LL,0x50c1eb7LL<<24),real(0x2c6b73ee52LL<<24),
-      real(0x722433189dLL<<24),real(-0x2e4dc1cba3080000LL),
+      real(0x722433189dLL<<24),-real(0x2e4dc1cba3080000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^14, polynomial in n of order 12
       reale(-5608LL,0x991738LL<<28),reale(17587LL,0xf22611LL<<28),
@@ -3547,10 +3547,10 @@ namespace GeographicLib {
       reale(-76303LL,954917LL<<32),reale(52531LL,0x8deb4dLL<<28),
       reale(-2629LL,0x8e7914LL<<28),reale(-39201LL,0x38bf3fLL<<28),
       reale(46365LL,0x54b068LL<<28),reale(-27150LL,0x55ed29LL<<28),
-      reale(7864LL,0x5e881cLL<<28),real(-0x1da92f225LL<<28),
-      real(-0xc0441aac22LL<<20),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
+      reale(7864LL,0x5e881cLL<<28),-real(0x1da92f225LL<<28),
+      -real(0xc0441aac22LL<<20),reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^13, polynomial in n of order 13
-      real(-0x4dd7751f98LL<<20),real(0x238aa1d5ceLL<<24),
+      -real(0x4dd7751f98LL<<20),real(0x238aa1d5ceLL<<24),
       reale(-2754LL,0xce58be58LL<<20),reale(9526LL,0xd688791LL<<24),
       reale(-24464LL,0xdf73ed48LL<<20),reale(47309LL,0x7148c34LL<<24),
       reale(-68505LL,0xbf6a8738LL<<20),reale(71563LL,0xf1b5657LL<<24),
@@ -3559,79 +3559,79 @@ namespace GeographicLib {
       reale(14565LL,0x9bc59b08LL<<20),reale(-3590LL,0x4e483233c0000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^12, polynomial in n of order 14
-      real(-0xa2feacLL<<24),real(0x1c179372LL<<24),real(-0x1874d0578LL<<24),
-      real(0xc0be8a7beLL<<24),real(-0x3f9d6493c4LL<<24),
+      -real(0xa2feacLL<<24),real(0x1c179372LL<<24),-real(0x1874d0578LL<<24),
+      real(0xc0be8a7beLL<<24),-real(0x3f9d6493c4LL<<24),
       reale(3896LL,0x4997f2aLL<<24),reale(-11281LL,0x64c37bLL<<28),
       reale(25274LL,0x3bbdef6LL<<24),reale(-44241LL,0xb75fe24LL<<24),
       reale(60354LL,0xf508c62LL<<24),reale(-63153LL,0xc2460d8LL<<24),
       reale(48923LL,0x7ed4caeLL<<24),reale(-26289LL,0xfd6410cLL<<24),
-      reale(8669LL,0x733e51aLL<<24),real(-0x51d72bd69a980000LL),
+      reale(8669LL,0x733e51aLL<<24),-real(0x51d72bd69a980000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[11], coeff of eps^11, polynomial in n of order 15
-      real(-31464LL<<20),real(-33649LL<<24),real(-0x1944cb8LL<<20),
-      real(0x4a592f6LL<<24),real(-0x459291388LL<<20),real(0x25287649dLL<<24),
-      real(-0xd6fc633d58LL<<20),real(0x39106c83a4LL<<24),
+      -real(31464LL<<20),-real(33649LL<<24),-real(0x1944cb8LL<<20),
+      real(0x4a592f6LL<<24),-real(0x459291388LL<<20),real(0x25287649dLL<<24),
+      -real(0xd6fc633d58LL<<20),real(0x39106c83a4LL<<24),
       reale(-2978LL,0x49e187d8LL<<20),reale(7656LL,0xf8e0a2bLL<<24),
       reale(-15740LL,0xab15ce08LL<<20),reale(25923LL,0x9aeb252LL<<24),
       reale(-33769LL,0x17e1e738LL<<20),reale(33232LL,0xe46ee39LL<<24),
       reale(-20952LL,0xd4296568LL<<20),reale(5892LL,0x84545b7ac0000LL),
       reale(0x18ffbb8LL,0x19fb43ab7aab9LL),
       // C4[12], coeff of eps^26, polynomial in n of order 0
-      real(-2LL<<32),real(0x2f0618f20f09a7LL),
+      -real(2LL<<32),real(0x2f0618f20f09a7LL),
       // C4[12], coeff of eps^25, polynomial in n of order 1
-      real(-62273LL<<28),real(123651LL<<24),real(0x19e65bbd524850fbLL),
+      -real(62273LL<<28),real(123651LL<<24),real(0x19e65bbd524850fbLL),
       // C4[12], coeff of eps^24, polynomial in n of order 2
-      real(-0x59584b5LL<<28),real(-0x24710be8LL<<24),real(-0x294ee807LL<<24),
+      -real(0x59584b5LL<<28),-real(0x24710be8LL<<24),-real(0x294ee807LL<<24),
       reale(0x217183LL,0xd5a68f81111b3LL),
       // C4[12], coeff of eps^23, polynomial in n of order 3
-      real(0x12984317LL<<28),real(0xd1e58b72LL<<28),real(-0x747d5143LL<<28),
+      real(0x12984317LL<<28),real(0xd1e58b72LL<<28),-real(0x747d5143LL<<28),
       real(0xb73914e9LL<<24),reale(0x90ebe5LL,0xf32718849f75dLL),
       // C4[12], coeff of eps^22, polynomial in n of order 4
-      real(-0x71f21ba04LL<<28),real(0x4a52d91cdLL<<28),real(0x3a8875feLL<<28),
-      real(-0x13186811LL<<28),real(-0x3e64cd5eLL<<28),
+      -real(0x71f21ba04LL<<28),real(0x4a52d91cdLL<<28),real(0x3a8875feLL<<28),
+      -real(0x13186811LL<<28),-real(0x3e64cd5eLL<<28),
       reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^21, polynomial in n of order 5
-      reale(-3027LL,0xe45b0dLL<<28),real(-0x292135aecLL<<28),
-      real(-0xf7b99e85LL<<28),real(0x48a6e1d2aLL<<28),real(-0x1e0b679f7LL<<28),
+      reale(-3027LL,0xe45b0dLL<<28),-real(0x292135aecLL<<28),
+      -real(0xf7b99e85LL<<28),real(0x48a6e1d2aLL<<28),-real(0x1e0b679f7LL<<28),
       real(0x2190668fdLL<<24),reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^20, polynomial in n of order 6
       reale(3415LL,0xc912716LL<<24),real(0x45e58b8965LL<<24),
       reale(-4037LL,0x3f84be4LL<<24),real(0x4b8d3c4323LL<<24),
       real(0x15bac0b1b2LL<<24),real(0x3522c8ca1LL<<24),
-      real(-0x7a03567462LL<<20),reale(0x1b2c3b1LL,0xd975498dde617LL),
+      -real(0x7a03567462LL<<20),reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^19, polynomial in n of order 7
       reale(-9658LL,0xa4c7364LL<<24),reale(11274LL,0x6c5b0c8LL<<24),
-      real(-0x1f6e85a614LL<<24),real(-0x79d1375fdLL<<28),
-      real(-0x6b072a870cLL<<24),reale(2209LL,0x198a998LL<<24),
-      real(-0x285bc12c84LL<<24),real(0x163cbe2fecLL<<20),
+      -real(0x1f6e85a614LL<<24),-real(0x79d1375fdLL<<28),
+      -real(0x6b072a870cLL<<24),reale(2209LL,0x198a998LL<<24),
+      -real(0x285bc12c84LL<<24),real(0x163cbe2fecLL<<20),
       reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^18, polynomial in n of order 8
       reale(-10358LL,0x7c48caLL<<28),reale(-12253LL,0x39b98ccLL<<24),
       real(0x62ed8afd78LL<<24),reale(10573LL,0x9351d24LL<<24),
-      reale(-6815LL,0x900e65LL<<28),real(-0x61450ee84LL<<24),
+      reale(-6815LL,0x900e65LL<<28),-real(0x61450ee84LL<<24),
       real(0x3263d35f28LL<<24),real(0x16e96dd5d4LL<<24),
-      real(-0x10590be4b4LL<<24),reale(0x1b2c3b1LL,0xd975498dde617LL),
+      -real(0x10590be4b4LL<<24),reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^17, polynomial in n of order 9
       reale(-37198LL,0xc2bcf24LL<<24),reale(60620LL,0xbda83aLL<<28),
       reale(-35565LL,0x113931cLL<<24),real(0x64fe25038LL<<24),
       reale(9080LL,0x9fe8194LL<<24),real(0x5138a8f5dLL<<28),
       reale(-7185LL,0x3ef178cLL<<24),reale(4144LL,0x2d30168LL<<24),
-      real(-0x2f70b26dfcLL<<24),real(-0x15370842ccLL<<20),
+      -real(0x2f70b26dfcLL<<24),-real(0x15370842ccLL<<20),
       reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^16, polynomial in n of order 10
       reale(72847LL,0x271a51cLL<<24),reale(-50731LL,0x7c7ae56LL<<24),
-      real(-0x44b35c4c5LL<<28),reale(46646LL,0x70a160aLL<<24),
+      -real(0x44b35c4c5LL<<28),reale(46646LL,0x70a160aLL<<24),
       reale(-52486LL,0x5f31e44LL<<24),reale(25457LL,0x9e6c03eLL<<24),
-      real(-0xd3d3e2228LL<<24),reale(-5016LL,0xcfe89f2LL<<24),
+      -real(0xd3d3e2228LL<<24),reale(-5016LL,0xcfe89f2LL<<24),
       real(0xe92a0cb6cLL<<24),real(0x6fd8056026LL<<24),
-      real(-0x2a2c8f04c9cLL<<20),reale(0x1b2c3b1LL,0xd975498dde617LL),
+      -real(0x2a2c8f04c9cLL<<20),reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^15, polynomial in n of order 11
       reale(23399LL,0xe6f798cLL<<24),reale(-46216LL,0x5234048LL<<24),
       reale(67437LL,0x33caec4LL<<24),reale(-68613LL,0x20de4aLL<<28),
       reale(38802LL,0xf902d7cLL<<24),reale(8195LL,341240LL<<24),
       reale(-41127LL,0x66c3ab4LL<<24),reale(42002LL,0x30cc65LL<<28),
       reale(-22752LL,0x6405b6cLL<<24),reale(6086LL,0x174ada8LL<<24),
-      real(-0xdc5682b5cLL<<24),real(-0xb3064a33acLL<<20),
+      -real(0xdc5682b5cLL<<24),-real(0xb3064a33acLL<<20),
       reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^14, polynomial in n of order 12
       real(0x4688633f7LL<<28),reale(-4402LL,0x8011c3cLL<<24),
@@ -3642,17 +3642,17 @@ namespace GeographicLib {
       reale(-23356LL,0x2de0be8LL<<24),reale(12999LL,0xf01fe34LL<<24),
       reale(-3170LL,0x860a3fcLL<<24),reale(0x1b2c3b1LL,0xd975498dde617LL),
       // C4[12], coeff of eps^13, polynomial in n of order 13
-      real(0x283beee4LL<<24),real(-0x15cef585LL<<28),real(0x7f93d56fcLL<<24),
-      real(-0x22159bbf18LL<<24),real(0x6f496a9d94LL<<24),
+      real(0x283beee4LL<<24),-real(0x15cef585LL<<28),real(0x7f93d56fcLL<<24),
+      -real(0x22159bbf18LL<<24),real(0x6f496a9d94LL<<24),
       reale(-4556LL,0x84dbd2LL<<28),reale(9255LL,0xbbd2bacLL<<24),
       reale(-14990LL,0xbdd5558LL<<24),reale(19228LL,0x8e2a44LL<<24),
       reale(-19176LL,0xa51429LL<<28),reale(14321LL,0xf73025cLL<<24),
       reale(-7492LL,0x82a3dc8LL<<24),reale(2423LL,0xb79dcf4LL<<24),
-      real(-0x1693a2298bcLL<<20),reale(0x90ebe5LL,0xf32718849f75dLL),
+      -real(0x1693a2298bcLL<<20),reale(0x90ebe5LL,0xf32718849f75dLL),
       // C4[12], coeff of eps^12, polynomial in n of order 14
-      real(397670LL<<24),real(-0x135e647LL<<24),real(0x13bdbefcLL<<24),
-      real(-0xb8948681LL<<24),real(0x49699e392LL<<24),
-      real(-0x1590a013fbLL<<24),real(0x4e6b0048a8LL<<24),
+      real(397670LL<<24),-real(0x135e647LL<<24),real(0x13bdbefcLL<<24),
+      -real(0xb8948681LL<<24),real(0x49699e392LL<<24),
+      -real(0x1590a013fbLL<<24),real(0x4e6b0048a8LL<<24),
       reale(-3632LL,0xa5068cbLL<<24),reale(8507LL,0xbf327beLL<<24),
       reale(-16265LL,0x3097f51LL<<24),reale(25338LL,0xdcb7a54LL<<24),
       reale(-31674LL,0x6c1a717LL<<24),reale(30296LL,0x77349eaLL<<24),
@@ -3661,118 +3661,118 @@ namespace GeographicLib {
       // C4[13], coeff of eps^26, polynomial in n of order 0
       real(166LL<<24),real(0xb952c68e4fbe9LL),
       // C4[13], coeff of eps^25, polynomial in n of order 1
-      real(-71903LL<<28),real(-0x1ab3b9LL<<24),reale(5818LL,0x23b391cd899edLL),
+      -real(71903LL<<28),-real(0x1ab3b9LL<<24),reale(5818LL,0x23b391cd899edLL),
       // C4[13], coeff of eps^24, polynomial in n of order 2
-      real(0x101ed8dLL<<32),real(-0x80a64a8LL<<28),real(0xb4b7414LL<<24),
+      real(0x101ed8dLL<<32),-real(0x80a64a8LL<<28),real(0xb4b7414LL<<24),
       reale(789029LL,0x386f296be7703LL),
       // C4[13], coeff of eps^23, polynomial in n of order 3
-      real(0x3dee529e7LL<<28),real(0x6cec7402LL<<28),real(-0x473d793LL<<28),
-      real(-0x3e1be54e5LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
+      real(0x3dee529e7LL<<28),real(0x6cec7402LL<<28),-real(0x473d793LL<<28),
+      -real(0x3e1be54e5LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^22, polynomial in n of order 4
-      real(-0x343e549fLL<<32),real(-0x18a69b51cLL<<28),real(0x460d48248LL<<28),
-      real(-0x1a3f4f9f4LL<<28),real(0x19281ba96LL<<24),
+      -real(0x343e549fLL<<32),-real(0x18a69b51cLL<<28),real(0x460d48248LL<<28),
+      -real(0x1a3f4f9f4LL<<28),real(0x19281ba96LL<<24),
       reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^21, polynomial in n of order 5
       real(0x79a6c5ac7LL<<28),reale(-3802LL,0xfd945cLL<<28),
       real(0x346436151LL<<28),real(0x16fdc2aceLL<<28),real(0x4f28edfbLL<<28),
-      real(-0x75fcc3c53LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
+      -real(0x75fcc3c53LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^20, polynomial in n of order 6
       reale(9254LL,696682LL<<32),real(0x352756c5LL<<32),
-      real(-0x65e53404LL<<32),real(-0x788cc21dLL<<32),real(0x7f33e94eLL<<32),
-      real(-0x21eb1cefLL<<32),real(0xcd29b9b8LL<<24),
+      -real(0x65e53404LL<<32),-real(0x788cc21dLL<<32),real(0x7f33e94eLL<<32),
+      -real(0x21eb1cefLL<<32),real(0xcd29b9b8LL<<24),
       reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^19, polynomial in n of order 7
-      reale(-12156LL,0xce6fa6cLL<<24),real(-0x5e07316be8LL<<24),
+      reale(-12156LL,0xce6fa6cLL<<24),-real(0x5e07316be8LL<<24),
       reale(10690LL,0x8038384LL<<24),reale(-5461LL,0x41c7d1LL<<28),
-      real(-0x2348597ae4LL<<24),real(0x2bb84de008LL<<24),
-      real(0x18e3fd0234LL<<24),real(-0xf5e5d02854LL<<20),
+      -real(0x2348597ae4LL<<24),real(0x2bb84de008LL<<24),
+      real(0x18e3fd0234LL<<24),-real(0xf5e5d02854LL<<20),
       reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^18, polynomial in n of order 8
       reale(55507LL,0xcfc518LL<<28),reale(-25285LL,0x16861fLL<<28),
       reale(-4553LL,0x2efce2LL<<28),reale(8014LL,0xba4bfdLL<<28),
       reale(2646LL,0x44360cLL<<28),reale(-6925LL,0x6f25abLL<<28),
-      reale(3590LL,0x29c576LL<<28),real(-0x251e627f7LL<<28),
-      real(-0x1c00154478LL<<20),reale(0x1d58babLL,0x98ef4f7042175LL),
+      reale(3590LL,0x29c576LL<<28),-real(0x251e627f7LL<<28),
+      -real(0x1c00154478LL<<20),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^17, polynomial in n of order 9
       reale(-35541LL,0x7282c8cLL<<24),reale(-14633LL,0xccc30eLL<<28),
       reale(49583LL,0x128b834LL<<24),reale(-46374LL,0xdd8a28LL<<24),
       reale(18858LL,0x355fe5cLL<<24),real(0x7f3bc48c7LL<<28),
-      reale(-4604LL,0xc55c04LL<<24),real(-0x98d22ab48LL<<24),
-      real(0x6c7ad32e2cLL<<24),real(-0x268b90f95ccLL<<20),
+      reale(-4604LL,0xc55c04LL<<24),-real(0x98d22ab48LL<<24),
+      real(0x6c7ad32e2cLL<<24),-real(0x268b90f95ccLL<<20),
       reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^16, polynomial in n of order 10
       reale(-50762LL,0x475c7cLL<<28),reale(66355LL,0x870afaLL<<28),
       reale(-59859LL,723819LL<<32),reale(26575LL,0x21ae26LL<<28),
       reale(16255LL,0x1d3fe4LL<<28),reale(-41403LL,0x212a72LL<<28),
       reale(37768LL,0x572c58LL<<28),reale(-19111LL,0x7dd41eLL<<28),
-      reale(4727LL,0x6ab04cLL<<28),real(-0x2fa40096LL<<28),
-      real(-0xa540e2085LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
+      reale(4727LL,0x6ab04cLL<<28),-real(0x2fa40096LL<<28),
+      -real(0xa540e2085LL<<24),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^15, polynomial in n of order 11
       reale(-6367LL,0x25f6504LL<<24),reale(16360LL,0x4dc3558LL<<24),
       reale(-33061LL,0x4ecdf6cLL<<24),reale(52401LL,0x66e3beLL<<28),
       reale(-63841LL,0x71a1354LL<<24),reale(56445LL,0xe17ae68LL<<24),
-      reale(-29838LL,0x86065bcLL<<24),real(-0x7403de4e1LL<<28),
+      reale(-29838LL,0x86065bcLL<<24),-real(0x7403de4e1LL<<28),
       reale(20917LL,0x71e3ba4LL<<24),reale(-21570LL,0xb3f6b78LL<<24),
       reale(11677LL,0xe90fa0cLL<<24),reale(-2824LL,0xeb954754LL<<20),
       reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^14, polynomial in n of order 12
-      real(-0x8b26687cLL<<28),real(0x290fd9f1bLL<<28),
+      -real(0x8b26687cLL<<28),real(0x290fd9f1bLL<<28),
       reale(-2388LL,0x36721eLL<<28),reale(6865LL,0x9baec9LL<<28),
       reale(-15870LL,0x905358LL<<28),reale(29710LL,0x8c2607LL<<28),
       reale(-45044LL,486674LL<<28),reale(54812LL,0x6d26b5LL<<28),
       reale(-52442LL,0xa7f12cLL<<28),reale(37945LL,0xc3d2b3LL<<28),
       reale(-19390LL,0x431186LL<<28),reale(6169LL,0x764be1LL<<28),
-      real(-0x38ce4db2db8LL<<20),reale(0x1d58babLL,0x98ef4f7042175LL),
+      -real(0x38ce4db2db8LL<<20),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[13], coeff of eps^13, polynomial in n of order 13
-      real(-0x58be73cLL<<24),real(0x38517abLL<<28),real(-0x186e02be4LL<<24),
-      real(0x7dd9a1868LL<<24),real(-0x1f88b6950cLL<<24),
+      -real(0x58be73cLL<<24),real(0x38517abLL<<28),-real(0x186e02be4LL<<24),
+      real(0x7dd9a1868LL<<24),-real(0x1f88b6950cLL<<24),
       real(0x6557140f2LL<<28),reale(-4257LL,0xb6b584cLL<<24),
       reale(9227LL,0xea319d8LL<<24),reale(-16595LL,0xf151724LL<<24),
       reale(24654LL,470841LL<<28),reale(-29746LL,0x611227cLL<<24),
       reale(27762LL,0x9455748LL<<24),reale(-16967LL,0xfaaf554LL<<24),
       reale(4695LL,0xf3c1c18cLL<<20),reale(0x1d58babLL,0x98ef4f7042175LL),
       // C4[14], coeff of eps^26, polynomial in n of order 0
-      real(-27124LL<<24),real(0x5fa345ccc643905LL),
+      -real(27124LL<<24),real(0x5fa345ccc643905LL),
       // C4[14], coeff of eps^25, polynomial in n of order 1
-      real(-46952LL<<28),real(58824LL<<24),real(0x148e6926290dbdd9LL),
+      -real(46952LL<<28),real(58824LL<<24),real(0x148e6926290dbdd9LL),
       // C4[14], coeff of eps^24, polynomial in n of order 2
-      real(0x8f014108LL<<28),real(0x90ae184LL<<28),real(-0x3d486a848LL<<24),
+      real(0x8f014108LL<<28),real(0x90ae184LL<<28),-real(0x3d486a848LL<<24),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^23, polynomial in n of order 3
-      real(-0xaf809838LL<<28),real(0x16526bf3LL<<32),real(-0x7a5a5568LL<<28),
+      -real(0xaf809838LL<<28),real(0x16526bf3LL<<32),-real(0x7a5a5568LL<<28),
       real(0x632768c8LL<<24),reale(0xa81be1LL,0xc8231c70e1ef1LL),
       // C4[14], coeff of eps^22, polynomial in n of order 4
       reale(-3491LL,0x840908LL<<28),real(0x21172cd46LL<<28),
-      real(0x16feb6884LL<<28),real(0x64d1f5c2LL<<28),real(-0x7195fe17cLL<<24),
+      real(0x16feb6884LL<<28),real(0x64d1f5c2LL<<28),-real(0x7195fe17cLL<<24),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^21, polynomial in n of order 5
-      real(0x6f9dc457LL<<32),real(-0x4d771554LL<<32),
+      real(0x6f9dc457LL<<32),-real(0x4d771554LL<<32),
       reale(-2077LL,162049LL<<32),real(0x7498ad56LL<<32),
-      real(-0x1c8c8a55LL<<32),real(0x5e23549LL<<28),
+      -real(0x1c8c8a55LL<<32),real(0x5e23549LL<<28),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^20, polynomial in n of order 6
       reale(-4076LL,862583LL<<32),reale(10359LL,0x71ed88LL<<28),
-      reale(-4246LL,570106LL<<32),real(-0x37200de48LL<<28),
-      real(0x24bde07dLL<<32),real(0x1a398c5e8LL<<28),real(-0xe70c22fdLL<<28),
+      reale(-4246LL,570106LL<<32),-real(0x37200de48LL<<28),
+      real(0x24bde07dLL<<32),real(0x1a398c5e8LL<<28),-real(0xe70c22fdLL<<28),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^19, polynomial in n of order 7
       reale(-16508LL,9905LL<<32),reale(-7427LL,479402LL<<32),
       reale(6609LL,461219LL<<32),reale(3685LL,139036LL<<32),
       reale(-6577LL,261781LL<<32),reale(3109LL,382350LL<<32),
-      real(-0x1d03ce79LL<<32),real(-0x200b2093LL<<28),
+      -real(0x1d03ce79LL<<32),-real(0x200b2093LL<<28),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^18, polynomial in n of order 8
       reale(-24789LL,0x83cf4cLL<<28),reale(49876LL,0x7a32c28LL<<24),
       reale(-40131LL,0x62c079LL<<28),reale(13469LL,0x2232af8LL<<24),
       reale(3498LL,0x98bfa6LL<<28),reale(-4112LL,0x4c9f9c8LL<<24),
-      real(-0x1cbd94d2dLL<<28),real(0x68817a7898LL<<24),
-      real(-0x2359e35b9dLL<<24),reale(0x1f853a5LL,0x58695552a5cd3LL),
+      -real(0x1cbd94d2dLL<<28),real(0x68817a7898LL<<24),
+      -real(0x2359e35b9dLL<<24),reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^17, polynomial in n of order 9
       reale(63443LL,0x6de27aLL<<28),reale(-50758LL,552373LL<<32),
       reale(16003LL,0x826826LL<<28),reale(22072LL,208508LL<<28),
       reale(-40596LL,0x6563d2LL<<28),reale(33806LL,0x7a9da8LL<<28),
       reale(-16096LL,0xcd217eLL<<28),reale(3680LL,0x3774d4LL<<28),
-      real(0x45a0ed2aLL<<28),real(-0x97dac1de2LL<<24),
+      real(0x45a0ed2aLL<<28),-real(0x97dac1de2LL<<24),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^16, polynomial in n of order 10
       reale(19689LL,0x79235aLL<<28),reale(-36283LL,0x3a1c11LL<<28),
@@ -3787,11 +3787,11 @@ namespace GeographicLib {
       reale(31156LL,0xe11346LL<<28),reale(-44631LL,0xd0e1bcLL<<28),
       reale(51879LL,0x441732LL<<28),reale(-47871LL,0x79b528LL<<28),
       reale(33689LL,0x41ed1eLL<<28),reale(-16865LL,0x373094LL<<28),
-      reale(5288LL,0x1c410aLL<<28),real(-0x3032ec97c2LL<<24),
+      reale(5288LL,0x1c410aLL<<28),-real(0x3032ec97c2LL<<24),
       reale(0x1f853a5LL,0x58695552a5cd3LL),
       // C4[14], coeff of eps^14, polynomial in n of order 12
-      real(0x7f43c22LL<<28),real(-0x2c8eafab8LL<<24),real(0xc32b2bc7LL<<28),
-      real(-0x2b1186d468LL<<24),real(0x7d0edcd6cLL<<28),
+      real(0x7f43c22LL<<28),-real(0x2c8eafab8LL<<24),real(0xc32b2bc7LL<<28),
+      -real(0x2b1186d468LL<<24),real(0x7d0edcd6cLL<<28),
       reale(-4841LL,0x847e1e8LL<<24),reale(9826LL,0x8b1711LL<<28),
       reale(-16768LL,0x7c50838LL<<24),reale(23911LL,0xeefeb6LL<<28),
       reale(-27977LL,0x9a7e88LL<<24),reale(25559LL,0x333a5bLL<<28),
@@ -3800,37 +3800,37 @@ namespace GeographicLib {
       // C4[15], coeff of eps^26, polynomial in n of order 0
       real(284LL<<28),real(0x2213ecbbb96785dLL),
       // C4[15], coeff of eps^25, polynomial in n of order 1
-      real(27196LL<<32),real(-0x12d3b78LL<<24),
+      real(27196LL<<32),-real(0x12d3b78LL<<24),
       reale(43244LL,0xc47e8e0e2a501LL),
       // C4[15], coeff of eps^24, polynomial in n of order 2
-      real(0x358bd2LL<<36),real(-0x10e5a9LL<<36),real(0xb51281LL<<28),
+      real(0x358bd2LL<<36),-real(0x10e5a9LL<<36),real(0xb51281LL<<28),
       reale(0x1c5fc5LL,0x141dc611b72bLL),
       // C4[15], coeff of eps^23, polynomial in n of order 3
       real(0x114ce0c4LL<<32),real(0x1627a278LL<<32),real(0x768a96cLL<<32),
-      real(-0x6d0584bb8LL<<24),reale(0x21b1b9fLL,0x17e35b3509831LL),
+      -real(0x6d0584bb8LL<<24),reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^22, polynomial in n of order 4
-      real(-0x339e3ecLL<<36),reale(-2168LL,51155LL<<36),real(0x6a7c3eaLL<<36),
-      real(-0x180fd6fLL<<36),real(0xc32b44LL<<28),
+      -real(0x339e3ecLL<<36),reale(-2168LL,51155LL<<36),real(0x6a7c3eaLL<<36),
+      -real(0x180fd6fLL<<36),real(0xc32b44LL<<28),
       reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^21, polynomial in n of order 5
       reale(9732LL,17262LL<<36),reale(-3186LL,36552LL<<36),
-      real(-0x43dd4feLL<<36),real(0x1de7dc4LL<<36),real(0x1b0dff6LL<<36),
-      real(-0xd920f5edLL<<28),reale(0x21b1b9fLL,0x17e35b3509831LL),
+      -real(0x43dd4feLL<<36),real(0x1de7dc4LL<<36),real(0x1b0dff6LL<<36),
+      -real(0xd920f5edLL<<28),reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^20, polynomial in n of order 6
       reale(-8974LL,45592LL<<36),reale(5093LL,1677LL<<40),
       reale(4452LL,53LL<<40),reale(-6182LL,2471LL<<40),
-      reale(2693LL,57096LL<<36),real(-0x169da1LL<<40),real(-0x223ddc2aLL<<28),
+      reale(2693LL,57096LL<<36),-real(0x169da1LL<<40),-real(0x223ddc2aLL<<28),
       reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^19, polynomial in n of order 7
       reale(48363LL,42681LL<<36),reale(-34139LL,63194LL<<36),
       reale(9135LL,63227LL<<36),reale(4396LL,51388LL<<36),
-      reale(-3597LL,31869LL<<36),real(-0x2bcd262LL<<36),real(0x64396bfLL<<36),
-      real(-0x2088431a1LL<<28),reale(0x21b1b9fLL,0x17e35b3509831LL),
+      reale(-3597LL,31869LL<<36),-real(0x2bcd262LL<<36),real(0x64396bfLL<<36),
+      -real(0x2088431a1LL<<28),reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^18, polynomial in n of order 8
       reale(-41807LL,35192LL<<36),reale(7070LL,18565LL<<36),
       reale(26107LL,55418LL<<36),reale(-39104LL,55423LL<<36),
       reale(30179LL,444LL<<36),reale(-13594LL,22617LL<<36),
-      reale(2866LL,40062LL<<36),real(0x94bb53LL<<36),real(-0x8b41da54LL<<28),
+      reale(2866LL,40062LL<<36),real(0x94bb53LL<<36),-real(0x8b41da54LL<<28),
       reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^17, polynomial in n of order 9
       reale(-38752LL,80137LL<<32),reale(52907LL,0xfc9e8LL<<32),
@@ -3840,48 +3840,48 @@ namespace GeographicLib {
       reale(9586LL,798401LL<<32),reale(-2290LL,0x45a3d6aLL<<24),
       reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[15], coeff of eps^16, polynomial in n of order 10
-      real(-0x571bf678LL<<32),reale(3304LL,556556LL<<32),
+      -real(0x571bf678LL<<32),reale(3304LL,556556LL<<32),
       reale(-6522LL,32202LL<<36),reale(10722LL,907188LL<<32),
       reale(-14619LL,139704LL<<32),reale(16325LL,39196LL<<32),
       reale(-14591LL,8133LL<<36),reale(10019LL,388548LL<<32),
       reale(-4926LL,724968LL<<32),real(0x5f48012cLL<<32),
-      real(-0xdc5682b5cLL<<24),reale(0xb3b3dfLL,0xb2a11e67032bbLL),
+      -real(0xdc5682b5cLL<<24),reale(0xb3b3dfLL,0xb2a11e67032bbLL),
       // C4[15], coeff of eps^15, polynomial in n of order 11
-      real(-0x490f31dLL<<32),real(0x118ff5d2LL<<32),real(-0x37d9274fLL<<32),
+      -real(0x490f31dLL<<32),real(0x118ff5d2LL<<32),-real(0x37d9274fLL<<32),
       reale(2382LL,900648LL<<32),reale(-5378LL,933983LL<<32),
       reale(10315LL,284030LL<<32),reale(-16819LL,653869LL<<32),
       reale(23142LL,90132LL<<32),reale(-26357LL,771163LL<<32),
       reale(23629LL,791082LL<<32),reale(-14102LL,390441LL<<32),
       reale(3855LL,0xe9ef6caLL<<24),reale(0x21b1b9fLL,0x17e35b3509831LL),
       // C4[16], coeff of eps^26, polynomial in n of order 0
-      real(-22951LL<<32),reale(14038LL,0xf79362a6f2da9LL),
+      -real(22951LL<<32),reale(14038LL,0xf79362a6f2da9LL),
       // C4[16], coeff of eps^25, polynomial in n of order 1
-      real(-72136LL<<32),real(38520LL<<28),reale(9206LL,0xf354c01a236f3LL),
+      -real(72136LL<<32),real(38520LL<<28),reale(9206LL,0xf354c01a236f3LL),
       // C4[16], coeff of eps^24, polynomial in n of order 2
-      real(0x117dcfLL<<36),real(0x6fd5b8LL<<32),real(-0x57f207LL<<32),
+      real(0x117dcfLL<<36),real(0x6fd5b8LL<<32),-real(0x57f207LL<<32),
       reale(0x1e3466LL,0x5c2d55f3c2615LL),
       // C4[16], coeff of eps^23, polynomial in n of order 3
-      real(-0x74594b8LL<<32),real(0x51af5fLL<<36),real(-0x1118be8LL<<32),
-      real(-0x2895a8LL<<28),reale(0x1e3466LL,0x5c2d55f3c2615LL),
+      -real(0x74594b8LL<<32),real(0x51af5fLL<<36),-real(0x1118be8LL<<32),
+      -real(0x2895a8LL<<28),reale(0x1e3466LL,0x5c2d55f3c2615LL),
       // C4[16], coeff of eps^22, polynomial in n of order 4
-      reale(-2281LL,39380LL<<36),real(-0x4b4b50dLL<<36),real(0x1776d4aLL<<36),
-      real(0x1b7e671LL<<36),real(-0xcc2c56bLL<<32),
+      reale(-2281LL,39380LL<<36),-real(0x4b4b50dLL<<36),real(0x1776d4aLL<<36),
+      real(0x1b7e671LL<<36),-real(0xcc2c56bLL<<32),
       reale(0x23de398LL,0xd75d61176d38fLL),
       // C4[16], coeff of eps^21, polynomial in n of order 5
       reale(3604LL,321208LL<<32),reale(4989LL,51182LL<<36),
       reale(-5767LL,0xf5608LL<<32),reale(2335LL,38023LL<<36),
-      real(-0x118945a8LL<<32),real(-0x23321c28LL<<28),
+      -real(0x118945a8LL<<32),-real(0x23321c28LL<<28),
       reale(0x23de398LL,0xd75d61176d38fLL),
       // C4[16], coeff of eps^20, polynomial in n of order 6
       reale(-28604LL,48266LL<<36),reale(5695LL,63155LL<<36),
       reale(4892LL,56156LL<<36),reale(-3092LL,6917LL<<36),
-      real(-0x3777fd2LL<<36),real(0x5fd58d7LL<<36),real(-0x1e0959d4LL<<32),
+      -real(0x3777fd2LL<<36),real(0x5fd58d7LL<<36),-real(0x1e0959d4LL<<32),
       reale(0x23de398LL,0xd75d61176d38fLL),
       // C4[16], coeff of eps^19, polynomial in n of order 7
-      real(-0x1511e3e8LL<<32),reale(28752LL,63675LL<<36),
+      -real(0x1511e3e8LL<<32),reale(28752LL,63675LL<<36),
       reale(-37203LL,472264LL<<32),reale(26902LL,36338LL<<36),
       reale(-11513LL,203384LL<<32),reale(2229LL,59753LL<<36),
-      real(0xc947b28LL<<32),real(-0x7fa337d8LL<<28),
+      real(0xc947b28LL<<32),-real(0x7fa337d8LL<<28),
       reale(0x23de398LL,0xd75d61176d38fLL),
       // C4[16], coeff of eps^18, polynomial in n of order 8
       reale(51956LL,28024LL<<36),reale(-52001LL,245LL<<36),
@@ -3894,10 +3894,10 @@ namespace GeographicLib {
       reale(32809LL,309896LL<<32),reale(-42827LL,63737LL<<36),
       reale(46156LL,986392LL<<32),reale(-40103LL,50694LL<<36),
       reale(26942LL,134824LL<<32),reale(-13032LL,53203LL<<36),
-      reale(3987LL,162104LL<<32),real(-0x23bb00708LL<<28),
+      reale(3987LL,162104LL<<32),-real(0x23bb00708LL<<28),
       reale(0x23de398LL,0xd75d61176d38fLL),
       // C4[16], coeff of eps^16, polynomial in n of order 10
-      real(0x17e28184LL<<32),real(-0x458c00a6LL<<32),reale(2759LL,6541LL<<36),
+      real(0x17e28184LL<<32),-real(0x458c00a6LL<<32),reale(2759LL,6541LL<<36),
       reale(-5864LL,957254LL<<32),reale(10706LL,531484LL<<32),
       reale(-16774LL,495538LL<<32),reale(22364LL,737384LL<<32),
       reale(-24872LL,951710LL<<32),reale(21929LL,367284LL<<32),
@@ -3906,74 +3906,74 @@ namespace GeographicLib {
       // C4[17], coeff of eps^26, polynomial in n of order 0
       real(1LL<<32),real(0x62a61c3e4dd975LL),
       // C4[17], coeff of eps^25, polynomial in n of order 1
-      real(32456LL<<32),real(-360120LL<<28),reale(8569LL,0x3d59f665e75a3LL),
+      real(32456LL<<32),-real(360120LL<<28),reale(8569LL,0x3d59f665e75a3LL),
       // C4[17], coeff of eps^24, polynomial in n of order 2
-      real(43463LL<<40),real(-135160LL<<36),real(-45580LL<<32),
+      real(43463LL<<40),-real(135160LL<<36),-real(45580LL<<32),
       reale(299923LL,0x634cafeea1549LL),
       // C4[17], coeff of eps^23, polynomial in n of order 3
-      real(-0x97b2e8LL<<32),real(138325LL<<36),real(0x353008LL<<32),
-      real(-0x171e178LL<<28),reale(299923LL,0x634cafeea1549LL),
+      -real(0x97b2e8LL<<32),real(138325LL<<36),real(0x353008LL<<32),
+      -real(0x171e178LL<<28),reale(299923LL,0x634cafeea1549LL),
       // C4[17], coeff of eps^22, polynomial in n of order 4
-      real(0x11914e8LL<<36),real(-0x1198806LL<<36),real(0x6aad14LL<<36),
-      real(-744226LL<<36),real(-0x1dbcbfLL<<32),
+      real(0x11914e8LL<<36),-real(0x1198806LL<<36),real(0x6aad14LL<<36),
+      -real(744226LL<<36),-real(0x1dbcbfLL<<32),
       reale(0x200907LL,0xb718cf86694ffLL),
       // C4[17], coeff of eps^21, polynomial in n of order 5
       reale(2996LL,558104LL<<32),reale(5105LL,60614LL<<36),
-      reale(-2617LL,864168LL<<32),real(-0x40606cdLL<<36),
-      real(0x5b76e438LL<<32),real(-0x1bd1b2248LL<<28),
+      reale(-2617LL,864168LL<<32),-real(0x40606cdLL<<36),
+      real(0x5b76e438LL<<32),-real(0x1bd1b2248LL<<28),
       reale(0x260ab92LL,0x96d766f9d0eedLL),
       // C4[17], coeff of eps^20, polynomial in n of order 6
       reale(30327LL,10344LL<<36),reale(-35085LL,52340LL<<36),
       reale(23968LL,2311LL<<40),reale(-9777LL,37164LL<<36),
-      real(0x6c06b78LL<<36),real(0xeb3424LL<<36),real(-0x7509546LL<<32),
+      real(0x6c06b78LL<<36),real(0xeb3424LL<<36),-real(0x7509546LL<<32),
       reale(0x260ab92LL,0x96d766f9d0eedLL),
       // C4[17], coeff of eps^19, polynomial in n of order 7
       reale(-47758LL,665464LL<<32),reale(31664LL,61447LL<<36),
       reale(-8327LL,461032LL<<32),reale(-11213LL,30202LL<<36),
       reale(19076LL,191320LL<<32),reale(-15917LL,2861LL<<36),
-      reale(8026LL,341192LL<<32),real(-0x76e6858b8LL<<28),
+      reale(8026LL,341192LL<<32),-real(0x76e6858b8LL<<28),
       reale(0x260ab92LL,0x96d766f9d0eedLL),
       // C4[17], coeff of eps^18, polynomial in n of order 8
       reale(-22253LL,3173LL<<40),reale(33139LL,4898LL<<36),
       reale(-41619LL,37916LL<<36),reale(43458LL,60582LL<<36),
       reale(-36815LL,53288LL<<36),reale(24253LL,7690LL<<36),
       reale(-11562LL,54708LL<<36),reale(3500LL,60046LL<<36),
-      real(-0x1f264f27LL<<32),reale(0x260ab92LL,0x96d766f9d0eedLL),
+      -real(0x1f264f27LL<<32),reale(0x260ab92LL,0x96d766f9d0eedLL),
       // C4[17], coeff of eps^17, polynomial in n of order 9
-      real(-0x53db06e8LL<<32),reale(3123LL,33372LL<<36),
+      -real(0x53db06e8LL<<32),reale(3123LL,33372LL<<36),
       reale(-6298LL,57448LL<<32),reale(11012LL,26677LL<<36),
       reale(-16655LL,454840LL<<32),reale(21593LL,33198LL<<36),
       reale(-23510LL,986120LL<<32),reale(20422LL,743LL<<36),
       reale(-11962LL,562264LL<<32),reale(3239LL,0x9027d8LL<<28),
       reale(0x260ab92LL,0x96d766f9d0eedLL),
       // C4[18], coeff of eps^26, polynomial in n of order 0
-      real(-112174LL<<32),reale(47221LL,0xfaefc0318df67LL),
+      -real(112174LL<<32),reale(47221LL,0xfaefc0318df67LL),
       // C4[18], coeff of eps^25, polynomial in n of order 1
-      real(-159848LL<<36),real(-86040LL<<32),reale(443886LL,0x9d340e9e9cd95LL),
+      -real(159848LL<<36),-real(86040LL<<32),reale(443886LL,0x9d340e9e9cd95LL),
       // C4[18], coeff of eps^24, polynomial in n of order 2
-      real(673240LL<<36),real(0x1731acLL<<36),real(-0x9878d8LL<<32),
+      real(673240LL<<36),real(0x1731acLL<<36),-real(0x9878d8LL<<32),
       reale(0x21dda9LL,0x12044919103e9LL),
       // C4[18], coeff of eps^23, polynomial in n of order 3
-      real(-0x1042158LL<<36),real(379583LL<<40),real(-565192LL<<36),
-      real(-0x1d5db8LL<<32),reale(0x21dda9LL,0x12044919103e9LL),
+      -real(0x1042158LL<<36),real(379583LL<<40),-real(565192LL<<36),
+      -real(0x1d5db8LL<<32),reale(0x21dda9LL,0x12044919103e9LL),
       // C4[18], coeff of eps^22, polynomial in n of order 4
-      real(0x10d9e84LL<<36),real(-0x72a70dLL<<36),real(-0x3bd63eLL<<36),
-      real(0x496dd1LL<<36),real(-0x15c2fa6LL<<32),
+      real(0x10d9e84LL<<36),-real(0x72a70dLL<<36),-real(0x3bd63eLL<<36),
+      real(0x496dd1LL<<36),-real(0x15c2fa6LL<<32),
       reale(0x21dda9LL,0x12044919103e9LL),
       // C4[18], coeff of eps^21, polynomial in n of order 5
-      real(-0x6c2614cLL<<36),real(0x463f91LL<<40),real(-0x1b60794LL<<36),
-      real(0x460f88LL<<36),real(882980LL<<36),real(-0x5a7684LL<<32),
+      -real(0x6c2614cLL<<36),real(0x463f91LL<<40),-real(0x1b60794LL<<36),
+      real(0x460f88LL<<36),real(882980LL<<36),-real(0x5a7684LL<<32),
       reale(0x21dda9LL,0x12044919103e9LL),
       // C4[18], coeff of eps^20, polynomial in n of order 6
       reale(26896LL,20636LL<<36),reale(-4988LL,47778LL<<36),
       reale(-12194LL,14952LL<<36),reale(18360LL,53550LL<<36),
       reale(-14826LL,30772LL<<36),reale(7390LL,53946LL<<36),
-      real(-0x6d310d54LL<<32),reale(0x283738cLL,0x56516cdc34a4bLL),
+      -real(0x6d310d54LL<<32),reale(0x283738cLL,0x56516cdc34a4bLL),
       // C4[18], coeff of eps^19, polynomial in n of order 7
       reale(11070LL,49036LL<<36),reale(-13432LL,16696LL<<36),
       reale(13633LL,18532LL<<36),reale(-11289LL,1325LL<<40),
       reale(7306LL,46652LL<<36),reale(-3438LL,26728LL<<36),
-      real(0x4074714LL<<36),real(-0x91df1b4LL<<32),
+      real(0x4074714LL<<36),-real(0x91df1b4LL<<32),
       reale(0xd67bd9LL,0x721b244966e19LL),
       // C4[18], coeff of eps^18, polynomial in n of order 8
       reale(3471LL,43464LL<<36),reale(-6683LL,3167LL<<36),
@@ -3982,108 +3982,108 @@ namespace GeographicLib {
       reale(19078LL,41714LL<<36),reale(-11087LL,50153LL<<36),
       reale(2990LL,383722LL<<32),reale(0x283738cLL,0x56516cdc34a4bLL),
       // C4[19], coeff of eps^26, polynomial in n of order 0
-      real(-226LL<<36),reale(16591LL,0x81ae2ec54d8dfLL),
+      -real(226LL<<36),reale(16591LL,0x81ae2ec54d8dfLL),
       // C4[19], coeff of eps^25, polynomial in n of order 1
-      real(94099LL<<40),real(-0x8fd608LL<<32),
+      real(94099LL<<40),-real(0x8fd608LL<<32),
       reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^24, polynomial in n of order 2
-      real(330104LL<<40),real(-26332LL<<40),real(-117501LL<<36),
+      real(330104LL<<40),-real(26332LL<<40),-real(117501LL<<36),
       reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^23, polynomial in n of order 3
-      real(-384159LL<<40),real(-261954LL<<40),real(286571LL<<40),
-      real(-0x14458c8LL<<32),reale(0x23b24aLL,0x6cefc2abb72d3LL),
+      -real(384159LL<<40),-real(261954LL<<40),real(286571LL<<40),
+      -real(0x14458c8LL<<32),reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^22, polynomial in n of order 4
-      real(256484LL<<44),real(-95676LL<<44),real(13674LL<<44),real(3604LL<<44),
-      real(-340578LL<<36),reale(0x23b24aLL,0x6cefc2abb72d3LL),
+      real(256484LL<<44),-real(95676LL<<44),real(13674LL<<44),real(3604LL<<44),
+      -real(340578LL<<36),reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^21, polynomial in n of order 5
-      real(-0x74ab18LL<<36),real(-0x2a50f6LL<<40),real(0x39fb358LL<<36),
-      real(-0x2d852bLL<<40),real(0x1678ac8LL<<36),real(-0x54cf1bcLL<<32),
+      -real(0x74ab18LL<<36),-real(0x2a50f6LL<<40),real(0x39fb358LL<<36),
+      -real(0x2d852bLL<<40),real(0x1678ac8LL<<36),-real(0x54cf1bcLL<<32),
       reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^20, polynomial in n of order 6
-      real(-0x7ff89cLL<<40),real(0x7e9b22LL<<40),real(-0x66b1a8LL<<40),
-      real(0x4169eeLL<<40),real(-0x1e6934LL<<40),real(592858LL<<40),
-      real(-0x145aaa8LL<<32),reale(0x23b24aLL,0x6cefc2abb72d3LL),
+      -real(0x7ff89cLL<<40),real(0x7e9b22LL<<40),-real(0x66b1a8LL<<40),
+      real(0x4169eeLL<<40),-real(0x1e6934LL<<40),real(592858LL<<40),
+      -real(0x145aaa8LL<<32),reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[19], coeff of eps^19, polynomial in n of order 7
-      real(-0x1717fa8LL<<36),real(0x258a9bLL<<40),real(-0x357c878LL<<36),
-      real(0x4220f2LL<<40),real(-0x456f648LL<<36),real(0x3acd09LL<<40),
-      real(-0x21ec718LL<<36),real(0x91df1b4LL<<32),
+      -real(0x1717fa8LL<<36),real(0x258a9bLL<<40),-real(0x357c878LL<<36),
+      real(0x4220f2LL<<40),-real(0x456f648LL<<36),real(0x3acd09LL<<40),
+      -real(0x21ec718LL<<36),real(0x91df1b4LL<<32),
       reale(0x23b24aLL,0x6cefc2abb72d3LL),
       // C4[20], coeff of eps^26, polynomial in n of order 0
-      real(-34781LL<<40),reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
+      -real(34781LL<<40),reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^25, polynomial in n of order 1
-      real(-19084LL<<40),real(-113916LL<<36),
+      -real(19084LL<<40),-real(113916LL<<36),
       reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^24, polynomial in n of order 2
-      real(-273868LL<<40),real(273002LL<<40),real(-0x12ef04LL<<36),
+      -real(273868LL<<40),real(273002LL<<40),-real(0x12ef04LL<<36),
       reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^23, polynomial in n of order 3
-      real(-0x13f854LL<<40),real(164264LL<<40),real(58724LL<<40),
-      real(-313548LL<<36),reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
+      -real(0x13f854LL<<40),real(164264LL<<40),real(58724LL<<40),
+      -real(313548LL<<36),reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^22, polynomial in n of order 4
-      real(-179129LL<<44),real(0x3790d4LL<<40),real(-0x2a93c8LL<<40),
-      real(0x14d79cLL<<40),real(-321657LL<<40),
+      -real(179129LL<<44),real(0x3790d4LL<<40),-real(0x2a93c8LL<<40),
+      real(0x14d79cLL<<40),-real(321657LL<<40),
       reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^21, polynomial in n of order 5
-      real(0x7729ecLL<<40),real(-388557LL<<44),real(0x3b8cf4LL<<40),
-      real(-0x1b62e8LL<<40),real(529788LL<<40),real(-0x1217b4LL<<36),
+      real(0x7729ecLL<<40),-real(388557LL<<44),real(0x3b8cf4LL<<40),
+      -real(0x1b62e8LL<<40),real(529788LL<<40),-real(0x1217b4LL<<36),
       reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[20], coeff of eps^20, polynomial in n of order 6
-      real(0x25ea6eLL<<40),real(-0x34a927LL<<40),real(0x3fcb74LL<<40),
-      real(-0x41f331LL<<40),real(0x373d7aLL<<40),real(-0x1fa97bLL<<40),
+      real(0x25ea6eLL<<40),-real(0x34a927LL<<40),real(0x3fcb74LL<<40),
+      -real(0x41f331LL<<40),real(0x373d7aLL<<40),-real(0x1fa97bLL<<40),
       real(0x87b1c6LL<<36),reale(0x2586ebLL,0xc7db3c3e5e1bdLL),
       // C4[21], coeff of eps^26, polynomial in n of order 0
-      real(-1592LL<<36),reale(37381LL,0xc16e795c129fbLL),
+      -real(1592LL<<36),reale(37381LL,0xc16e795c129fbLL),
       // C4[21], coeff of eps^25, polynomial in n of order 1
-      real(260108LL<<40),real(-0x11ba5cLL<<36),
+      real(260108LL<<40),-real(0x11ba5cLL<<36),
       reale(0x275b8dLL,0x22c6b5d1050a7LL),
       // C4[21], coeff of eps^24, polynomial in n of order 2
-      real(7532LL<<44),real(3674LL<<44),real(-18073LL<<40),
+      real(7532LL<<44),real(3674LL<<44),-real(18073LL<<40),
       reale(0x275b8dLL,0x22c6b5d1050a7LL),
       // C4[21], coeff of eps^23, polynomial in n of order 3
-      real(0x353154LL<<40),real(-0x27e7e8LL<<40),real(0x13649cLL<<40),
-      real(-0x48f9acLL<<36),reale(0x275b8dLL,0x22c6b5d1050a7LL),
+      real(0x353154LL<<40),-real(0x27e7e8LL<<40),real(0x13649cLL<<40),
+      -real(0x48f9acLL<<36),reale(0x275b8dLL,0x22c6b5d1050a7LL),
       // C4[21], coeff of eps^22, polynomial in n of order 4
-      real(-119884LL<<44),real(74261LL<<44),real(-33814LL<<44),
-      real(9911LL<<44),real(-353192LL<<36),reale(859780LL,0x60ece745ac58dLL),
+      -real(119884LL<<44),real(74261LL<<44),-real(33814LL<<44),
+      real(9911LL<<44),-real(353192LL<<36),reale(859780LL,0x60ece745ac58dLL),
       // C4[21], coeff of eps^21, polynomial in n of order 5
-      real(-0x33c20cLL<<40),real(252109LL<<44),real(-0x3ebbd4LL<<40),
-      real(0x3405e8LL<<40),real(-0x1da41cLL<<40),real(0x7ea5ecLL<<36),
+      -real(0x33c20cLL<<40),real(252109LL<<44),-real(0x3ebbd4LL<<40),
+      real(0x3405e8LL<<40),-real(0x1da41cLL<<40),real(0x7ea5ecLL<<36),
       reale(0x275b8dLL,0x22c6b5d1050a7LL),
       // C4[22], coeff of eps^26, polynomial in n of order 0
-      real(-2963LL<<40),reale(117361LL,0x5360ca6881e97LL),
+      -real(2963LL<<40),reale(117361LL,0x5360ca6881e97LL),
       // C4[22], coeff of eps^25, polynomial in n of order 1
-      real(158LL<<44),real(-726LL<<40),reale(117361LL,0x5360ca6881e97LL),
+      real(158LL<<44),-real(726LL<<40),reale(117361LL,0x5360ca6881e97LL),
       // C4[22], coeff of eps^24, polynomial in n of order 2
-      real(-153502LL<<44),real(74129LL<<44),real(-278674LL<<40),
+      -real(153502LL<<44),real(74129LL<<44),-real(278674LL<<40),
       reale(0x29302eLL,0x7db22f63abf91LL),
       // C4[22], coeff of eps^23, polynomial in n of order 3
-      real(204102LL<<44),real(-92092LL<<44),real(26818LL<<44),
-      real(-59466LL<<40),reale(0x29302eLL,0x7db22f63abf91LL),
+      real(204102LL<<44),-real(92092LL<<44),real(26818LL<<44),
+      -real(59466LL<<40),reale(0x29302eLL,0x7db22f63abf91LL),
       // C4[22], coeff of eps^22, polynomial in n of order 4
-      real(243294LL<<44),real(-0x3bc298LL<<40),real(201135LL<<44),
-      real(-0x1bd388LL<<40),real(485639LL<<40),
+      real(243294LL<<44),-real(0x3bc298LL<<40),real(201135LL<<44),
+      -real(0x1bd388LL<<40),real(485639LL<<40),
       reale(0x29302eLL,0x7db22f63abf91LL),
       // C4[23], coeff of eps^26, polynomial in n of order 0
-      real(-2LL<<44),reale(5837LL,0x4b04b152e489LL),
+      -real(2LL<<44),reale(5837LL,0x4b04b152e489LL),
       // C4[23], coeff of eps^25, polynomial in n of order 1
-      real(3016LL<<44),real(-11330LL<<40),reale(122577LL,0x627628bccbf3dLL),
+      real(3016LL<<44),-real(11330LL<<40),reale(122577LL,0x627628bccbf3dLL),
       // C4[23], coeff of eps^24, polynomial in n of order 2
-      real(-228LL<<48),real(66LL<<48),real(-2332LL<<40),
+      -real(228LL<<48),real(66LL<<48),-real(2332LL<<40),
       reale(122577LL,0x627628bccbf3dLL),
       // C4[23], coeff of eps^23, polynomial in n of order 3
-      real(-10152LL<<44),real(517LL<<48),real(-4664LL<<44),real(19822LL<<40),
+      -real(10152LL<<44),real(517LL<<48),-real(4664LL<<44),real(19822LL<<40),
       reale(122577LL,0x627628bccbf3dLL),
       // C4[24], coeff of eps^26, polynomial in n of order 0
-      real(-664LL<<44),reale(127793LL,0x718b871115fe3LL),
+      -real(664LL<<44),reale(127793LL,0x718b871115fe3LL),
       // C4[24], coeff of eps^25, polynomial in n of order 1
-      real(20LL<<48),real(-44LL<<44),reale(42597LL,0xd083d7b05caa1LL),
+      real(20LL<<48),-real(44LL<<44),reale(42597LL,0xd083d7b05caa1LL),
       // C4[24], coeff of eps^24, polynomial in n of order 2
-      real(490LL<<48),real(-275LL<<48),real(1166LL<<44),
+      real(490LL<<48),-real(275LL<<48),real(1166LL<<44),
       reale(127793LL,0x718b871115fe3LL),
       // C4[25], coeff of eps^26, polynomial in n of order 0
-      real(-8LL<<44),reale(8867LL,0x4cd786c27dde7LL),
+      -real(8LL<<44),reale(8867LL,0x4cd786c27dde7LL),
       // C4[25], coeff of eps^25, polynomial in n of order 1
-      real(-52LL<<48),real(220LL<<44),reale(26601LL,0xe6869447799b5LL),
+      -real(52LL<<48),real(220LL<<44),reale(26601LL,0xe6869447799b5LL),
       // C4[26], coeff of eps^26, polynomial in n of order 0
       real(1LL<<48),reale(2126LL,0x8c0e9e949456fLL),
     };
@@ -4094,24 +4094,24 @@ namespace GeographicLib {
       // C4[0], coeff of eps^28, polynomial in n of order 1
       real(0x74154c0LL),real(0x1cc5554LL),real(0x269c465a0c9LL),
       // C4[0], coeff of eps^27, polynomial in n of order 2
-      real(0x50de7a6e0LL),real(-0x282ec9e50LL),real(0x1dfb4ba1bLL),
+      real(0x50de7a6e0LL),-real(0x282ec9e50LL),real(0x1dfb4ba1bLL),
       real(0xbfa33c13e963LL),
       // C4[0], coeff of eps^26, polynomial in n of order 3
-      real(0x738319564e0LL),real(-0x4c2475635c0LL),real(0x25d0be52da0LL),
+      real(0x738319564e0LL),-real(0x4c2475635c0LL),real(0x25d0be52da0LL),
       real(0x95c020b74eLL),real(0xa0f21774b90225LL),
       // C4[0], coeff of eps^25, polynomial in n of order 4
-      real(0x7a99ea0a52f40LL),real(-0x5a5f53e2c3b50LL),real(0x3b83d2c0c8da0LL),
-      real(-0x1d8a81cb5cc70LL),real(0x1605bd50459c1LL),
+      real(0x7a99ea0a52f40LL),-real(0x5a5f53e2c3b50LL),real(0x3b83d2c0c8da0LL),
+      -real(0x1d8a81cb5cc70LL),real(0x1605bd50459c1LL),
       real(0x6fb2ae4757107d03LL),
       // C4[0], coeff of eps^24, polynomial in n of order 5
-      real(0x2507d929b7f89580LL),real(-0x1ce7bf02c3715a00LL),
-      real(0x15463c23456c8680LL),real(-0xdfecff0050dfd00LL),
+      real(0x2507d929b7f89580LL),-real(0x1ce7bf02c3715a00LL),
+      real(0x15463c23456c8680LL),-real(0xdfecff0050dfd00LL),
       real(0x6f141ba97196780LL),real(0x1b71ab9c78b8b48LL),
       reale(0x1734efLL,0x957266bcf90f9LL),
       // C4[0], coeff of eps^23, polynomial in n of order 6
       reale(5214LL,0xb54b8c26f5620LL),reale(-4203LL,0xb51a0a43406b0LL),
       reale(3272LL,0xab988a50dfac0LL),reale(-2405LL,0x7b519f36184d0LL),
-      real(0x62be65b26227b760LL),real(-0x30f2645200be8b10LL),
+      real(0x62be65b26227b760LL),-real(0x30f2645200be8b10LL),
       real(0x2472ebc3f09ad327LL),reale(0x8fe1cdLL,0x6b5ee3606e93bLL),
       // C4[0], coeff of eps^22, polynomial in n of order 7
       reale(213221LL,0x21fe88963f0e0LL),reale(-174747LL,0xed01fc507d1c0LL),
@@ -4434,21 +4434,21 @@ namespace GeographicLib {
       // C4[1], coeff of eps^29, polynomial in n of order 0
       real(917561LL),real(0x3fc3dd0781LL),
       // C4[1], coeff of eps^28, polynomial in n of order 1
-      real(-0x7815280LL),real(0x564fffcLL),real(0x73d4d30e25bLL),
+      -real(0x7815280LL),real(0x564fffcLL),real(0x73d4d30e25bLL),
       // C4[1], coeff of eps^27, polynomial in n of order 2
-      real(-0x2f7e4f2fca0LL),real(0x161b06db8f0LL),real(0x5852679557LL),
+      -real(0x2f7e4f2fca0LL),real(0x161b06db8f0LL),real(0x5852679557LL),
       real(0x145a25f15d59339LL),
       // C4[1], coeff of eps^26, polynomial in n of order 3
-      real(-0x780f9f651c0LL),real(0x49cd6538080LL),real(-0x275396e6f40LL),
+      -real(0x780f9f651c0LL),real(0x49cd6538080LL),-real(0x275396e6f40LL),
       real(0x1c1406225eaLL),real(0x1e2d6465e2b066fLL),
       // C4[1], coeff of eps^25, polynomial in n of order 4
-      real(-0x226e68a74f6c2c0LL),real(0x178fbd94c6e4130LL),
-      real(-0x10bafa7048ffb60LL),real(0x7b204e43552d10LL),
+      -real(0x226e68a74f6c2c0LL),real(0x178fbd94c6e4130LL),
+      -real(0x10bafa7048ffb60LL),real(0x7b204e43552d10LL),
       real(0x1ebd785c76c649LL),reale(369943LL,0xaebaf6655156dLL),
       // C4[1], coeff of eps^24, polynomial in n of order 5
-      real(-0x26adfa4c2bcf8500LL),real(0x1be7e116f09bc400LL),
-      real(-0x1641521374362300LL),real(0xd7dd4a2b1831200LL),
-      real(-0x7449d087ac65100LL),real(0x525502d56a2a1d8LL),
+      -real(0x26adfa4c2bcf8500LL),real(0x1be7e116f09bc400LL),
+      -real(0x1641521374362300LL),real(0xd7dd4a2b1831200LL),
+      -real(0x7449d087ac65100LL),real(0x525502d56a2a1d8LL),
       reale(0x459eceLL,0xc0573436eb2ebLL),
       // C4[1], coeff of eps^23, polynomial in n of order 6
       reale(-27300LL,0xe18051b90d520LL),reale(20250LL,0xb050f61211530LL),
@@ -4697,7 +4697,7 @@ namespace GeographicLib {
       reale(0x9b9ee4LL,0x255c7c31664b0LL),reale(0x14d790LL,0xd74a19c69db33LL),
       reale(0x2dd761028LL,0x56b51693aedc3LL),
       // C4[1], coeff of eps^4, polynomial in n of order 25
-      real(-0x5cd20bbc3c672180LL),real(-0x73720b2d98187c00LL),
+      -real(0x5cd20bbc3c672180LL),-real(0x73720b2d98187c00LL),
       reale(-2322LL,0x3b147a8a97980LL),reale(-2953LL,0x4d9e8f7737100LL),
       reale(-3805LL,0xbe842705d1c80LL),reale(-4974LL,0xa137909fe2e00LL),
       reale(-6610LL,0x667d8d0cf5780LL),reale(-8951LL,0xe683854b94b00LL),
@@ -4716,9 +4716,9 @@ namespace GeographicLib {
       reale(0x28a45a7LL,0x9d4bdce6b704LL),
       reale(0x2dd761028LL,0x56b51693aedc3LL),
       // C4[1], coeff of eps^3, polynomial in n of order 26
-      real(-0x34f88b61ee2c2e60LL),real(-0x40e8b73250ad02b0LL),
-      real(-0x50402824a1190680LL),real(-0x643133a56bf6de50LL),
-      real(-0x7e70b50d7e53aea0LL),reale(-2584LL,0x76116efc39410LL),
+      -real(0x34f88b61ee2c2e60LL),-real(0x40e8b73250ad02b0LL),
+      -real(0x50402824a1190680LL),-real(0x643133a56bf6de50LL),
+      -real(0x7e70b50d7e53aea0LL),reale(-2584LL,0x76116efc39410LL),
       reale(-3344LL,0xd2a9490df5540LL),reale(-4391LL,0x6eaf4118b9070LL),
       reale(-5863LL,0x134611e898120LL),reale(-7979LL,0x64baaeea752d0LL),
       reale(-11097LL,0xec88b5a185100LL),reale(-15826LL,0xc0dc248c81730LL),
@@ -4735,10 +4735,10 @@ namespace GeographicLib {
       reale(-0x6fc3f8cLL,0xa4f6f608588b5LL),
       reale(0x2dd761028LL,0x56b51693aedc3LL),
       // C4[1], coeff of eps^2, polynomial in n of order 27
-      real(-0x1bd57a8f504dd3c0LL),real(-0x21b6ff10b9172180LL),
-      real(-0x292825cda3a88940LL),real(-0x32aacbfadedfca00LL),
-      real(-0x3ef38a62fa0322c0LL),real(-0x4f013a1cfd80d280LL),
-      real(-0x64414a4729c69840LL),reale(-2061LL,0x6f152d95fcd00LL),
+      -real(0x1bd57a8f504dd3c0LL),-real(0x21b6ff10b9172180LL),
+      -real(0x292825cda3a88940LL),-real(0x32aacbfadedfca00LL),
+      -real(0x3ef38a62fa0322c0LL),-real(0x4f013a1cfd80d280LL),
+      -real(0x64414a4729c69840LL),reale(-2061LL,0x6f152d95fcd00LL),
       reale(-2684LL,0xdc83926d41e40LL),reale(-3548LL,0xc265fa3cc1c80LL),
       reale(-4771LL,0x913625a6408c0LL),reale(-6542LL,0xfe9a81bee2400LL),
       reale(-9171LL,0xe574b6bb02f40LL),reale(-13191LL,0x4f96bef7feb80LL),
@@ -4754,12 +4754,12 @@ namespace GeographicLib {
       reale(-0xdf87f17LL,0x49edec10b116aLL),
       reale(0x2dd761028LL,0x56b51693aedc3LL),
       // C4[1], coeff of eps^1, polynomial in n of order 28
-      real(-0xb4c355cd41c92c0LL),real(-0xd8fea3a41cc7830LL),
-      real(-0x1064f0c6b9a6ad20LL),real(-0x13f7a88902ef1b10LL),
-      real(-0x1884a414973fcb80LL),real(-0x1e5fa2ae5243d7f0LL),
-      real(-0x25fe0bb384ddd9e0LL),real(-0x3006f6e3e0e25ad0LL),
-      real(-0x3d6c2c13c34ec440LL),real(-0x4f91f34825bd4fb0LL),
-      real(-0x688ffb74f98676a0LL),reale(-2234LL,0x213cc44f79d70LL),
+      -real(0xb4c355cd41c92c0LL),-real(0xd8fea3a41cc7830LL),
+      -real(0x1064f0c6b9a6ad20LL),-real(0x13f7a88902ef1b10LL),
+      -real(0x1884a414973fcb80LL),-real(0x1e5fa2ae5243d7f0LL),
+      -real(0x25fe0bb384ddd9e0LL),-real(0x3006f6e3e0e25ad0LL),
+      -real(0x3d6c2c13c34ec440LL),-real(0x4f91f34825bd4fb0LL),
+      -real(0x688ffb74f98676a0LL),reale(-2234LL,0x213cc44f79d70LL),
       reale(-3037LL,0x1ac7bc3d32300LL),reale(-4214LL,0x4ec1eec81c090LL),
       reale(-5985LL,0x55e3357541ca0LL),reale(-8733LL,0x4677f29396db0LL),
       reale(-13153LL,0xe152303028a40LL),reale(-20567LL,0xb1e8ad3c3f8d0LL),
@@ -4777,19 +4777,19 @@ namespace GeographicLib {
       // C4[2], coeff of eps^28, polynomial in n of order 1
       real(0x40b1fa340LL),real(0x1068358d8LL),real(0x74e318fa9c07fLL),
       // C4[2], coeff of eps^27, polynomial in n of order 2
-      real(0x601aa15d00LL),real(-0x39c62a4580LL),real(0x2655784c18LL),
+      real(0x601aa15d00LL),-real(0x39c62a4580LL),real(0x2655784c18LL),
       real(0x4d882f0532d9e9LL),
       // C4[2], coeff of eps^26, polynomial in n of order 3
-      real(0x11462b92d913a0LL),real(-0xdd4620ebadc40LL),
+      real(0x11462b92d913a0LL),-real(0xdd4620ebadc40LL),
       real(0x5974730e46be0LL),real(0x16bcec57851ccLL),
       reale(33547LL,0x1cf91962af003LL),
       // C4[2], coeff of eps^25, polynomial in n of order 4
-      real(0xc83679b433c00LL),real(-0xb29b6d58dfb00LL),real(0x5f4e3bdd4de00LL),
-      real(-0x3affd9960e900LL),real(0x2665fb625f490LL),
+      real(0xc83679b433c00LL),-real(0xb29b6d58dfb00LL),real(0x5f4e3bdd4de00LL),
+      -real(0x3affd9960e900LL),real(0x2665fb625f490LL),
       reale(15809LL,0x8f200ee7e2a7dLL),
       // C4[2], coeff of eps^24, polynomial in n of order 5
-      real(0x67b92a8524a18e80LL),real(-0x609d7d3ca356ae00LL),
-      real(0x39db180d1b52d580LL),real(-0x2fa1e9183dec9700LL),
+      real(0x67b92a8524a18e80LL),-real(0x609d7d3ca356ae00LL),
+      real(0x39db180d1b52d580LL),-real(0x2fa1e9183dec9700LL),
       real(0x1294d8f2627edc80LL),real(0x4bc94ddbc9bad70LL),
       reale(0x15c1a09LL,0xc1b4051297e97LL),
       // C4[2], coeff of eps^23, polynomial in n of order 6
@@ -5084,22 +5084,22 @@ namespace GeographicLib {
       // C4[3], coeff of eps^29, polynomial in n of order 0
       real(594728LL),real(0x6a467061d7LL),
       // C4[3], coeff of eps^28, polynomial in n of order 1
-      real(-0xc171ac00LL),real(0x7522aaf0LL),real(0x17609e98859b3LL),
+      -real(0xc171ac00LL),real(0x7522aaf0LL),real(0x17609e98859b3LL),
       // C4[3], coeff of eps^27, polynomial in n of order 2
-      real(-0x15f49b7dd3600LL),real(0x7876e24c6900LL),real(0x1f5dd75c0b28LL),
+      -real(0x15f49b7dd3600LL),real(0x7876e24c6900LL),real(0x1f5dd75c0b28LL),
       reale(4837LL,0x68f14547adebLL),
       // C4[3], coeff of eps^26, polynomial in n of order 3
-      real(-0x33418e8004000LL),real(0x17b00d59dc000LL),
-      real(-0x11669ade1c000LL),real(0xa37322475bc0LL),
+      -real(0x33418e8004000LL),real(0x17b00d59dc000LL),
+      -real(0x11669ade1c000LL),real(0xa37322475bc0LL),
       reale(6709LL,0x6c31d1e089667LL),
       // C4[3], coeff of eps^25, polynomial in n of order 4
-      real(-0xc3e38d2fc36800LL),real(0x6a604d6faf7a00LL),
-      real(-0x650b3de948f400LL),real(0x20a6596010be00LL),
+      -real(0xc3e38d2fc36800LL),real(0x6a604d6faf7a00LL),
+      -real(0x650b3de948f400LL),real(0x20a6596010be00LL),
       real(0x88f534a1fae70LL),reale(275086LL,0x53fa9cf60167fLL),
       // C4[3], coeff of eps^24, polynomial in n of order 5
-      real(-0xdd5f9d233a5800LL),real(0x8b724926c9e000LL),
-      real(-0x8af41510346800LL),real(0x3d05686ce77000LL),
-      real(-0x2f9901c72df800LL),real(0x1ae74f29ea4ce0LL),
+      -real(0xdd5f9d233a5800LL),real(0x8b724926c9e000LL),
+      -real(0x8af41510346800LL),real(0x3d05686ce77000LL),
+      -real(0x2f9901c72df800LL),real(0x1ae74f29ea4ce0LL),
       reale(223345LL,0xf3eec944ed143LL),
       // C4[3], coeff of eps^23, polynomial in n of order 6
       reale(-81631LL,0x30aa006397400LL),reale(60811LL,0x59dd5ef6a6e00LL),
@@ -5256,7 +5256,7 @@ namespace GeographicLib {
       reale(-0xa26926LL,0xb993988ecc000LL),reale(0x269a8aLL,0x161dcdf222440LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^9, polynomial in n of order 20
-      real(-0x354d49acec3dd800LL),real(-0x606a7d34c50a0200LL),
+      -real(0x354d49acec3dd800LL),-real(0x606a7d34c50a0200LL),
       reale(-2940LL,0x23b8583df6400LL),reale(-5972LL,0x98e0d26252a00LL),
       reale(-13141LL,0x32060cd802000LL),reale(-32102LL,0x94515a4461600LL),
       reale(-90512LL,0xbf74565dcdc00LL),reale(-315894LL,0x3681a17ad4200LL),
@@ -5274,8 +5274,8 @@ namespace GeographicLib {
       reale(-491670LL,0xa42f82e6a24d0LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^8, polynomial in n of order 21
-      real(-0xd828cefda55a800LL),real(-0x16c6eac98e7b6000LL),
-      real(-0x27e1e798049c9800LL),real(-0x490330552dbbf000LL),
+      -real(0xd828cefda55a800LL),-real(0x16c6eac98e7b6000LL),
+      -real(0x27e1e798049c9800LL),-real(0x490330552dbbf000LL),
       reale(-2256LL,0x7715d478bf800LL),reale(-4648LL,0x773993ce08000LL),
       reale(-10391LL,0x2ec0caa9f0800LL),reale(-25837LL,0x32aa1d24f000LL),
       reale(-74325LL,0x3f4000f179800LL),reale(-265481LL,0xa31986dc6000LL),
@@ -5293,10 +5293,10 @@ namespace GeographicLib {
       reale(0x40d611LL,0xd55e5a0325120LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^7, polynomial in n of order 22
-      real(-0x38123cee860f400LL),real(-0x59d375c04e8be00LL),
-      real(-0x942bf86bd4c1800LL),real(-0xfcbda8858afb200LL),
-      real(-0x1c02af2dc3443c00LL),real(-0x33fc822f8d2b6600LL),
-      real(-0x65e35fc07de4e000LL),reale(-3415LL,0x3814d6814a600LL),
+      -real(0x38123cee860f400LL),-real(0x59d375c04e8be00LL),
+      -real(0x942bf86bd4c1800LL),-real(0xfcbda8858afb200LL),
+      -real(0x1c02af2dc3443c00LL),-real(0x33fc822f8d2b6600LL),
+      -real(0x65e35fc07de4e000LL),reale(-3415LL,0x3814d6814a600LL),
       reale(-7776LL,0xe3f177bd67c00LL),reale(-19732LL,0x95ce6ed10f200LL),
       reale(-58090LL,0x6b8e19ff25800LL),reale(-213112LL,0xea59cce39fe00LL),
       reale(-0x11614cLL,0x8811931d33400LL),
@@ -5312,11 +5312,11 @@ namespace GeographicLib {
       reale(-0x47ecefLL,0x2d1e65cb0cf50LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^6, polynomial in n of order 23
-      real(-0xe0ca252d14c000LL),real(-0x15a70af15f24000LL),
-      real(-0x222b3f817554000LL),real(-0x375f97b48cd8000LL),
-      real(-0x5c7b9631f8ac000LL),real(-0x9fe2527c7fcc000LL),
-      real(-0x11face3d5ef34000LL),real(-0x21e77d8dabde0000LL),
-      real(-0x439dcbf7fdccc000LL),reale(-2311LL,0xe8ce2f330c000LL),
+      -real(0xe0ca252d14c000LL),-real(0x15a70af15f24000LL),
+      -real(0x222b3f817554000LL),-real(0x375f97b48cd8000LL),
+      -real(0x5c7b9631f8ac000LL),-real(0x9fe2527c7fcc000LL),
+      -real(0x11face3d5ef34000LL),-real(0x21e77d8dabde0000LL),
+      -real(0x439dcbf7fdccc000LL),reale(-2311LL,0xe8ce2f330c000LL),
       reale(-5374LL,0xca11d3eaac000LL),reale(-13966LL,0xc6123cd18000LL),
       reale(-42248LL,0x5f55f4e354000LL),reale(-159931LL,0x5dce658a64000LL),
       reale(-887132LL,0x3edc05794c000LL),reale(-0xc191a8LL,0x9dbc8de510000LL),
@@ -5330,12 +5330,12 @@ namespace GeographicLib {
       reale(0x58ed14LL,0xa7a2901c3a740LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^5, polynomial in n of order 24
-      real(-0x32b69e04189800LL),real(-0x4bd39320660300LL),
-      real(-0x73a508e7ef1600LL),real(-0xb44a7ec206b900LL),
-      real(-0x1200d9d52c6d400LL),real(-0x1d916a5ad4bcf00LL),
-      real(-0x321a3f994641200LL),real(-0x57fce6d660f8500LL),
-      real(-0xa10c564a22b1000LL),real(-0x1356fa3ebba41b00LL),
-      real(-0x275fd13435900e00LL),real(-0x5604e2d76283d100LL),
+      -real(0x32b69e04189800LL),-real(0x4bd39320660300LL),
+      -real(0x73a508e7ef1600LL),-real(0xb44a7ec206b900LL),
+      -real(0x1200d9d52c6d400LL),-real(0x1d916a5ad4bcf00LL),
+      -real(0x321a3f994641200LL),-real(0x57fce6d660f8500LL),
+      -real(0xa10c564a22b1000LL),-real(0x1356fa3ebba41b00LL),
+      -real(0x275fd13435900e00LL),-real(0x5604e2d76283d100LL),
       reale(-3284LL,0x2070ad378b400LL),reale(-8784LL,0x7223f68ff1900LL),
       reale(-27452LL,0xebc1e860af600LL),reale(-107904LL,0x1b738290a6300LL),
       reale(-625733LL,0x1d5410be27800LL),reale(-0x902489LL,0x533e63f8bcd00LL),
@@ -5348,14 +5348,14 @@ namespace GeographicLib {
       reale(-0x3b0d6fcLL,0x8ae0c4d412ef8LL),
       reale(0x6af68d05eLL,0x1fa68a0342ac7LL),
       // C4[3], coeff of eps^4, polynomial in n of order 25
-      real(-0x30fab48eb2c00LL),real(-0x4779db0cde000LL),
-      real(-0x6a1a5308c1400LL),real(-0xa07c7893bf800LL),
-      real(-0xf7d15b087bc00LL),real(-0x1878e181999000LL),
-      real(-0x27ab652bf7a400LL),real(-0x422ed0b6682800LL),
-      real(-0x721448fff54c00LL),real(-0xcc1e5699294000LL),
-      real(-0x17d5829db9a3400LL),real(-0x2ed74923dde5800LL),
-      real(-0x61c84aba5ffdc00LL),real(-0xdbaa1b53c88f000LL),
-      real(-0x21cc8beefe3fc400LL),real(-0x5da8efb832aa8800LL),
+      -real(0x30fab48eb2c00LL),-real(0x4779db0cde000LL),
+      -real(0x6a1a5308c1400LL),-real(0xa07c7893bf800LL),
+      -real(0xf7d15b087bc00LL),-real(0x1878e181999000LL),
+      -real(0x27ab652bf7a400LL),-real(0x422ed0b6682800LL),
+      -real(0x721448fff54c00LL),-real(0xcc1e5699294000LL),
+      -real(0x17d5829db9a3400LL),-real(0x2ed74923dde5800LL),
+      -real(0x61c84aba5ffdc00LL),-real(0xdbaa1b53c88f000LL),
+      -real(0x21cc8beefe3fc400LL),-real(0x5da8efb832aa8800LL),
       reale(-4877LL,0xa27c79e8c9400LL),reale(-20083LL,0x744650f3b6000LL),
       reale(-123006LL,0x682eafd4bac00LL),reale(-0x1e42b0LL,0x9a1fba0274800LL),
       reale(0x1a279caLL,0x9c6669ee40400LL),
@@ -5366,15 +5366,15 @@ namespace GeographicLib {
       reale(-0x1210284LL,0xdf2faba442070LL),
       reale(0x23a784574LL,0xb53783566b8edLL),
       // C4[3], coeff of eps^3, polynomial in n of order 26
-      real(-0x10330cb256200LL),real(-0x172cb16211100LL),
-      real(-0x21a8187537800LL),real(-0x31b06260f1f00LL),
-      real(-0x4ab014ab28e00LL),real(-0x7280309c9cd00LL),
-      real(-0xb366eef7be400LL),real(-0x11ff8a58b05b00LL),
-      real(-0x1dae666558ba00LL),real(-0x327547ac4a0900LL),
-      real(-0x58c9207d125000LL),real(-0xa2826b77361700LL),
-      real(-0x137557a5841e600LL),real(-0x275355b4b1bc500LL),
-      real(-0x54b37d85300bc00LL),real(-0xc517d06239a5300LL),
-      real(-0x1f8f2f623d981200LL),real(-0x5b85a3034c390100LL),
+      -real(0x10330cb256200LL),-real(0x172cb16211100LL),
+      -real(0x21a8187537800LL),-real(0x31b06260f1f00LL),
+      -real(0x4ab014ab28e00LL),-real(0x7280309c9cd00LL),
+      -real(0xb366eef7be400LL),-real(0x11ff8a58b05b00LL),
+      -real(0x1dae666558ba00LL),-real(0x327547ac4a0900LL),
+      -real(0x58c9207d125000LL),-real(0xa2826b77361700LL),
+      -real(0x137557a5841e600LL),-real(0x275355b4b1bc500LL),
+      -real(0x54b37d85300bc00LL),-real(0xc517d06239a5300LL),
+      -real(0x1f8f2f623d981200LL),-real(0x5b85a3034c390100LL),
       reale(-5021LL,0x5d11943ced800LL),reale(-21966LL,0xb72ce88a8f100LL),
       reale(-144344LL,0xb3b965d7ac200LL),reale(-0x268b38LL,0x492c763e44300LL),
       reale(0x249ddb5LL,0x415c2de726c00LL),
@@ -5388,25 +5388,25 @@ namespace GeographicLib {
       // C4[4], coeff of eps^28, polynomial in n of order 1
       real(0x4b0c377a00LL),real(0x141ef9cec0LL),real(0x12e7203d54087bdLL),
       // C4[4], coeff of eps^27, polynomial in n of order 2
-      real(0xdf868e997000LL),real(-0xc54488fde800LL),real(0x67996a8dfb80LL),
+      real(0xdf868e997000LL),-real(0xc54488fde800LL),real(0x67996a8dfb80LL),
       reale(6219LL,0x86ed0fee71e5LL),
       // C4[4], coeff of eps^26, polynomial in n of order 3
-      real(0x1e30d5f17398800LL),real(-0x20335f44c005000LL),
+      real(0x1e30d5f17398800LL),-real(0x20335f44c005000LL),
       real(0x8656a9da59d800LL),real(0x246f3281df3200LL),
       reale(0x1c9038LL,0xea4bbbb5bea41LL),
       // C4[4], coeff of eps^25, polynomial in n of order 4
-      real(0x640278dc982000LL),real(-0x64de2b5e388800LL),
-      real(0x266cf1cb211000LL),real(-0x24af02897bd800LL),
+      real(0x640278dc982000LL),-real(0x64de2b5e388800LL),
+      real(0x266cf1cb211000LL),-real(0x24af02897bd800LL),
       real(0x125236c4932c80LL),reale(225070LL,0xa1cd0c0f186c5LL),
       // C4[4], coeff of eps^24, polynomial in n of order 5
-      real(0x183393315f62f400LL),real(-0x147c8a635ba4f000LL),
-      real(0xaadb07a361e2c00LL),real(-0xbd0a07cdca37800LL),
+      real(0x183393315f62f400LL),-real(0x147c8a635ba4f000LL),
+      real(0xaadb07a361e2c00LL),-real(0xbd0a07cdca37800LL),
       real(0x2c490db64a86400LL),real(0xc3000bbe3e2580LL),
       reale(0x7f11bdLL,0x62a2be2e87a79LL),
       // C4[4], coeff of eps^23, polynomial in n of order 6
       reale(7399LL,0xe4703b1ceb000LL),reale(-4926LL,0x8e7408af10800LL),
       reale(3656LL,0xc01290e152000LL),reale(-3595LL,0x651f510443800LL),
-      real(0x5080258211e79000LL),real(-0x5458466826cf9800LL),
+      real(0x5080258211e79000LL),-real(0x5458466826cf9800LL),
       real(0x27a09e95cf36b080LL),reale(0x5d628dfLL,0xc3bd6c206251LL),
       // C4[4], coeff of eps^22, polynomial in n of order 7
       reale(0x41e7a1LL,0xe5044c1364800LL),reale(-0x2279b3LL,0x3fbc5119cd000LL),
@@ -5657,22 +5657,22 @@ namespace GeographicLib {
       // C4[5], coeff of eps^29, polynomial in n of order 0
       real(0x2f6e00LL),real(0x4338129a0b3LL),
       // C4[5], coeff of eps^28, polynomial in n of order 1
-      real(-0x97662e0000LL),real(0x4701a0b000LL),real(0x171a7cbcbc0a5e7LL),
+      -real(0x97662e0000LL),real(0x4701a0b000LL),real(0x171a7cbcbc0a5e7LL),
       // C4[5], coeff of eps^27, polynomial in n of order 2
-      real(-0xb7a8cf8589000LL),real(0x25cdf8a9f5800LL),real(0xaa8ee05df480LL),
+      -real(0xb7a8cf8589000LL),real(0x25cdf8a9f5800LL),real(0xaa8ee05df480LL),
       reale(53207LL,0x4825dfa147919LL),
       // C4[5], coeff of eps^26, polynomial in n of order 3
-      real(-0x4519d2e6066000LL),real(0x17b1d503134000LL),
-      real(-0x1b53dc2d3c2000LL),real(0xc104a529c3b00LL),
+      -real(0x4519d2e6066000LL),real(0x17b1d503134000LL),
+      -real(0x1b53dc2d3c2000LL),real(0xc104a529c3b00LL),
       reale(207992LL,0x1a086a30a3679LL),
       // C4[5], coeff of eps^25, polynomial in n of order 4
-      real(-0xe48436400f9e000LL),real(0x825cbe3b5113800LL),
-      real(-0x9657faac8f9f000LL),real(0x1ac735d19d16800LL),
+      -real(0xe48436400f9e000LL),real(0x825cbe3b5113800LL),
+      -real(0x9657faac8f9f000LL),real(0x1ac735d19d16800LL),
       real(0x7b639e59c13780LL),reale(0x821f3cLL,0x2b5901ca2b961LL),
       // C4[5], coeff of eps^24, polynomial in n of order 5
-      real(-0x13b86e0d5c5dc000LL),real(0x135f9b0385fb0000LL),
-      real(-0x10df1064c3304000LL),real(0x58b0ae17a818000LL),
-      real(-0x70d05036b8ec000LL),real(0x2e5299a0b610e00LL),
+      -real(0x13b86e0d5c5dc000LL),real(0x135f9b0385fb0000LL),
+      -real(0x10df1064c3304000LL),real(0x58b0ae17a818000LL),
+      -real(0x70d05036b8ec000LL),real(0x2e5299a0b610e00LL),
       reale(0x9b4e92LL,0x2338af8e3405bLL),
       // C4[5], coeff of eps^23, polynomial in n of order 6
       reale(-126384LL,0xa0947ea9b1000LL),reale(192332LL,0x2215a4d90d800LL),
@@ -5791,7 +5791,7 @@ namespace GeographicLib {
       reale(0x11f3b6LL,0x79934ee544800LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^11, polynomial in n of order 18
-      real(-0x274a66713f785000LL),real(-0x78cbe0a9df914800LL),
+      -real(0x274a66713f785000LL),-real(0x78cbe0a9df914800LL),
       reale(-6987LL,0xa32f129098000LL),reale(-31981LL,0x453597ca04800LL),
       reale(-217575LL,0x823be2c7b5000LL),reale(-0x3b3fa5LL,0xd12282532d800LL),
       reale(0x3821f86LL,0xdc7c0f67f2000LL),
@@ -5809,8 +5809,8 @@ namespace GeographicLib {
       reale(-0x10e331LL,0x73d31536c1e80LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^10, polynomial in n of order 19
-      real(-0x3bd4906e474e000LL),real(-0x97941b80ce3c000LL),
-      real(-0x1a66716bc5afa000LL),real(-0x532298a0bc3e0000LL),
+      -real(0x3bd4906e474e000LL),-real(0x97941b80ce3c000LL),
+      -real(0x1a66716bc5afa000LL),-real(0x532298a0bc3e0000LL),
       reale(-4940LL,0xf256daf8ba000LL),reale(-23309LL,0x879c08dc7c000LL),
       reale(-164255LL,0xaa736f110e000LL),reale(-0x2ea1f9LL,0xf31091a018000LL),
       reale(0x2e81dd2LL,0xafc6204b42000LL),
@@ -5824,9 +5824,9 @@ namespace GeographicLib {
       reale(-0xf7e7fcLL,0x7235d22a26000LL),reale(0x168d3dLL,0xdae92a7065f00LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^9, polynomial in n of order 20
-      real(-0x69d018a3b9e000LL),real(-0xed437c3919a800LL),
-      real(-0x237e48279feb000LL),real(-0x5bea2151a0b3800LL),
-      real(-0x10666acb6ec18000LL),real(-0x350c7e1643d3c800LL),
+      -real(0x69d018a3b9e000LL),-real(0xed437c3919a800LL),
+      -real(0x237e48279feb000LL),-real(0x5bea2151a0b3800LL),
+      -real(0x10666acb6ec18000LL),-real(0x350c7e1643d3c800LL),
       reale(-3248LL,0x1d418b40bb000LL),reale(-15861LL,0xd9725e65aa800LL),
       reale(-116264LL,0xa1b86f476e000LL),reale(-0x229587LL,0x7ceb4904e1800LL),
       reale(0x24855b7LL,0xecf46ee8e1000LL),
@@ -5840,11 +5840,11 @@ namespace GeographicLib {
       reale(0x1f06cdLL,0xc3307b9c44800LL),reale(-0x4821ccLL,0xfdf7c75745180LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^8, polynomial in n of order 21
-      real(-0xc09a6adbf4000LL),real(-0x18cab6e3030000LL),
-      real(-0x359d0ace62c000LL),real(-0x7ab7d9cc438000LL),
-      real(-0x12c67ab580a4000LL),real(-0x31d5f1c0d1c0000LL),
-      real(-0x9233f1c13ddc000LL),real(-0x1e779de654b48000LL),
-      real(-0x789f22a00b054000LL),reale(-9797LL,0xe5d83adcb0000LL),
+      -real(0xc09a6adbf4000LL),-real(0x18cab6e3030000LL),
+      -real(0x359d0ace62c000LL),-real(0x7ab7d9cc438000LL),
+      -real(0x12c67ab580a4000LL),-real(0x31d5f1c0d1c0000LL),
+      -real(0x9233f1c13ddc000LL),-real(0x1e779de654b48000LL),
+      -real(0x789f22a00b054000LL),reale(-9797LL,0xe5d83adcb0000LL),
       reale(-75090LL,0x51f88f9574000LL),reale(-0x178b5aLL,0x9c7032b3a8000LL),
       reale(0x1a82b31LL,0x1e96e700fc000LL),
       reale(-0x87b6e90LL,0x2c52914720000LL),
@@ -5857,12 +5857,12 @@ namespace GeographicLib {
       reale(-0x1ed5c63LL,0x42391cb69c000LL),reale(433029LL,0xe4d3ce78fba00LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^7, polynomial in n of order 22
-      real(-0x1441fa2f35000LL),real(-0x272c726527800LL),
-      real(-0x4ebdd7b856000LL),real(-0xa564301b74800LL),
-      real(-0x16d6333bd37000LL),real(-0x3580dec1951800LL),
-      real(-0x865ae53c178000LL),real(-0x16ec61d7f65e800LL),
-      real(-0x455fa2e228b9000LL),real(-0xef77f4cbfa3b800LL),
-      real(-0x3d9c6e708569a000LL),reale(-5231LL,0x75aee04377800LL),
+      -real(0x1441fa2f35000LL),-real(0x272c726527800LL),
+      -real(0x4ebdd7b856000LL),-real(0xa564301b74800LL),
+      -real(0x16d6333bd37000LL),-real(0x3580dec1951800LL),
+      -real(0x865ae53c178000LL),-real(0x16ec61d7f65e800LL),
+      -real(0x455fa2e228b9000LL),-real(0xef77f4cbfa3b800LL),
+      -real(0x3d9c6e708569a000LL),reale(-5231LL,0x75aee04377800LL),
       reale(-42197LL,0x3024573145000LL),reale(-920787LL,0xa857f3b1a800LL),
       reale(0x1102cbfLL,0x2fc56aab44000LL),
       reale(-0x5f6de95LL,0xa18dfcd50d800LL),
@@ -5875,12 +5875,12 @@ namespace GeographicLib {
       reale(-0x22a7afaLL,0xbd91e6d784780LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^6, polynomial in n of order 23
-      real(-0x1b5badebe000LL),real(-0x326332ca4000LL),real(-0x5fd1bd93a000LL),
-      real(-0xbcd8e5378000LL),real(-0x1837bef256000LL),
-      real(-0x3404424ccc000LL),real(-0x75bf8cd1d2000LL),
-      real(-0x11b50d05060000LL),real(-0x2dc96f11f6e000LL),
-      real(-0x811a6e895f4000LL),real(-0x195036bc82ea000LL),
-      real(-0x5af70d135548000LL),real(-0x187d57cdaa406000LL),
+      -real(0x1b5badebe000LL),-real(0x326332ca4000LL),-real(0x5fd1bd93a000LL),
+      -real(0xbcd8e5378000LL),-real(0x1837bef256000LL),
+      -real(0x3404424ccc000LL),-real(0x75bf8cd1d2000LL),
+      -real(0x11b50d05060000LL),-real(0x2dc96f11f6e000LL),
+      -real(0x811a6e895f4000LL),-real(0x195036bc82ea000LL),
+      -real(0x5af70d135548000LL),-real(0x187d57cdaa406000LL),
       reale(-2190LL,0xcd2c6639e4000LL),reale(-18743LL,0xc7a34bd57e000LL),
       reale(-438376LL,0x295778dfd0000LL),reale(0x8cc26dLL,0x89f7eb41e2000LL),
       reale(-0x36a2869LL,0x2376664bc000LL),
@@ -5892,13 +5892,13 @@ namespace GeographicLib {
       reale(-0x163b453LL,0x6175bf8f16300LL),
       reale(0xa815b9093LL,0xe897fd72d67cbLL),
       // C4[5], coeff of eps^5, polynomial in n of order 24
-      real(-0x15f6510c000LL),real(-0x26e7bc2d800LL),real(-0x46d3779b000LL),
-      real(-0x84e1d0c0800LL),real(-0x101cbc30a000LL),real(-0x2073376e3800LL),
-      real(-0x442adb8b9000LL),real(-0x963884ff6800LL),real(-0x15dbd71e08000LL),
-      real(-0x363ebc6d59800LL),real(-0x9122bbd857000LL),
-      real(-0x1a90a4ab06c800LL),real(-0x56f0a68cd06000LL),
-      real(-0x147a29992a8f800LL),real(-0x5d1402e6c175000LL),
-      real(-0x228e263277d22800LL),reale(-5079LL,0xa7b39ec4fc000LL),
+      -real(0x15f6510c000LL),-real(0x26e7bc2d800LL),-real(0x46d3779b000LL),
+      -real(0x84e1d0c0800LL),-real(0x101cbc30a000LL),-real(0x2073376e3800LL),
+      -real(0x442adb8b9000LL),-real(0x963884ff6800LL),-real(0x15dbd71e08000LL),
+      -real(0x363ebc6d59800LL),-real(0x9122bbd857000LL),
+      -real(0x1a90a4ab06c800LL),-real(0x56f0a68cd06000LL),
+      -real(0x147a29992a8f800LL),-real(0x5d1402e6c175000LL),
+      -real(0x228e263277d22800LL),reale(-5079LL,0xa7b39ec4fc000LL),
       reale(-128864LL,0xff6ddcc67a800LL),reale(0x2d8172LL,0xd360aa0ed000LL),
       reale(-0x13c02eeLL,0xa44199bee7800LL),
       reale(0x48aec0dLL,0x519df32cfe000LL),
@@ -5912,15 +5912,15 @@ namespace GeographicLib {
       // C4[6], coeff of eps^28, polynomial in n of order 1
       real(0x3c8190000LL),real(0x11d12e000LL),real(0x219ae3fb400f15LL),
       // C4[6], coeff of eps^27, polynomial in n of order 2
-      real(0x642bf3240000LL),real(-0x876551ce0000LL),real(0x350bfa156000LL),
+      real(0x642bf3240000LL),-real(0x876551ce0000LL),real(0x350bfa156000LL),
       reale(4837LL,0x68f14547adebLL),
       // C4[6], coeff of eps^26, polynomial in n of order 3
-      real(0x297e6b0e9e1000LL),real(-0x2e90de909aa000LL),
+      real(0x297e6b0e9e1000LL),-real(0x2e90de909aa000LL),
       real(0x6148b0a84b000LL),real(0x1d77336bca600LL),
       reale(207992LL,0x1a086a30a3679LL),
       // C4[6], coeff of eps^25, polynomial in n of order 4
-      real(0x10bc6a9e4ee30000LL),real(-0xc179e3d40c9c000LL),
-      real(0x3edf483df118000LL),real(-0x5c91fff78634000LL),
+      real(0x10bc6a9e4ee30000LL),-real(0xc179e3d40c9c000LL),
+      real(0x3edf483df118000LL),-real(0x5c91fff78634000LL),
       real(0x216fdab58654400LL),reale(0x99c7d2LL,0xbedd8dc0620e7LL),
       // C4[6], coeff of eps^24, polynomial in n of order 5
       reale(17715LL,0xdb1cfba26000LL),reale(-7690LL,0x66892806b8000LL),
@@ -6143,17 +6143,17 @@ namespace GeographicLib {
       // C4[7], coeff of eps^29, polynomial in n of order 0
       real(0x30c152000LL),real(0x90e6983c364f3dLL),
       // C4[7], coeff of eps^28, polynomial in n of order 1
-      real(-323414LL<<20),real(0x1b9da04000LL),real(0xcf8f801ee602cdLL),
+      -real(323414LL<<20),real(0x1b9da04000LL),real(0xcf8f801ee602cdLL),
       // C4[7], coeff of eps^27, polynomial in n of order 2
-      real(-0xd09e1c29LL<<20),real(0x12ca6fb180000LL),real(0x6038c37fa000LL),
+      -real(0xd09e1c29LL<<20),real(0x12ca6fb180000LL),real(0x6038c37fa000LL),
       reale(72555LL,0x626230f3330c5LL),
       // C4[7], coeff of eps^26, polynomial in n of order 3
-      real(-0x2af5689902LL<<20),real(0xf13527954LL<<20),
-      real(-0x183402f656LL<<20),real(0x7c00d0f2b78000LL),
+      -real(0x2af5689902LL<<20),real(0xf13527954LL<<20),
+      -real(0x183402f656LL<<20),real(0x7c00d0f2b78000LL),
       reale(0x2f9b09LL,0x867e38d993117LL),
       // C4[7], coeff of eps^25, polynomial in n of order 4
-      real(-0x64d0a86bae7c0000LL),real(0x7c07ce24c65f0000LL),
-      real(-0x739ece76489e0000LL),real(0x6e7bce15f550000LL),
+      -real(0x64d0a86bae7c0000LL),real(0x7c07ce24c65f0000LL),
+      -real(0x739ece76489e0000LL),real(0x6e7bce15f550000LL),
       real(0x24fc420030b8400LL),reale(0x79fd486LL,0x8a371ad88dcafLL),
       // C4[7], coeff of eps^24, polynomial in n of order 5
       reale(-5991LL,0x42dcd933c0000LL),reale(14992LL,0xef80deedLL<<20),
@@ -6261,7 +6261,7 @@ namespace GeographicLib {
       reale(-163222LL,0x1f5352d1c0000LL),reale(-0x1225fcLL,0x8993dd9f5d000LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^12, polynomial in n of order 17
-      real(-0x13bc5107d5fLL<<20),real(-0x75f6b32585LL<<24),
+      -real(0x13bc5107d5fLL<<20),-real(0x75f6b32585LL<<24),
       reale(-17218LL,0x7dbad4ffLL<<20),reale(-426470LL,0xbd931c8aLL<<20),
       reale(0x8f9bafLL,0x43ffc94dLL<<20),reale(-0x39817fbLL,0xf009fa44LL<<20),
       reale(0xb9bb58dLL,0x6d6ce16bLL<<20),reale(-0x1509419eLL,0xc15c8beLL<<20),
@@ -6273,8 +6273,8 @@ namespace GeographicLib {
       reale(-0x928681LL,0x6ebd74d1LL<<20),reale(502063LL,0xa52218333a000LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^11, polynomial in n of order 18
-      real(-0x98838ab2280000LL),real(-0x25e72e362c40000LL),
-      real(-0xb4eb768b34LL<<20),real(-0x4616f301f1bc0000LL),
+      -real(0x98838ab2280000LL),-real(0x25e72e362c40000LL),
+      -real(0xb4eb768b34LL<<20),-real(0x4616f301f1bc0000LL),
       reale(-10660LL,0x17f0af3a80000LL),reale(-276844LL,0xeaf150cc0000LL),
       reale(0x628feeLL,0x1955d6d9LL<<20),reale(-0x2a3b5a2LL,0xdcad2d7d40000LL),
       reale(0x94c6c4bLL,0xf835425780000LL),
@@ -6288,9 +6288,9 @@ namespace GeographicLib {
       reale(-0x3c855fLL,0x343f7404e9000LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^10, polynomial in n of order 19
-      real(-0x6597eabbLL<<20),real(-0x1448d4182LL<<20),
-      real(-0x4866a1e49LL<<20),real(-0x1295eca79LL<<24),
-      real(-0x5bf59820d7LL<<20),real(-0x251667dfd9eLL<<20),
+      -real(0x6597eabbLL<<20),-real(0x1448d4182LL<<20),
+      -real(0x4866a1e49LL<<20),-real(0x1295eca79LL<<24),
+      -real(0x5bf59820d7LL<<20),-real(0x251667dfd9eLL<<20),
       reale(-5904LL,0xd0f54b9bLL<<20),reale(-161528LL,0x78562a54LL<<20),
       reale(0x3d21c2LL,0x4bcc950dLL<<20),reale(-0x1c31d50LL,0x638e5e46LL<<20),
       reale(0x6cf9729LL,0x8be6b97fLL<<20),reale(-0xfd832e7LL,0xe1ce6c38LL<<20),
@@ -6301,10 +6301,10 @@ namespace GeographicLib {
       reale(-0xc41e5eLL,0xafca6147LL<<20),reale(-602477LL,0xa03d7c8f54000LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^9, polynomial in n of order 20
-      real(-0x48a0a3640000LL),real(-0xc9814e4b0000LL),real(-0x25c525dfa0000LL),
-      real(-0x7c4fe70d90000LL),real(-0x1ca738085LL<<20),
-      real(-0x7a02179d470000LL),real(-0x274586580a60000LL),
-      real(-0x10907db87bd50000LL),reale(-2774LL,0x6efa5dac40000LL),
+      -real(0x48a0a3640000LL),-real(0xc9814e4b0000LL),-real(0x25c525dfa0000LL),
+      -real(0x7c4fe70d90000LL),-real(0x1ca738085LL<<20),
+      -real(0x7a02179d470000LL),-real(0x274586580a60000LL),
+      -real(0x10907db87bd50000LL),reale(-2774LL,0x6efa5dac40000LL),
       reale(-80425LL,0xffb54a33d0000LL),reale(0x209010LL,0xd8c3d9bae0000LL),
       reale(-0x10469ddLL,0x78f6777af0000LL),
       reale(0x4577ed4LL,0xce98cb3d80000LL),
@@ -6317,11 +6317,11 @@ namespace GeographicLib {
       reale(-0x16d9d9cLL,0x8a3809d99cc00LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^8, polynomial in n of order 21
-      real(-0x2d470940000LL),real(-0x71ae7bLL<<20),real(-0x12ee0a8c0000LL),
-      real(-0x360310f80000LL),real(-0xa6fff6c40000LL),real(-0x23849d7cLL<<20),
-      real(-0x87e0edbbc0000LL),real(-0x25a8132a880000LL),
-      real(-0xcadd965ff40000LL),real(-0x59fdf46f7dLL<<20),
-      real(-0x3e4f1a2b29ec0000LL),reale(-30848LL,0x62a4d51e80000LL),
+      -real(0x2d470940000LL),-real(0x71ae7bLL<<20),-real(0x12ee0a8c0000LL),
+      -real(0x360310f80000LL),-real(0xa6fff6c40000LL),-real(0x23849d7cLL<<20),
+      -real(0x87e0edbbc0000LL),-real(0x25a8132a880000LL),
+      -real(0xcadd965ff40000LL),-real(0x59fdf46f7dLL<<20),
+      -real(0x3e4f1a2b29ec0000LL),reale(-30848LL,0x62a4d51e80000LL),
       reale(882325LL,0x7fea51fdc0000LL),reale(-0x759934LL,0x3a79442LL<<20),
       reale(0x22e2ad0LL,0x28af9d6e40000LL),
       reale(-0x697b063LL,0x8d593f0580000LL),
@@ -6333,11 +6333,11 @@ namespace GeographicLib {
       reale(-0xb902a6LL,0xf8d56ac47a800LL),
       reale(0xe534e50c9LL,0xb18970e26a4cfLL),
       // C4[7], coeff of eps^7, polynomial in n of order 22
-      real(-0x1190ae0000LL),real(-0x28e92d0000LL),real(-0x63f2a40000LL),
-      real(-0x101b8fb0000LL),real(-0x2c2c61a0000LL),real(-0x8210e690000LL),
-      real(-0x1a03615LL<<20),real(-0x5bebf1b70000LL),real(-0x16e928a860000LL),
-      real(-0x6a5f183250000LL),real(-0x25b29487fc0000LL),
-      real(-0x11b5c31caf30000LL),real(-0xd14cd352ff20000LL),
+      -real(0x1190ae0000LL),-real(0x28e92d0000LL),-real(0x63f2a40000LL),
+      -real(0x101b8fb0000LL),-real(0x2c2c61a0000LL),-real(0x8210e690000LL),
+      -real(0x1a03615LL<<20),-real(0x5bebf1b70000LL),-real(0x16e928a860000LL),
+      -real(0x6a5f183250000LL),-real(0x25b29487fc0000LL),
+      -real(0x11b5c31caf30000LL),-real(0xd14cd352ff20000LL),
       reale(-6970LL,0x4e82e769f0000LL),reale(216834LL,0xe733e07580000LL),
       reale(-0x1fd87cLL,0xeacaf9510000LL),reale(0xa93ca1LL,0x4b9d7f7a20000LL),
       reale(-0x2484521LL,0x566041ce30000LL),
@@ -6352,20 +6352,20 @@ namespace GeographicLib {
       // C4[8], coeff of eps^28, polynomial in n of order 1
       real(0x11c82fLL<<20),real(0x60ae460000LL),real(0x21ffb4a731cf423fLL),
       // C4[8], coeff of eps^27, polynomial in n of order 2
-      real(0x4fc786eLL<<20),real(-0x837a8d5LL<<20),real(0x259df8d30000LL),
+      real(0x4fc786eLL<<20),-real(0x837a8d5LL<<20),real(0x259df8d30000LL),
       reale(4837LL,0x68f14547adebLL),
       // C4[8], coeff of eps^26, polynomial in n of order 3
-      real(0x329e2a986cLL<<20),real(-0x285690bb68LL<<20),
+      real(0x329e2a986cLL<<20),-real(0x285690bb68LL<<20),
       real(0x10193db64LL<<20),real(0x5c4a2579a0000LL),
       reale(0x35f3f9LL,0xba8f0d3ad9e09LL),
       // C4[8], coeff of eps^25, polynomial in n of order 4
-      reale(4480LL,0xf38d93cLL<<20),real(-0x5f0bc8cec07LL<<20),
-      real(0x33002b9943eLL<<20),real(-0x51d1e6f78cdLL<<20),
+      reale(4480LL,0xf38d93cLL<<20),-real(0x5f0bc8cec07LL<<20),
+      real(0x33002b9943eLL<<20),-real(0x51d1e6f78cdLL<<20),
       real(0x14fb331d33f30000LL),reale(0x8a412feLL,0xe0e91e6ce4f71LL),
       // C4[8], coeff of eps^24, polynomial in n of order 5
       reale(226427LL,0x3825b25420000LL),reale(-36731LL,0x39e1166a80000LL),
       reale(116830LL,0x2c3ad768e0000LL),reale(-76967LL,0xf6da987d40000LL),
-      real(-0x2a948e8d73a60000LL),real(-0x116572b5168a4000LL),
+      -real(0x2a948e8d73a60000LL),-real(0x116572b5168a4000LL),
       reale(0x13fb6bed6LL,0x81b165bd17b55LL),
       // C4[8], coeff of eps^23, polynomial in n of order 6
       reale(151394LL,0xe6754a3fLL<<20),reale(-105724LL,0xd536926a80000LL),
@@ -6543,18 +6543,18 @@ namespace GeographicLib {
       // C4[9], coeff of eps^29, polynomial in n of order 0
       real(0x41cf0000LL),real(0x3d2e2985830503LL),
       // C4[9], coeff of eps^28, polynomial in n of order 1
-      real(-0x195c48LL<<20),real(0x687f5c0000LL),real(0x438da32e1600335LL),
+      -real(0x195c48LL<<20),real(0x687f5c0000LL),real(0x438da32e1600335LL),
       // C4[9], coeff of eps^27, polynomial in n of order 2
-      real(-0x174d38452LL<<20),real(-0x24810c5LL<<20),real(-0xe4960490000LL),
+      -real(0x174d38452LL<<20),-real(0x24810c5LL<<20),-real(0xe4960490000LL),
       reale(161925LL,0x30e683ffe0741LL),
       // C4[9], coeff of eps^26, polynomial in n of order 3
-      real(-0x8a9317724LL<<20),real(0x6cfa364f8LL<<20),
-      real(-0xa2b1dc5ccLL<<20),real(0x2561f1223e0000LL),
+      -real(0x8a9317724LL<<20),real(0x6cfa364f8LL<<20),
+      -real(0xa2b1dc5ccLL<<20),real(0x2561f1223e0000LL),
       reale(0x1419a3LL,0x4f8aa089603a9LL),
       // C4[9], coeff of eps^25, polynomial in n of order 4
-      real(-0x2969ddb5824LL<<20),reale(3279LL,0x51285681LL<<20),
-      real(-0x6e93a3242f2LL<<20),real(-0x48275b7b75LL<<20),
-      real(-0x1f18264b9990000LL),reale(0x9a85177LL,0x379b22013c233LL),
+      -real(0x2969ddb5824LL<<20),reale(3279LL,0x51285681LL<<20),
+      -real(0x6e93a3242f2LL<<20),-real(0x48275b7b75LL<<20),
+      -real(0x1f18264b9990000LL),reale(0x9a85177LL,0x379b22013c233LL),
       // C4[9], coeff of eps^24, polynomial in n of order 5
       reale(-133857LL,0xe363482LL<<24),reale(223946LL,0xb024018LL<<24),
       reale(-32029LL,0xe8f5e8eLL<<24),reale(48931LL,0x82bd2cLL<<24),
@@ -6646,7 +6646,7 @@ namespace GeographicLib {
       reale(-0x57c159LL,0x2f3d9b36LL<<20),reale(119914LL,0x778fad9290000LL),
       reale(0x12254110ffLL,0x7a7ae451fe1d3LL),
       // C4[9], coeff of eps^13, polynomial in n of order 16
-      real(-0x399266be8d8LL<<20),reale(-30245LL,0x1f85840780000LL),
+      -real(0x399266be8d8LL<<20),reale(-30245LL,0x1f85840780000LL),
       reale(913230LL,0x8c812ed3LL<<20),reale(-0x7f81b0LL,0x508faab680000LL),
       reale(0x2727214LL,0x60c0bdeLL<<20),reale(-0x781e515LL,0x65819f580000LL),
       reale(0xf11254cLL,0xec1a46a9LL<<20),
@@ -6658,8 +6658,8 @@ namespace GeographicLib {
       reale(0x62d0c8LL,0xeb9461c080000LL),reale(-0x317e9eLL,0x9a2850efa8000LL),
       reale(0x12254110ffLL,0x7a7ae451fe1d3LL),
       // C4[9], coeff of eps^12, polynomial in n of order 17
-      real(-0x49a1015c4LL<<20),real(-0x24465af3cLL<<24),
-      real(-0x1bf34980cbcLL<<20),reale(-15429LL,0x36b38ef8LL<<20),
+      -real(0x49a1015c4LL<<20),-real(0x24465af3cLL<<24),
+      -real(0x1bf34980cbcLL<<20),reale(-15429LL,0x36b38ef8LL<<20),
       reale(492912LL,0x78bf270cLL<<20),reale(-0x497a24LL,0x5671033LL<<24),
       reale(0x1863880LL,0xf60b314LL<<20),reale(-0x525f99dLL,0xe1a84668LL<<20),
       reale(0xbb9caeaLL,0xcc39c4dcLL<<20),reale(-0x1216a8ebLL,0x37a6362LL<<24),
@@ -6670,8 +6670,8 @@ namespace GeographicLib {
       reale(-0x4d8bb7LL,0xbe26d37cLL<<20),reale(-749749LL,0x9f9678dfe0000LL),
       reale(0x12254110ffLL,0x7a7ae451fe1d3LL),
       // C4[9], coeff of eps^11, polynomial in n of order 18
-      real(-0xdc9b5f1LL<<20),real(-0x461438ca80000LL),real(-0x1b32457c8LL<<20),
-      real(-0xdfda7610580000LL),real(-0xb4fb8c3a9fLL<<20),
+      -real(0xdc9b5f1LL<<20),-real(0x461438ca80000LL),-real(0x1b32457c8LL<<20),
+      -real(0xdfda7610580000LL),-real(0xb4fb8c3a9fLL<<20),
       reale(-6591LL,0x8d2c3ccf80000LL),reale(223861LL,0x20c31aaLL<<20),
       reale(-0x23cfe5LL,0x9404a6d480000LL),reale(0xcea485LL,0xe6baed33LL<<20),
       reale(-0x30392e7LL,0x1c35eb2980000LL),
@@ -6685,9 +6685,9 @@ namespace GeographicLib {
       reale(-0x105153aLL,0xfa056b19b8000LL),
       reale(0x12254110ffLL,0x7a7ae451fe1d3LL),
       // C4[9], coeff of eps^10, polynomial in n of order 19
-      real(-0x1070a6LL<<20),real(-0x41a48cLL<<20),real(-0x128e0c2LL<<20),
-      real(-0x6214a6LL<<24),real(-0x27bd427eLL<<20),real(-0x15709aa34LL<<20),
-      real(-0x124688a69aLL<<20),real(-0x2c21e34ecc8LL<<20),
+      -real(0x1070a6LL<<20),-real(0x41a48cLL<<20),-real(0x128e0c2LL<<20),
+      -real(0x6214a6LL<<24),-real(0x27bd427eLL<<20),-real(0x15709aa34LL<<20),
+      -real(0x124688a69aLL<<20),-real(0x2c21e34ecc8LL<<20),
       reale(25645LL,0xc7a2622aLL<<20),reale(-290250LL,0x8f434524LL<<20),
       reale(0x1becd4LL,0x97e8c70eLL<<20),reale(-0x73c9baLL,0xa17642dLL<<24),
       reale(0x1540010LL,0x9cff752LL<<20),reale(-0x2dcd0eaLL,0x98d4e37cLL<<20),
@@ -6696,10 +6696,10 @@ namespace GeographicLib {
       reale(0xeb57a3LL,0x2d0d24deLL<<20),reale(-0x24c5b2LL,0x80f5f23d50000LL),
       reale(0x60c6b05aaLL,0x7e28f6c5ff5f1LL),
       // C4[9], coeff of eps^9, polynomial in n of order 20
-      real(-33150LL<<20),real(-0x1b96a80000LL),real(-421083LL<<20),
-      real(-0x1a9b6380000LL),real(-0x7d3598LL<<20),real(-0x2b3428c80000LL),
-      real(-0x125c9155LL<<20),real(-0xa7172a8580000LL),
-      real(-0x97062b5b2LL<<20),real(-0x1855be7c6ee80000LL),
+      -real(33150LL<<20),-real(0x1b96a80000LL),-real(421083LL<<20),
+      -real(0x1a9b6380000LL),-real(0x7d3598LL<<20),-real(0x2b3428c80000LL),
+      -real(0x125c9155LL<<20),-real(0xa7172a8580000LL),
+      -real(0x97062b5b2LL<<20),-real(0x1855be7c6ee80000LL),
       reale(15220LL,0x65c177b1LL<<20),reale(-187211LL,0x1c678c9880000LL),
       reale(0x13ce4bLL,0x7f543134LL<<20),reale(-0x5b9a1eLL,0xd31a9c6f80000LL),
       reale(0x131570bLL,0xeafca137LL<<20),
@@ -6712,18 +6712,18 @@ namespace GeographicLib {
       // C4[10], coeff of eps^29, polynomial in n of order 0
       real(0x1b7580000LL),real(0x168a4531304537LL),
       // C4[10], coeff of eps^28, polynomial in n of order 1
-      real(-0x3d4bdcLL<<20),real(-0x19bc9880000LL),
+      -real(0x3d4bdcLL<<20),-real(0x19bc9880000LL),
       reale(3807LL,0xdf0925caacfb9LL),
       // C4[10], coeff of eps^27, polynomial in n of order 2
-      real(0x4af0b8bLL<<24),real(-0x656d09e8LL<<20),real(0x1509670680000LL),
+      real(0x4af0b8bLL<<24),-real(0x656d09e8LL<<20),real(0x1509670680000LL),
       reale(59656LL,0xa639fabc960fdLL),
       // C4[10], coeff of eps^26, polynomial in n of order 3
-      real(0x1b00e3838d2LL<<20),real(-0xbe74a11c34LL<<20),
-      real(-0xd93dbb0baLL<<20),real(-0x66c4e2e4040000LL),
+      real(0x1b00e3838d2LL<<20),-real(0xbe74a11c34LL<<20),
+      -real(0xd93dbb0baLL<<20),-real(0x66c4e2e4040000LL),
       reale(0x1604813LL,0x49a60b16d9e77LL),
       // C4[10], coeff of eps^25, polynomial in n of order 4
-      real(0x3079591638LL<<24),real(-0x393657246LL<<24),
-      real(0xc9608c29cLL<<24),real(-0xe7b0dee42LL<<24),
+      real(0x3079591638LL<<24),-real(0x393657246LL<<24),
+      real(0xc9608c29cLL<<24),-real(0xe7b0dee42LL<<24),
       real(0x29d42cfe52LL<<20),reale(0x1865db4LL,0x820b055e82c23LL),
       // C4[10], coeff of eps^24, polynomial in n of order 5
       reale(0x1446d7LL,0x787f059LL<<24),reale(-550963LL,0xcb73f54LL<<24),
@@ -6858,14 +6858,14 @@ namespace GeographicLib {
       reale(0x16fb8eeLL,0xf664899ae0000LL),
       reale(0x140e3a711aLL,0x5ef39e09c8055LL),
       // C4[11], coeff of eps^29, polynomial in n of order 0
-      real(-0x1f26080000LL),real(0xbdc79d6e266b55fLL),
+      -real(0x1f26080000LL),real(0xbdc79d6e266b55fLL),
       // C4[11], coeff of eps^28, polynomial in n of order 1
-      real(-0x20b454LL<<24),real(0x62986bLL<<20),real(0x56e2cdab4666fea1LL),
+      -real(0x20b454LL<<24),real(0x62986bLL<<20),real(0x56e2cdab4666fea1LL),
       // C4[11], coeff of eps^27, polynomial in n of order 2
-      real(-0x672444eLL<<24),real(-0xa80833LL<<24),real(-0x5828e0280000LL),
+      -real(0x672444eLL<<24),-real(0xa80833LL<<24),-real(0x5828e0280000LL),
       reale(65338LL,0x3c271ece8bf8fLL),
       // C4[11], coeff of eps^26, polynomial in n of order 3
-      real(-0x6f59afcLL<<28),real(0x9613a65LL<<32),real(-0x980d63f4LL<<28),
+      -real(0x6f59afcLL<<28),real(0x9613a65LL<<32),-real(0x980d63f4LL<<28),
       real(0x18d56ad118LL<<20),reale(0x12c1778LL,0xb9ff38da93b23LL),
       // C4[11], coeff of eps^25, polynomial in n of order 4
       reale(-768829LL,233799LL<<28),reale(0x24b2b3LL,0x9d2b5a4LL<<24),
@@ -6957,7 +6957,7 @@ namespace GeographicLib {
       reale(-0x1a0fd8LL,0x25c9d5LL<<28),reale(-691966LL,0x8d060e02LL<<20),
       reale(0x15f733d135LL,0x436c57c191ed7LL),
       // C4[11], coeff of eps^13, polynomial in n of order 16
-      real(-0xbc4739e8LL<<24),real(-0x2058be1d1f8LL<<20),
+      -real(0xbc4739e8LL<<24),-real(0x2058be1d1f8LL<<20),
       reale(21507LL,0xd2cf265LL<<24),reale(-280153LL,0xf868d618LL<<20),
       reale(0x1f3a9fLL,0x92ccb12LL<<24),reale(-0x97320aLL,0xf19bf728LL<<20),
       reale(0x20b2df2LL,0x89df7fLL<<24),reale(-0x53f6d2bLL,0x6ec4d738LL<<20),
@@ -6968,8 +6968,8 @@ namespace GeographicLib {
       reale(-0xc5220eLL,0x88f9c58840000LL),
       reale(0x15f733d135LL,0x436c57c191ed7LL),
       // C4[11], coeff of eps^12, polynomial in n of order 17
-      real(-0x4c7f9aLL<<24),real(-0x30ae96LL<<28),real(-0x315e58a6LL<<24),
-      real(-0x8f37a5414LL<<24),reale(6318LL,0xf71dfaeLL<<24),
+      -real(0x4c7f9aLL<<24),-real(0x30ae96LL<<28),-real(0x315e58a6LL<<24),
+      -real(0x8f37a5414LL<<24),reale(6318LL,0xf71dfaeLL<<24),
       reale(-88019LL,0xc301df8LL<<24),reale(693686LL,0xbce3822LL<<24),
       reale(-0x37e55cLL,0x7069f84LL<<24),reale(0xd5f852LL,0x9f2bf76LL<<24),
       reale(-0x26b7d77LL,0x982e35LL<<28),reale(0x56bf82dLL,0xe33846aLL<<24),
@@ -6979,8 +6979,8 @@ namespace GeographicLib {
       reale(-0x47e901LL,0xeb1f8a1180000LL),
       reale(0x15f733d135LL,0x436c57c191ed7LL),
       // C4[11], coeff of eps^11, polynomial in n of order 18
-      real(-13041LL<<24),real(-0x146168LL<<20),real(-662216LL<<24),
-      real(-0x6bfe398LL<<20),real(-0x737e19fLL<<24),real(-0x1633e28ec8LL<<20),
+      -real(13041LL<<24),-real(0x146168LL<<20),-real(662216LL<<24),
+      -real(0x6bfe398LL<<20),-real(0x737e19fLL<<24),-real(0x1633e28ec8LL<<20),
       real(0x4153bd106aLL<<24),reale(-15650LL,0x87866b08LL<<20),
       reale(133731LL,0xd6f7b33LL<<24),reale(-773735LL,0xc8d497d8LL<<20),
       reale(0x3223deLL,0x58eae9cLL<<24),reale(-0xa38670LL,0xa9a4c5a8LL<<20),
@@ -6992,14 +6992,14 @@ namespace GeographicLib {
       // C4[12], coeff of eps^29, polynomial in n of order 0
       real(16904LL<<20),real(0x495846bc80a035LL),
       // C4[12], coeff of eps^28, polynomial in n of order 1
-      real(-0x9a681aLL<<24),real(-0x5ab210cLL<<20),
+      -real(0x9a681aLL<<24),-real(0x5ab210cLL<<20),
       reale(61953LL,0x75e619a89ce07LL),
       // C4[12], coeff of eps^27, polynomial in n of order 2
-      real(0x3aca642LL<<28),real(-0x34bd5bbLL<<28),real(0x7d57dc9LL<<24),
+      real(0x3aca642LL<<28),-real(0x34bd5bbLL<<28),real(0x7d57dc9LL<<24),
       reale(497138LL,0xbe8dd4238d2e7LL),
       // C4[12], coeff of eps^26, polynomial in n of order 3
-      real(0x1e06447abLL<<28),real(-0x5a3f19aeLL<<28),real(-0x128cc8c7LL<<28),
-      real(-0xddf8d6LL<<32),reale(0x1462fc6LL,0x1d2a1f8b6ccdLL),
+      real(0x1e06447abLL<<28),-real(0x5a3f19aeLL<<28),-real(0x128cc8c7LL<<28),
+      -real(0xddf8d6LL<<32),reale(0x1462fc6LL,0x1d2a1f8b6ccdLL),
       // C4[12], coeff of eps^25, polynomial in n of order 4
       reale(590308LL,0x2dd66cLL<<28),reale(77521LL,0xf4de25LL<<28),
       reale(426657LL,250006LL<<28),reale(-306167LL,0xaff9d7LL<<28),
@@ -7086,7 +7086,7 @@ namespace GeographicLib {
       reale(0x2c9e8d8LL,0xd04bd0cLL<<24),reale(-0xae0e62LL,0x6a163c4LL<<24),
       reale(0x17e02d3150LL,0x27e511795bd59LL),
       // C4[12], coeff of eps^13, polynomial in n of order 16
-      real(0x3ede9cLL<<28),real(0xc5bfb074LL<<24),real(-0x251c8220f8LL<<24),
+      real(0x3ede9cLL<<28),real(0xc5bfb074LL<<24),-real(0x251c8220f8LL<<24),
       reale(9050LL,0x293775cLL<<24),reale(-78489LL,0x725735LL<<28),
       reale(459151LL,0x559e0c4LL<<24),reale(-0x1df2ddLL,0x76c7d98LL<<24),
       reale(0x61c892LL,0x1dd53acLL<<24),reale(-0xfa2ba9LL,0xce5d4eLL<<28),
@@ -7097,7 +7097,7 @@ namespace GeographicLib {
       reale(0x7f56465c5LL,0x62a1b07dc9473LL),
       // C4[12], coeff of eps^12, polynomial in n of order 17
       real(127075LL<<24),real(91195LL<<28),real(0x19a7ffdLL<<24),
-      real(0x554e98faLL<<24),real(-0x1104c06029LL<<24),
+      real(0x554e98faLL<<24),-real(0x1104c06029LL<<24),
       reale(4440LL,0x88ff8c4LL<<24),reale(-41520LL,0xff11071LL<<24),
       reale(264211LL,0xd76518eLL<<24),reale(-0x12f2c4LL,0x5871a4bLL<<24),
       reale(0x44e724LL,0x8fd71d8LL<<24),reale(-0xc76bc0LL,0x713de5LL<<24),
@@ -7107,13 +7107,13 @@ namespace GeographicLib {
       reale(0x11fa400LL,0x5381d7baLL<<20),
       reale(0x17e02d3150LL,0x27e511795bd59LL),
       // C4[13], coeff of eps^29, polynomial in n of order 0
-      real(-0x4d6b58LL<<20),reale(3193LL,0x402148867236bLL),
+      -real(0x4d6b58LL<<20),reale(3193LL,0x402148867236bLL),
       // C4[13], coeff of eps^28, polynomial in n of order 1
-      real(-400561LL<<32),real(0xd44948LL<<24),
+      -real(400561LL<<32),real(0xd44948LL<<24),
       reale(66909LL,0xbcc54ee94d445LL),
       // C4[13], coeff of eps^27, polynomial in n of order 2
-      real(-0x2f9823232LL<<28),real(-0xce4e6c05LL<<28),
-      real(-0xb74eeaa93LL<<24),reale(0x110ea712LL,0xcc6f5fc7e64c9LL),
+      -real(0x2f9823232LL<<28),-real(0xce4e6c05LL<<28),
+      -real(0xb74eeaa93LL<<24),reale(0x110ea712LL,0xcc6f5fc7e64c9LL),
       // C4[13], coeff of eps^26, polynomial in n of order 3
       real(0x6cba35ba4LL<<28),reale(10661LL,0xb5adc8LL<<28),
       reale(-6837LL,0x66f24cLL<<28),real(0x301270d076LL<<24),
@@ -7205,8 +7205,8 @@ namespace GeographicLib {
       reale(0x152cdf6LL,0x14c02fLL<<28),reale(-0x31e9c6LL,0x9aa84238LL<<20),
       reale(0x19c926916bLL,0xc5dcb3125bdbLL),
       // C4[13], coeff of eps^13, polynomial in n of order 16
-      real(-376740LL<<28),real(-0x148bf72cLL<<24),real(0x46b70c488LL<<24),
-      real(-0x4df9d7d484LL<<24),reale(12668LL,0x17bd05LL<<28),
+      -real(376740LL<<28),-real(0x148bf72cLL<<24),real(0x46b70c488LL<<24),
+      -real(0x4df9d7d484LL<<24),reale(12668LL,0x17bd05LL<<28),
       reale(-87923LL,0x676f5a4LL<<24),reale(452934LL,0x95d1e18LL<<24),
       reale(-0x1bb530LL,0x1269c4cLL<<24),reale(0x590b33LL,0x300a2eLL<<28),
       reale(-0xe9bd67LL,0xa1e5474LL<<24),reale(0x1fac381LL,0x6f853a8LL<<24),
@@ -7217,10 +7217,10 @@ namespace GeographicLib {
       // C4[14], coeff of eps^29, polynomial in n of order 0
       real(41LL<<28),real(0x3fbc634a12a6b1LL),
       // C4[14], coeff of eps^28, polynomial in n of order 1
-      real(-0x34b26a8LL<<28),real(-0x391d0abLL<<28),
+      -real(0x34b26a8LL<<28),-real(0x391d0abLL<<28),
       reale(0x579206LL,0x909af11944e4bLL),
       // C4[14], coeff of eps^27, polynomial in n of order 2
-      reale(3432LL,999202LL<<32),real(-0x7c2b19efLL<<32),
+      reale(3432LL,999202LL<<32),-real(0x7c2b19efLL<<32),
       real(0xcb0c2aebLL<<28),reale(0x12521bbeLL,0xdb94118adae9fLL),
       // C4[14], coeff of eps^26, polynomial in n of order 3
       reale(287986LL,0x83a7b2LL<<28),reale(5344LL,0xddeeccLL<<28),
@@ -7302,7 +7302,7 @@ namespace GeographicLib {
       reale(-0x2a59bfLL,0x3d67fa2LL<<24),
       reale(0x1bb21ff185LL,0xf0d684e8efa5dLL),
       // C4[14], coeff of eps^14, polynomial in n of order 15
-      real(-0x1250b2e28LL<<24),real(0x15b951553LL<<28),
+      -real(0x1250b2e28LL<<24),real(0x15b951553LL<<28),
       reale(-3809LL,0x7d8f088LL<<24),reale(28626LL,0x9961feLL<<28),
       reale(-160362LL,0x853f38LL<<24),reale(702411LL,0xec72a9LL<<28),
       reale(-0x25d7b7LL,0x97bdde8LL<<24),reale(0x6de23fLL,0x2af154LL<<28),
@@ -7312,9 +7312,9 @@ namespace GeographicLib {
       reale(-0x34f02e8LL,0xcc1f8a8LL<<24),reale(0xe8ed99LL,0x2e44205LL<<24),
       reale(0x1bb21ff185LL,0xf0d684e8efa5dLL),
       // C4[15], coeff of eps^29, polynomial in n of order 0
-      real(-204761LL<<28),reale(20426LL,0xaa7b82b97d24fLL),
+      -real(204761LL<<28),reale(20426LL,0xaa7b82b97d24fLL),
       // C4[15], coeff of eps^28, polynomial in n of order 1
-      real(-138796LL<<40),real(0x326231aLL<<28),
+      -real(138796LL<<40),real(0x326231aLL<<28),
       reale(0x5d9c18LL,0xac3bb24726559LL),
       // C4[15], coeff of eps^27, polynomial in n of order 2
       reale(16894LL,439LL<<40),reale(-3397LL,43380LL<<36),
@@ -7403,7 +7403,7 @@ namespace GeographicLib {
       // C4[16], coeff of eps^29, polynomial in n of order 0
       real(4424LL<<28),real(0x292ecb9a960d27d1LL),
       // C4[16], coeff of eps^28, polynomial in n of order 1
-      real(-61453LL<<36),real(-0x1223354LL<<32),
+      -real(61453LL<<36),-real(0x1223354LL<<32),
       reale(0x12af280LL,0x57955a5f17535LL),
       // C4[16], coeff of eps^27, polynomial in n of order 2
       reale(33770LL,14237LL<<36),reale(-12918LL,122440LL<<32),
@@ -7479,9 +7479,9 @@ namespace GeographicLib {
       reale(-0x2c79ecfLL,521878LL<<32),reale(0xc19a43LL,0x799264LL<<28),
       reale(0x1f8412b1bbLL,0xb9c7f85883761LL),
       // C4[17], coeff of eps^29, polynomial in n of order 0
-      real(-0x223858LL<<28),reale(154847LL,0x4e6e7be138cdbLL),
+      -real(0x223858LL<<28),reale(154847LL,0x4e6e7be138cdbLL),
       // C4[17], coeff of eps^28, polynomial in n of order 1
-      real(-329724LL<<36),real(284138LL<<32),reale(989485LL,0x4511e2f2b39a3LL),
+      -real(329724LL<<36),real(284138LL<<32),reale(989485LL,0x4511e2f2b39a3LL),
       // C4[17], coeff of eps^27, polynomial in n of order 2
       reale(30957LL,2723LL<<36),reale(7080LL,304568LL<<32),
       reale(-9774LL,884536LL<<28),reale(0x1977a7ac1LL,0x13b9f01928417LL),
@@ -7607,9 +7607,9 @@ namespace GeographicLib {
       reale(-0x260d0dfLL,14503LL<<36),reale(0xa43857LL,40886LL<<32),
       reale(0x23560571f1LL,0x82b96bc817465LL),
       // C4[19], coeff of eps^29, polynomial in n of order 0
-      real(-278788LL<<32),reale(220556LL,0x6c98ea537e51fLL),
+      -real(278788LL<<32),reale(220556LL,0x6c98ea537e51fLL),
       // C4[19], coeff of eps^28, polynomial in n of order 1
-      real(-0x25ce6eLL<<40),real(0x526878LL<<32),
+      -real(0x25ce6eLL<<40),real(0x526878LL<<32),
       reale(0x875e405LL,0x222cc7846d81LL),
       // C4[19], coeff of eps^27, polynomial in n of order 2
       reale(876102LL,3999LL<<40),reale(573743LL,11608LL<<36),
@@ -7661,11 +7661,11 @@ namespace GeographicLib {
       // C4[20], coeff of eps^29, polynomial in n of order 0
       real(8LL<<36),reale(386445LL,0x44b61aebc827LL),
       // C4[20], coeff of eps^28, polynomial in n of order 1
-      reale(3670LL,3431LL<<40),real(-0x79ecc9eLL<<36),
+      reale(3670LL,3431LL<<40),-real(0x79ecc9eLL<<36),
       reale(0x3e42bbf0LL,0x57ec63f8653c9LL),
       // C4[20], coeff of eps^27, polynomial in n of order 2
       reale(165149LL,3624LL<<40),reale(-25859LL,2212LL<<40),
-      real(-0x643c72cLL<<36),reale(0x1b3d32392LL,0x6776bbcac4a7fLL),
+      -real(0x643c72cLL<<36),reale(0x1b3d32392LL,0x6776bbcac4a7fLL),
       // C4[20], coeff of eps^26, polynomial in n of order 3
       reale(-0x4244faLL,1716LL<<40),reale(185313LL,2424LL<<40),
       reale(0x17a0b9LL,1084LL<<40),reale(-580655LL,3319LL<<40),
@@ -7704,12 +7704,12 @@ namespace GeographicLib {
       reale(-0x2109598LL,1041LL<<40),reale(0x8d95c8LL,42350LL<<36),
       reale(0x2727f83227LL,0x4baadf37ab169LL),
       // C4[21], coeff of eps^29, polynomial in n of order 0
-      real(-0xf64d18LL<<36),reale(0x89fcdedLL,0x92d5d14b2b5b9LL),
+      -real(0xf64d18LL<<36),reale(0x89fcdedLL,0x92d5d14b2b5b9LL),
       // C4[21], coeff of eps^28, polynomial in n of order 1
-      reale(-21807LL,8LL<<44),real(-0x6ae714LL<<40),
+      reale(-21807LL,8LL<<44),-real(0x6ae714LL<<40),
       reale(0x1c915a22fLL,0x6644548ff9f4dLL),
       // C4[21], coeff of eps^27, polynomial in n of order 2
-      real(-0x4a7828LL<<40),reale(66113LL,892LL<<40),
+      -real(0x4a7828LL<<40),reale(66113LL,892LL<<40),
       reale(-23878LL,9012LL<<36),reale(0x1c915a22fLL,0x6644548ff9f4dLL),
       // C4[21], coeff of eps^26, polynomial in n of order 3
       reale(-601428LL,33LL<<44),reale(181759LL,130LL<<44),
@@ -7742,7 +7742,7 @@ namespace GeographicLib {
       reale(0x36480daLL,840LL<<40),reale(-0x1eed84dLL,1236LL<<40),
       reale(0x842565LL,61372LL<<36),reale(0x2910f19242LL,0x302398ef74febLL),
       // C4[22], coeff of eps^29, polynomial in n of order 0
-      real(-1832LL<<40),reale(0x1ece7bLL,0x935060fc493cdLL),
+      -real(1832LL<<40),reale(0x1ece7bLL,0x935060fc493cdLL),
       // C4[22], coeff of eps^28, polynomial in n of order 1
       reale(64733LL,244LL<<44),reale(-22614LL,152LL<<40),
       reale(0x1de5820ccLL,0x6511ed552f41bLL),
@@ -7776,7 +7776,7 @@ namespace GeographicLib {
       // C4[23], coeff of eps^29, polynomial in n of order 0
       reale(-4290LL,3928LL<<40),reale(0x63ebb97bLL,0x7a5fe79ee0e95LL),
       // C4[23], coeff of eps^28, polynomial in n of order 1
-      real(-10808LL<<48),real(-234789LL<<44),
+      -real(10808LL<<48),-real(234789LL<<44),
       reale(0x63ebb97bLL,0x7a5fe79ee0e95LL),
       // C4[23], coeff of eps^27, polynomial in n of order 2
       reale(-209745LL,12LL<<48),reale(171585LL,6LL<<48),
@@ -7799,7 +7799,7 @@ namespace GeographicLib {
       reale(0x21b719LL,1LL<<48),reale(-0x130279LL,168LL<<44),
       reale(330919LL,3958LL<<40),reale(0x1f39a9f69LL,0x63df861a648e9LL),
       // C4[24], coeff of eps^29, polynomial in n of order 0
-      real(-5756LL<<44),reale(0x2abccf4LL,0x37a4fd885dffdLL),
+      -real(5756LL<<44),reale(0x2abccf4LL,0x37a4fd885dffdLL),
       // C4[24], coeff of eps^28, polynomial in n of order 1
       reale(32742LL,12LL<<48),reale(-8771LL,88LL<<44),
       reale(0x682c3934LL,0x7a229fc651f8bLL),
@@ -7819,9 +7819,9 @@ namespace GeographicLib {
       reale(-0x11ef03LL,9LL<<48),reale(311454LL,22LL<<44),
       reale(0x208dd1e06LL,0x62ad1edf99db7LL),
       // C4[25], coeff of eps^29, polynomial in n of order 0
-      real(-14828LL<<44),reale(0xc21a5bLL,0x2bd144a4925efLL),
+      -real(14828LL<<44),reale(0xc21a5bLL,0x2bd144a4925efLL),
       // C4[25], coeff of eps^28, polynomial in n of order 1
-      real(602LL<<52),real(-2379LL<<48),reale(0x85721eaLL,0xe1fdf3124a145LL),
+      real(602LL<<52),-real(2379LL<<48),reale(0x85721eaLL,0xe1fdf3124a145LL),
       // C4[25], coeff of eps^27, polynomial in n of order 2
       reale(-298604LL,8LL<<48),reale(142145LL,4LL<<48),reale(-33347LL,4LL<<44),
       reale(0x6c6cb8edLL,0x79e557edc3081LL),
@@ -7833,27 +7833,27 @@ namespace GeographicLib {
       reale(-222239LL,12LL<<48),reale(58764LL,236LL<<44),
       reale(0x6c6cb8edLL,0x79e557edc3081LL),
       // C4[26], coeff of eps^29, polynomial in n of order 0
-      real(-2LL<<48),reale(131359LL,0xe834f81ee20c1LL),
+      -real(2LL<<48),reale(131359LL,0xe834f81ee20c1LL),
       // C4[26], coeff of eps^28, polynomial in n of order 1
       reale(10305LL,0LL),reale(-2418LL,14LL<<48),
       reale(0x8aadcf9LL,0x1d0ced8b7a293LL),
       // C4[26], coeff of eps^27, polynomial in n of order 2
-      reale(-11556LL,0LL),reale(3294LL,0LL),real(-7198LL<<48),
+      reale(-11556LL,0LL),reale(3294LL,0LL),-real(7198LL<<48),
       reale(0x8aadcf9LL,0x1d0ced8b7a293LL),
       // C4[26], coeff of eps^26, polynomial in n of order 3
       reale(-36491LL,8LL<<48),reale(29097LL,0LL),reale(-16196LL,8LL<<48),
       reale(4273LL,13LL<<48),reale(0x8aadcf9LL,0x1d0ced8b7a293LL),
       // C4[27], coeff of eps^29, polynomial in n of order 0
-      real(-4058LL<<48),reale(0xffd800LL,0xd0e6a80084b19LL),
+      -real(4058LL<<48),reale(0xffd800LL,0xd0e6a80084b19LL),
       // C4[27], coeff of eps^28, polynomial in n of order 1
-      real(7LL<<56),real(-244LL<<48),reale(0x554800LL,0x45a238002c3b3LL),
+      real(7LL<<56),-real(244LL<<48),reale(0x554800LL,0x45a238002c3b3LL),
       // C4[27], coeff of eps^27, polynomial in n of order 2
-      reale(3080LL,0LL),real(-1708LL<<52),real(7198LL<<48),
+      reale(3080LL,0LL),-real(1708LL<<52),real(7198LL<<48),
       reale(0xffd800LL,0xd0e6a80084b19LL),
       // C4[28], coeff of eps^29, polynomial in n of order 0
-      real(-2LL<<52),reale(827461LL,0x318a62b8e0a5bLL),
+      -real(2LL<<52),reale(827461LL,0x318a62b8e0a5bLL),
       // C4[28], coeff of eps^28, polynomial in n of order 1
-      real(-232LL<<52),real(61LL<<52),reale(0x25e0cfLL,0x949f282aa1f11LL),
+      -real(232LL<<52),real(61LL<<52),reale(0x25e0cfLL,0x949f282aa1f11LL),
       // C4[29], coeff of eps^29, polynomial in n of order 0
       real(2LL<<52),reale(88602LL,0xec373d36a45dfLL),
     };
diff --git a/src/GravityModel.cpp b/src/GravityModel.cpp
index d552620..2450e57 100644
--- a/src/GravityModel.cpp
+++ b/src/GravityModel.cpp
@@ -2,7 +2,7 @@
  * \file GravityModel.cpp
  * \brief Implementation for GeographicLib::GravityModel class
  *
- * Copyright (c) Charles Karney (2011-2012) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -129,7 +129,7 @@ namespace GeographicLib {
     string::size_type n = line.find_first_of(spaces, 5);
     if (n != string::npos)
       n -= 5;
-    string version = line.substr(5, n);
+    string version(line, 5, n);
     if (version != "1")
       throw GeographicErr("Unknown version in " + _filename + ": " + version);
     string key, val;
@@ -145,15 +145,15 @@ namespace GeographicLib {
       else if (key == "ReleaseDate")
         _date = val;
       else if (key == "ModelRadius")
-        _amodel = Utility::num<real>(val);
+        _amodel = Utility::val<real>(val);
       else if (key == "ModelMass")
-        _GMmodel = Utility::num<real>(val);
+        _GMmodel = Utility::val<real>(val);
       else if (key == "AngularVelocity")
-        omega = Utility::num<real>(val);
+        omega = Utility::val<real>(val);
       else if (key == "ReferenceRadius")
-        a = Utility::num<real>(val);
+        a = Utility::val<real>(val);
       else if (key == "ReferenceMass")
-        GM = Utility::num<real>(val);
+        GM = Utility::val<real>(val);
       else if (key == "Flattening")
         f = Utility::fract<real>(val);
       else if (key == "DynamicalFormFactor")
@@ -189,7 +189,10 @@ namespace GeographicLib {
       throw GeographicErr("Height offset must be finite");
     if (int(_id.size()) != idlength_)
       throw GeographicErr("Invalid ID");
-    _earth = NormalGravity(a, GM, omega, f, J2);
+    if (Math::isfinite(f) && Math::isfinite(J2))
+      throw GeographicErr("Cannot specify both f and J2");
+    _earth = NormalGravity(a, GM, omega,
+                           Math::isfinite(f) ? f : J2, Math::isfinite(f));
   }
 
   Math::real GravityModel::InternalT(real X, real Y, real Z,
diff --git a/src/LambertConformalConic.cpp b/src/LambertConformalConic.cpp
index 285d036..de6285a 100644
--- a/src/LambertConformalConic.cpp
+++ b/src/LambertConformalConic.cpp
@@ -2,7 +2,7 @@
  * \file LambertConformalConic.cpp
  * \brief Implementation for GeographicLib::LambertConformalConic class
  *
- * Copyright (c) Charles Karney (2010-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -25,9 +25,9 @@ namespace GeographicLib {
     , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2)))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k0) && k0 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(abs(stdlat) <= 90))
@@ -50,9 +50,9 @@ namespace GeographicLib {
     , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2)))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k1) && k1 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(abs(stdlat1) <= 90))
@@ -79,9 +79,9 @@ namespace GeographicLib {
     , _es((_f < 0 ? -1 : 1) * sqrt(abs(_e2)))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(k1) && k1 > 0))
       throw GeographicErr("Scale is not positive");
     if (!(coslat1 >= 0))
diff --git a/src/MagneticModel.cpp b/src/MagneticModel.cpp
index d82e5b7..036a25d 100644
--- a/src/MagneticModel.cpp
+++ b/src/MagneticModel.cpp
@@ -2,7 +2,7 @@
  * \file MagneticModel.cpp
  * \brief Implementation for GeographicLib::MagneticModel class
  *
- * Copyright (c) Charles Karney (2011-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -96,7 +96,7 @@ namespace GeographicLib {
     string::size_type n = line.find_first_of(spaces, 5);
     if (n != string::npos)
       n -= 5;
-    string version = line.substr(5, n);
+    string version(line, 5, n);
     if (!(version == "1" || version == "2"))
       throw GeographicErr("Unknown version in " + _filename + ": " + version);
     string key, val;
@@ -111,26 +111,26 @@ namespace GeographicLib {
       else if (key == "ReleaseDate")
         _date = val;
       else if (key == "Radius")
-        _a = Utility::num<real>(val);
+        _a = Utility::val<real>(val);
       else if (key == "Type") {
         if (!(val == "Linear" || val == "linear"))
           throw GeographicErr("Only linear models are supported");
       } else if (key == "Epoch")
-        _t0 = Utility::num<real>(val);
+        _t0 = Utility::val<real>(val);
       else if (key == "DeltaEpoch")
-        _dt0 = Utility::num<real>(val);
+        _dt0 = Utility::val<real>(val);
       else if (key == "NumModels")
-        _Nmodels = Utility::num<int>(val);
+        _Nmodels = Utility::val<int>(val);
       else if (key == "NumConstants")
-        _Nconstants = Utility::num<int>(val);
+        _Nconstants = Utility::val<int>(val);
       else if (key == "MinTime")
-        _tmin = Utility::num<real>(val);
+        _tmin = Utility::val<real>(val);
       else if (key == "MaxTime")
-        _tmax = Utility::num<real>(val);
+        _tmax = Utility::val<real>(val);
       else if (key == "MinHeight")
-        _hmin = Utility::num<real>(val);
+        _hmin = Utility::val<real>(val);
       else if (key == "MaxHeight")
-        _hmax = Utility::num<real>(val);
+        _hmax = Utility::val<real>(val);
       else if (key == "Normalization") {
         if (val == "FULL" || val == "Full" || val == "full")
           _norm = SphericalHarmonic::FULL;
diff --git a/src/Makefile.am b/src/Makefile.am
index 840526f..6013201 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -75,6 +75,7 @@ libGeographic_la_SOURCES = Accumulator.cpp \
 		../include/GeographicLib/MagneticCircle.hpp \
 		../include/GeographicLib/MagneticModel.hpp \
 		../include/GeographicLib/Math.hpp \
+		../include/GeographicLib/NearestNeighbor.hpp \
 		../include/GeographicLib/NormalGravity.hpp \
 		../include/GeographicLib/OSGB.hpp \
 		../include/GeographicLib/PolarStereographic.hpp \
diff --git a/src/Makefile.in b/src/Makefile.in
index 0a040bd..c422667 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -307,6 +307,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -357,6 +360,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
@@ -443,6 +447,7 @@ libGeographic_la_SOURCES = Accumulator.cpp \
 		../include/GeographicLib/MagneticCircle.hpp \
 		../include/GeographicLib/MagneticModel.hpp \
 		../include/GeographicLib/Math.hpp \
+		../include/GeographicLib/NearestNeighbor.hpp \
 		../include/GeographicLib/NormalGravity.hpp \
 		../include/GeographicLib/OSGB.hpp \
 		../include/GeographicLib/PolarStereographic.hpp \
diff --git a/src/Makefile.mk b/src/Makefile.mk
index dbc3668..327197d 100644
--- a/src/Makefile.mk
+++ b/src/Makefile.mk
@@ -46,6 +46,7 @@ MODULES = Accumulator \
 	UTMUPS \
 	Utility
 EXTRAHEADERS = Constants \
+	NearestNeighbor \
 	SphericalHarmonic \
 	SphericalHarmonic1 \
 	SphericalHarmonic2
diff --git a/src/NormalGravity.cpp b/src/NormalGravity.cpp
index 3c96c16..e906191 100644
--- a/src/NormalGravity.cpp
+++ b/src/NormalGravity.cpp
@@ -2,7 +2,7 @@
  * \file NormalGravity.cpp
  * \brief Implementation for GeographicLib::NormalGravity class
  *
- * Copyright (c) Charles Karney (2011-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -18,59 +18,72 @@ namespace GeographicLib {
 
   using namespace std;
 
-  NormalGravity::NormalGravity(real a, real GM, real omega, real f, real J2)
-    : _a(a)
-    , _GM(GM)
-    , _omega(omega)
-    , _f(f)
-    , _J2(J2)
-    , _omega2(Math::sq(_omega))
-    , _aomega2(Math::sq(_omega * _a))
-    {
-      if (!(Math::isfinite(_a) && _a > 0))
-        throw GeographicErr("Major radius is not positive");
-      if (!(Math::isfinite(_GM) && _GM > 0))
-        throw GeographicErr("Gravitational constant is not positive");
-      if (!(_omega == 0 && _f == 0 && _J2 == 0)) {
-        bool flatp = _f > 0 && Math::isfinite(_f);
-        if (_J2 > 0 && Math::isfinite(_J2) && flatp)
-          throw GeographicErr("Cannot specify both f and J2");
-        if (!(_J2 > 0 && Math::isfinite(_J2)) && !flatp)
-          throw GeographicErr("Must specify one of f and J2");
-        if (!(Math::isfinite(_omega) && _omega != 0))
-          throw GeographicErr("Angular velocity is not non-zero");
-        if (flatp)
-          _J2 = FlatteningToJ2(_a, _GM, _omega, _f);
-        else
-          _f = J2ToFlattening(_a, _GM, _omega, _J2);
-      } // else we have a sphere: omega = f = J2 = 0
-      _e2 = _f * (2 - _f);
-      _ep2 = _e2 / (1 - _e2);
-      _q0 = qf(_ep2);
-      _earth = Geocentric(_a, _f);
-      _b = _a * (1 - _f);
-      _E = _a * sqrt(_e2);      // H+M, Eq 2-54
-      // H+M, Eq 2-61
-      _U0 = _GM / (_E ? _E / atan(sqrt(_ep2)) : _b) + _aomega2 / 3;
-      // The approximate ratio of the centrifugal acceleration (at the equator)
-      // to gravity.
-      _m = _aomega2 * _b / _GM; // H+M, Eq 2-70
-      real
-        Q = _m * (_q0 ? sqrt(_ep2) * qpf(_ep2) / (3 * _q0) : 1),
-        G = (1 - _m - Q / 2);
-      _gammae = _GM / (_a * _b) * G;       // H+M, Eq 2-73
-      _gammap = _GM / (_a * _a) * (1 + Q); // H+M, Eq 2-74
-      // k = b * gammap / (a * gammae) - 1
-      _k = (_m + 3 * Q / 2 - _e2 * (1 + Q)) / G;
-      // f* = (gammap - gammae) / gammae
-      _fstar = (_m + 3 * Q / 2 - _f * (1 + Q)) / G;
-    }
+  void NormalGravity::Initialize(real a, real GM, real omega, real f_J2,
+                                 bool geometricp) {
+    _a = a;
+    if (!(Math::isfinite(_a) && _a > 0))
+      throw GeographicErr("Equatorial radius is not positive");
+    _GM = GM;
+    if (!Math::isfinite(_GM))
+      throw GeographicErr("Gravitational constant is not finite");
+    _omega = omega;
+    _omega2 = Math::sq(_omega);
+    _aomega2 = Math::sq(_omega * _a);
+    if (!(Math::isfinite(_omega2) && Math::isfinite(_aomega2)))
+      throw GeographicErr("Rotation velocity is not finite");
+    _f = geometricp ? f_J2 : J2ToFlattening(_a, _GM, _omega, f_J2);
+    _b = _a * (1 - _f);
+    if (!(Math::isfinite(_b) && _b > 0))
+      throw GeographicErr("Polar semi-axis is not positive");
+    _J2 = geometricp ? FlatteningToJ2(_a, _GM, _omega, f_J2) : f_J2;
+    _e2 = _f * (2 - _f);
+    _ep2 = _e2 / (1 - _e2);
+    real ex2 = _f < 0 ? -_e2 : _ep2;
+    _Q0 = Qf(ex2, _f < 0);
+    _earth = Geocentric(_a, _f);
+    _E = _a * sqrt(abs(_e2));   // H+M, Eq 2-54
+    // H+M, Eq 2-61
+    _U0 = _GM * atanzz(ex2, _f < 0) / _b + _aomega2 / 3;
+    real P = Gf(ex2, _f < 0) / (6 * _Q0);
+    // H+M, Eq 2-73
+    _gammae = _GM / (_a * _b) - (1 + P) * _a * _omega2;
+    // H+M, Eq 2-74
+    _gammap = _GM / (_a * _a) + 2 * P * _b * _omega2;
+    // k = gammae * (b * gammap / (a * gammae) - 1)
+    //   = (b * gammap - a * gammae) / a
+    _k = -_e2 * _GM / (_a * _b) + _omega2 * (P * (_a + 2 * _b * (1 - _f)) + _a);
+    // f* = (gammap - gammae) / gammae
+    _fstar = (-_f * _GM / (_a * _b) + _omega2 * (P * (_a + 2 * _b) + _a)) /
+      _gammae;
+  }
+
+  NormalGravity::NormalGravity(real a, real GM, real omega, real f_J2,
+                               bool geometricp) {
+    Initialize(a, GM, omega, f_J2, geometricp);
+  }
+
+  NormalGravity::NormalGravity(real a, real GM, real omega, real f, real J2) {
+    if (!(Math::isfinite(GM) && GM > 0))
+      throw GeographicErr("Gravitational constant is not positive");
+    bool geometricp;
+    if (!(omega == 0 && f == 0 && J2 == 0)) {
+      geometricp = f > 0 && Math::isfinite(f);
+      if (J2 > 0 && Math::isfinite(J2) && geometricp)
+        throw GeographicErr("Cannot specify both f and J2");
+      if (!(J2 > 0 && Math::isfinite(J2)) && !geometricp)
+        throw GeographicErr("Must specify one of f and J2");
+      if (!(Math::isfinite(omega) && omega != 0))
+        throw GeographicErr("Angular velocity is not non-zero");
+    } else
+      geometricp = true;
+    Initialize(a, GM, omega, geometricp ? f : J2, geometricp);
+  }
 
   const NormalGravity& NormalGravity::WGS84() {
     static const NormalGravity wgs84(Constants::WGS84_a(),
                                      Constants::WGS84_GM(),
                                      Constants::WGS84_omega(),
-                                     Constants::WGS84_f(), 0);
+                                     Constants::WGS84_f(), true);
     return wgs84;
   }
 
@@ -78,60 +91,74 @@ namespace GeographicLib {
     static const NormalGravity grs80(Constants::GRS80_a(),
                                      Constants::GRS80_GM(),
                                      Constants::GRS80_omega(),
-                                     0, Constants::GRS80_J2());
+                                     Constants::GRS80_J2(), false);
     return grs80;
   }
 
-  // (atan(y)-(y-y^3/3+y^5/5))/y^7 (y = sqrt(x)) = -1/7+x/9-x^2/11+x^3/13...
-  Math::real NormalGravity::atan7(real x) {
-    if (abs(x) >= real(0.5)) {
-      real y = sqrt(abs(x)), x2 = Math::sq(x);
-      return ((x > 0 ? atan(y) : Math::atanh(y))- y * (1 - x / 3 + x2 / 5)) /
-        (x * x2 * y);
-    } else {
-      real xn = -1, q = 0;
-      for (int n = 7; ; n += 2) {
-        real qn = q + xn / n;
-        if (qn == q)
-          break;
-        q = qn;
-        xn *= -x;
-      }
-      return q;
-    }
+  Math::real NormalGravity::atan7series(real x) {
+    // compute -sum( (-x)^n/(2*n+7), n, 0, inf)
+    //   = -1/7 + x/9 - x^2/11 + x^3/13 ...
+    //   = (atan(sqrt(x))/sqrt(x)-(1-x/3+x^2/5)) / x^3 (x > 0)
+    //   = (atanh(sqrt(-x))/sqrt(-x)-(1-x/3+x^2/5)) / x^3 (x < 0)
+    // require abs(x) < 1/2, but better to restrict calls to abs(x) < 1/4
+    static const real lg2eps_ =
+      -log(numeric_limits<real>::epsilon() / 2) / log(real(2));
+    int e;
+    frexp(x, &e);
+    e = max(-e, 1);             // Here's where abs(x) < 1/2 is assumed
+    // x = [0.5,1) * 2^(-e)
+    // estimate n s.t. x^n/n < 1/7 * epsilon/2
+    // a stronger condition is x^n < epsilon/2
+    // taking log2 of both sides, a stronger condition is n*(-e) < -lg2eps;
+    // or n*e > lg2eps or n > ceiling(lg2eps/e)
+    int n = int(ceil(lg2eps_ / e));
+    Math::real v = 0;
+    while (n--)                 // iterating from n-1 down to 0
+      v = - x * v - 1/Math::real(2*n + 7);
+    return v;
   }
 
-  // (atan(y)-(y-y^3/3))/y^5 (y = sqrt(x)) = 1/5-x/7+x^2/9-x^3/11...
-  Math::real NormalGravity::atan5(real x)
-  { return 1/real(5) + x * atan7(x); }
+  Math::real NormalGravity::atan5series(real x) {
+    // Compute Taylor series approximations to
+    //   (atan(z)-(z-z^3/3))/z^5,
+    // z = sqrt(x)
+    // require abs(x) < 1/2, but better to restrict calls to abs(x) < 1/4
+    return 1/real(5) + x * atan7series(x);
+  }
 
-  Math::real NormalGravity::qf(real ep2) {
+  Math::real NormalGravity::Qf(real x, bool alt) {
     // Compute
-    //
-    //   ((1 + 3/e'^2) * atan(e') - 3/e')/2
-    //
-    // See H+M, Eq 2-57, with E/u = e'.  This suffers from two levels of
-    // cancelation.  The e'^-1 and e'^1 terms drop out, so that the leading
-    // term is O(e'^3).  Substitute atan(e') = e' - e'^3/3 + e'^5*atan5(e'^2)
-    return sqrt(ep2) * ep2 * (3 * (3 + ep2) * atan5(ep2) - 1) / 6;
+    //   Q(z) = (((1 + 3/z^2) * atan(z) - 3/z)/2) / z^3
+    //        = q(z)/z^3 with q(z) defined by H+M, Eq 2-57 with z = E/u
+    //   z = sqrt(x)
+    real y = alt ? -x / (1 + x) : x;
+    return !(4 * abs(y) < 1) ?  // Backwards test to allow NaNs through
+      ((1 + 3/y) * atanzz(x, alt) - 3/y) / (2 * y) :
+      (3 * (3 + y) * atan5series(y) - 1) / 6;
   }
 
-  Math::real NormalGravity::dq(real ep2) {
-    // Compute d qf(ep2) / d ep2 and substitute
-    // atan(e') = e' - e'^3/3 + e'^5/5 + e'^7*atan7(e'^2)
-    return sqrt(ep2) * (5 - 3 * (1 + ep2) * (1 + 5 * ep2 * atan7(ep2))) /
-      (10 * (1 + ep2));
+  Math::real NormalGravity::Gf(real x, bool alt) {
+    // z = sqrt(x)
+    // Compute
+    //   G(z) = (3*Q(z)+z*diff(Q(z),z))*(1+z^2)
+    //        = (3 * (1 + 1/z^2) * (1 - atan(z)/z) - 1) / z^2
+    //        = q'(z)/z^2, with q'(z) defined by H+M, Eq 2-67, with z = E/u
+    real y = alt ? -x / (1 + x) : x;
+    return !(4 * abs(y) < 1) ?  // Backwards test to allow NaNs through
+      (3 * (1 + 1/y) * (1 - atanzz(x, alt)) - 1) / y :
+      1 - 3 * (1 + y) * atan5series(y);
   }
 
-  Math::real NormalGravity::qpf(real ep2) {
-    // Compute
-    //
-    //   3*(1 + 1/e'^2) * (1 - atan(e')/e') - 1
-    //
-    // See H+M, Eq 2-67, with E/u = e'.  This suffers from two levels of
-    // cancelation.  The e'^-2 and e'^0 terms drop out, so that the leading
-    // term is O(e'^2).
-    return ep2 * (1 - 3 * (1 + ep2) * atan5(ep2));
+  Math::real NormalGravity::QG3f(real x, bool alt) {
+    // z = sqrt(x)
+    // (Q(z) - G(z)/3) / z^2
+    //   = - (1+z^2)/(3*z) * d(Q(z))/dz - Q(z)
+    //   = ((15+9*z^2)*atan(z)-4*z^3-15*z)/(6*z^7)
+    //   = ((25+15*z^2)*atan7+3)/10
+    real y = alt ? -x / (1 + x) : x;
+    return !(4 * abs(y) < 1) ? // Backwards test to allow NaNs through
+      ((9 + 15/y) * atanzz(x, alt) - 4 - 15/y) / (6 * Math::sq(y)) :
+      ((25 + 15*y) * atan7series(y) + 3)/10;
   }
 
   Math::real NormalGravity::Jn(int n) const {
@@ -149,7 +176,7 @@ namespace GeographicLib {
   Math::real NormalGravity::SurfaceGravity(real lat) const {
     real sphi = Math::sind(Math::LatFix(lat));
     // H+M, Eq 2-78
-    return _gammae * (1 + _k * Math::sq(sphi)) / sqrt(1 - _e2 * Math::sq(sphi));
+    return (_gammae + _k * Math::sq(sphi)) / sqrt(1 - _e2 * Math::sq(sphi));
   }
 
   Math::real NormalGravity::V0(real X, real Y, real Z,
@@ -160,7 +187,9 @@ namespace GeographicLib {
       p = Math::hypot(X, Y),
       clam = p ? X/p : 1,
       slam = p ? Y/p : 0,
-      r = Math::hypot(p, Z),
+      r = Math::hypot(p, Z);
+    if (_f < 0) swap(p, Z);
+    real
       Q = Math::sq(r) - Math::sq(_E),
       t2 = Math::sq(2 * _E * Z),
       disc = sqrt(Math::sq(Q) + t2),
@@ -169,24 +198,33 @@ namespace GeographicLib {
       u = sqrt((Q >= 0 ? (Q + disc) : t2 / (disc - Q)) / 2),
       uE = Math::hypot(u, _E),
       // H+M, Eq 6-8b
-      sbet = Z * uE,
-      cbet = p * u,
+      sbet = u ? Z * uE : Math::copysign(sqrt(-Q), Z),
+      cbet = u ? p * u : p,
       s = Math::hypot(cbet, sbet);
-    cbet = s ? cbet/s : 0;
     sbet = s ? sbet/s : 1;
+    cbet = s ? cbet/s : 0;
     real
-      invw = uE / Math::hypot(u, _E * sbet), // H+M, Eq 2-63
-      ep = _E/u,
-      ep2 = Math::sq(ep),
-      q = _q0 ? qf(ep2) / _q0 : pow(_a / u, 3),
-      qp = qpf(ep2) / _q0,
-      // H+M, Eqs 2-62 + 6-9, but omitting last (rotational) term .
-      Vres = (_GM / (_E ? _E / atan(_E / u) : u)
-              + _aomega2 * q * (Math::sq(sbet) - 1/real(3)) / 2),
+      z = _E/u,
+      z2 = Math::sq(z),
+      den = Math::hypot(u, _E * sbet);
+    if (_f < 0) {
+      swap(sbet, cbet);
+      swap(u, uE);
+    }
+    real
+      invw = uE / den,          // H+M, Eq 2-63
+      bu = _b / (u != 0 || _f < 0 ? u : _E),
+      // Qf(z2->inf, false) = pi/(4*z^3)
+      q = ((u != 0 || _f < 0 ? Qf(z2, _f < 0) : Math::pi() / 4) / _Q0) *
+        bu * Math::sq(bu),
+      qp = _b * Math::sq(bu) * (u != 0 || _f < 0 ? Gf(z2, _f < 0) : 2) / _Q0,
+      ang = (Math::sq(sbet) - 1/real(3)) / 2,
+      // H+M, Eqs 2-62 + 6-9, but omitting last (rotational) term.
+      Vres = _GM * (u != 0 || _f < 0 ?
+                    atanzz(z2, _f < 0) / u :
+                    Math::pi() / (2 * _E)) + _aomega2 * q * ang,
       // H+M, Eq 6-10
-      gamu = - invw * (_GM
-                       + (_aomega2 * (_q0 ? _E * qp : 3 * q * u)
-                          * (Math::sq(sbet) - 1/real(3)) / 2)) / Math::sq(uE),
+      gamu = - (_GM + (_aomega2 * qp * ang)) * invw / Math::sq(uE),
       gamb = _aomega2 * q * sbet * cbet * invw / uE,
       t = u * invw / uE;
     // H+M, Eq 6-12
@@ -231,20 +269,38 @@ namespace GeographicLib {
 
   Math::real NormalGravity::J2ToFlattening(real a, real GM,
                                            real omega, real J2) {
+    // Solve
+    //   f = e^2 * (1 -  K * e/q0) - 3 * J2 = 0
+    // for e^2 using Newton's method
+    static const real maxe_ = 1 - numeric_limits<real>::epsilon();
+    static const real eps2_ = sqrt(numeric_limits<real>::epsilon()) / 100;
     real
       K = 2 * Math::sq(a * omega) * a / (15 * GM),
-      e2 = 3 * J2;              // See Moritz (1980), p 398.
-    // Solve using Newton's method
+      J0 = (1 - 4 * K / Math::pi()) / 3;
+    if (!(GM > 0 && Math::isfinite(K) && K >= 0))
+      return Math::NaN();
+    if (!(Math::isfinite(J2) && J2 <= J0)) return Math::NaN();
+    if (J2 == J0) return 1;
+    // Solve e2 - f1 * f2 * K / Q0 - 3 * J2 = 0 for J2 close to J0;
+    // subst e2 = ep2/(1+ep2), f2 = 1/(1+ep2), f1 = 1/sqrt(1+ep2), J2 = J0-dJ2,
+    // Q0 = pi/(4*z^3) - 2/z^4 + (3*pi)/(4*z^5), z = sqrt(ep2), and balance two
+    // leading terms to give
+    real
+      ep2 = max(Math::sq(32 * K / (3 * Math::sq(Math::pi()) * (J0 - J2))),
+                -maxe_),
+      e2 = min(ep2 / (1 + ep2), maxe_);
     for (int j = 0; j < maxit_ || GEOGRAPHICLIB_PANIC; ++j) {
-      real e2a = e2,
-        ep2 = e2 / (1 - e2),
-        q0 = qf(ep2),
-        dq0 = dq(ep2) / Math::sq(1 - e2),
-        h = e2 * (1 - sqrt(e2) * K / q0) - 3 * J2,
-        dh = 1 - sqrt(e2) * K * (3 * q0 - 2 * e2 * dq0) / (2 * Math::sq(q0)),
-        de2 = - h / dh;
-      e2 = e2a + de2;
-      if (e2 == e2a)
+      real
+        e2a = e2, ep2a = ep2,
+        f2 = 1 - e2,            // (1 - f)^2
+        f1 = sqrt(f2),          // (1 - f)
+        Q0 = Qf(e2 < 0 ? -e2 : ep2, e2 < 0),
+        h = e2 - f1 * f2 * K / Q0 - 3 * J2,
+        dh = 1 - 3 * f1 * K * QG3f(e2 < 0 ? -e2 : ep2, e2 < 0) /
+                     (2 * Math::sq(Q0));
+      e2 = min(e2a - h / dh, maxe_);
+      ep2 = max(e2 / (1 - e2), -maxe_);
+      if (abs(h) < eps2_ || e2 == e2a || ep2 == ep2a)
         break;
     }
     return e2 / (1 + sqrt(1 - e2));
@@ -254,9 +310,11 @@ namespace GeographicLib {
                                            real omega, real f) {
     real
       K = 2 * Math::sq(a * omega) * a / (15 * GM),
-      e2 = f * (2 - f),
-      q0 = qf(e2 / (1 - e2));
-    return e2 * (1 - K * sqrt(e2) / q0) / 3; // H+M, Eq 2-90
+      f1 = 1 - f,
+      f2 = Math::sq(f1),
+      e2 = f * (2 - f);
+    // H+M, Eq 2-90 + 2-92'
+    return (e2 - K * f1 * f2 / Qf(f < 0 ? -e2 : e2 / f2, f < 0)) / 3;
   }
 
 } // namespace GeographicLib
diff --git a/src/PolarStereographic.cpp b/src/PolarStereographic.cpp
index 0a7fa87..a6b2ef4 100644
--- a/src/PolarStereographic.cpp
+++ b/src/PolarStereographic.cpp
@@ -2,7 +2,7 @@
  * \file PolarStereographic.cpp
  * \brief Implementation for GeographicLib::PolarStereographic class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -23,9 +23,9 @@ namespace GeographicLib {
     , _k0(k0)
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(_k0) && _k0 > 0))
       throw GeographicErr("Scale is not positive");
   }
diff --git a/src/TransverseMercator.cpp b/src/TransverseMercator.cpp
index 600b783..03777db 100644
--- a/src/TransverseMercator.cpp
+++ b/src/TransverseMercator.cpp
@@ -2,7 +2,7 @@
  * \file TransverseMercator.cpp
  * \brief Implementation for GeographicLib::TransverseMercator class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -58,9 +58,9 @@ namespace GeographicLib {
     , _n(_f / (2 - _f))
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(Math::isfinite(_f) && _f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(_k0) && _k0 > 0))
       throw GeographicErr("Scale is not positive");
 
diff --git a/src/TransverseMercatorExact.cpp b/src/TransverseMercatorExact.cpp
index 5d1a3d6..c15c81b 100644
--- a/src/TransverseMercatorExact.cpp
+++ b/src/TransverseMercatorExact.cpp
@@ -2,12 +2,12 @@
  * \file TransverseMercatorExact.cpp
  * \brief Implementation for GeographicLib::TransverseMercatorExact class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
  * The relevant section of Lee's paper is part V, pp 67--101,
- * <a href="https://dx.doi.org/10.3138/X687-1574-4325-WM62">Conformal
+ * <a href="https://doi.org/10.3138/X687-1574-4325-WM62">Conformal
  * Projections Based On Jacobian Elliptic Functions</a>.
  *
  * The method entails using the Thompson Transverse Mercator as an
@@ -53,7 +53,6 @@ namespace GeographicLib {
   TransverseMercatorExact::TransverseMercatorExact(real a, real f, real k0,
                                                    bool extendp)
     : tol_(numeric_limits<real>::epsilon())
-    , tol1_(real(0.1) * sqrt(tol_))
     , tol2_(real(0.1) * tol_)
     , taytol_(pow(tol_, real(0.6)))
     , _a(a)
@@ -67,11 +66,11 @@ namespace GeographicLib {
     , _Ev(_mv)
   {
     if (!(Math::isfinite(_a) && _a > 0))
-      throw GeographicErr("Major radius is not positive");
+      throw GeographicErr("Equatorial radius is not positive");
     if (!(_f > 0))
       throw GeographicErr("Flattening is not positive");
     if (!(_f < 1))
-      throw GeographicErr("Minor radius is not positive");
+      throw GeographicErr("Polar semi-axis is not positive");
     if (!(Math::isfinite(_k0) && _k0 > 0))
       throw GeographicErr("Scale is not positive");
   }
diff --git a/src/UTMUPS.cpp b/src/UTMUPS.cpp
index 1d5d4db..edd574c 100644
--- a/src/UTMUPS.cpp
+++ b/src/UTMUPS.cpp
@@ -2,7 +2,7 @@
  * \file UTMUPS.cpp
  * \brief Implementation for GeographicLib::UTMUPS class
  *
- * Copyright (c) Charles Karney (2008-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  **********************************************************************/
@@ -232,7 +232,7 @@ namespace GeographicLib {
       throw GeographicErr("More than 2 digits use to specify zone "
                           + Utility::str(zone1));
 
-    string hemi = zonestr.substr(q - c);
+    string hemi(zonestr, q - c);
     transform(hemi.begin(), hemi.end(), hemi.begin(), (int(*)(int))tolower);
     if (q == c && (hemi == "inv" || hemi == "invalid")) {
       zone = INVALID;
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 9d3df7a..c1048bf 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -18,8 +18,7 @@ foreach (TOOL ${TOOLS})
   set_source_files_properties (${TOOL}.cpp PROPERTIES
     OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage)
 
-  target_link_libraries (${TOOL} ${PROJECT_LIBRARIES}
-    ${QUAD_LIBRARIES} ${MPFR_LIBRARIES})
+  target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES})
 
 endforeach ()
 
diff --git a/tools/CartConvert.cpp b/tools/CartConvert.cpp
index f8f5dca..e2d29ea 100644
--- a/tools/CartConvert.cpp
+++ b/tools/CartConvert.cpp
@@ -2,7 +2,7 @@
  * \file CartConvert.cpp
  * \brief Command line utility for geodetic to cartesian coordinate conversions
  *
- * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -26,7 +26,7 @@
 
 #include "CartConvert.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -50,7 +50,7 @@ int main(int argc, char* argv[]) {
         try {
           DMS::DecodeLatLon(std::string(argv[m + 1]), std::string(argv[m + 2]),
                             lat0, lon0, longfirst);
-          h0 = Utility::num<real>(std::string(argv[m + 3]));
+          h0 = Utility::val<real>(std::string(argv[m + 3]));
         }
         catch (const std::exception& e) {
           std::cerr << "Error decoding arguments of -l: " << e.what() << "\n";
@@ -60,7 +60,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -73,7 +73,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
@@ -168,12 +168,12 @@ int main(int argc, char* argv[]) {
         if (!(str >> stra >> strb >> strc))
           throw GeographicErr("Incomplete input: " + s);
         if (reverse) {
-          x = Utility::num<real>(stra);
-          y = Utility::num<real>(strb);
-          z = Utility::num<real>(strc);
+          x = Utility::val<real>(stra);
+          y = Utility::val<real>(strb);
+          z = Utility::val<real>(strc);
         } else {
           DMS::DecodeLatLon(stra, strb, lat, lon, longfirst);
-          h = Utility::num<real>(strc);
+          h = Utility::val<real>(strc);
         }
         if (str >> strd)
           throw GeographicErr("Extraneous input: " + strd);
diff --git a/tools/ConicProj.cpp b/tools/ConicProj.cpp
index 58036dc..c24791d 100644
--- a/tools/ConicProj.cpp
+++ b/tools/ConicProj.cpp
@@ -2,7 +2,7 @@
  * \file ConicProj.cpp
  * \brief Command line utility for conical projections
  *
- * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -26,7 +26,7 @@
 
 #include "ConicProj.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -78,7 +78,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-k") {
         if (++m == argc) return usage(1, true);
         try {
-          k1 = Utility::num<real>(std::string(argv[m]));
+          k1 = Utility::val<real>(std::string(argv[m]));
         }
         catch (const std::exception& e) {
           std::cerr << "Error decoding argument of " << arg << ": "
@@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -101,7 +101,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
@@ -205,8 +205,8 @@ int main(int argc, char* argv[]) {
         if (!(str >> stra >> strb))
           throw GeographicErr("Incomplete input: " + s);
         if (reverse) {
-          x = Utility::num<real>(stra);
-          y = Utility::num<real>(strb);
+          x = Utility::val<real>(stra);
+          y = Utility::val<real>(strb);
         } else
           DMS::DecodeLatLon(stra, strb, lat, lon, longfirst);
         if (str >> strc)
diff --git a/tools/GeoConvert.cpp b/tools/GeoConvert.cpp
index f51e25b..9edcb13 100644
--- a/tools/GeoConvert.cpp
+++ b/tools/GeoConvert.cpp
@@ -2,7 +2,7 @@
  * \file GeoConvert.cpp
  * \brief Command line utility for geographic coordinate conversions
  *
- * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -25,7 +25,7 @@
 
 #include "GeoConvert.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
diff --git a/tools/GeodSolve.cpp b/tools/GeodSolve.cpp
index a31ba1f..7f971de 100644
--- a/tools/GeodSolve.cpp
+++ b/tools/GeodSolve.cpp
@@ -2,7 +2,7 @@
  * \file GeodSolve.cpp
  * \brief Command line utility for geodesic calculations
  *
- * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -63,10 +63,10 @@ std::string DistanceStrings(real s12, real a12,
 
 real ReadDistance(const std::string& s, bool arcmode) {
   using namespace GeographicLib;
-  return arcmode ? DMS::DecodeAngle(s) : Utility::num<real>(s);
+  return arcmode ? DMS::DecodeAngle(s) : Utility::val<real>(s);
 }
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     enum { NONE = 0, LINE, DIRECT, INVERSE };
@@ -141,7 +141,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -166,7 +166,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
diff --git a/tools/GeodesicProj.cpp b/tools/GeodesicProj.cpp
index 7159653..8d186fa 100644
--- a/tools/GeodesicProj.cpp
+++ b/tools/GeodesicProj.cpp
@@ -2,7 +2,7 @@
  * \file GeodesicProj.cpp
  * \brief Command line utility for geodesic projections
  *
- * Copyright (c) Charles Karney (2009-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -28,7 +28,7 @@
 
 #include "GeodesicProj.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -66,7 +66,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
@@ -183,8 +183,8 @@ int main(int argc, char* argv[]) {
         if (!(str >> stra >> strb))
           throw GeographicErr("Incomplete input: " + s);
         if (reverse) {
-          x = Utility::num<real>(stra);
-          y = Utility::num<real>(strb);
+          x = Utility::val<real>(stra);
+          y = Utility::val<real>(strb);
         } else
           DMS::DecodeLatLon(stra, strb, lat, lon, longfirst);
         if (str >> strc)
diff --git a/tools/GeoidEval.cpp b/tools/GeoidEval.cpp
index 11fc278..d80d5df 100644
--- a/tools/GeoidEval.cpp
+++ b/tools/GeoidEval.cpp
@@ -2,7 +2,7 @@
  * \file GeoidEval.cpp
  * \brief Command line utility for evaluating geoid heights
  *
- * Copyright (c) Charles Karney (2009-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2009-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -26,7 +26,7 @@
 
 #include "GeoidEval.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -221,7 +221,7 @@ int main(int argc, char* argv[]) {
               // End of i'th token
               pb = s.find_first_of(spaces, pa);
               (i == 2 ? height : (i == 0 ? easting : northing)) =
-                Utility::num<real>(s.substr(pa, (pb == std::string::npos ?
+                Utility::val<real>(s.substr(pa, (pb == std::string::npos ?
                                                  pb : pb - pa)));
             }
             p.Reset(zonenum, northp, easting, northing);
@@ -239,7 +239,7 @@ int main(int argc, char* argv[]) {
               std::string::size_type pa = s.find_last_of(spaces, pb);
               if (pa == std::string::npos || pb == std::string::npos)
                 throw GeographicErr("Incomplete input: " + s);
-              height = Utility::num<real>(s.substr(pa + 1, pb - pa));
+              height = Utility::val<real>(s.substr(pa + 1, pb - pa));
               s = s.substr(0, pa + 1);
             }
             p.Reset(s, true, longfirst);
diff --git a/tools/Gravity.cpp b/tools/Gravity.cpp
index a934fd3..21461fd 100644
--- a/tools/Gravity.cpp
+++ b/tools/Gravity.cpp
@@ -2,7 +2,7 @@
  * \file Gravity.cpp
  * \brief Command line utility for evaluating gravity fields
  *
- * Copyright (c) Charles Karney (2011-2015) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -26,7 +26,7 @@
 
 #include "Gravity.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
             throw GeographicErr("Bad hemisphere letter on latitude");
           if (!(abs(lat) <= 90))
             throw GeographicErr("Latitude not in [-90d, 90d]");
-          h = Utility::num<real>(std::string(argv[++m]));
+          h = Utility::val<real>(std::string(argv[++m]));
           circle = true;
         }
         catch (const std::exception& e) {
@@ -85,7 +85,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
diff --git a/tools/MagneticField.cpp b/tools/MagneticField.cpp
index 1b96555..09525d7 100644
--- a/tools/MagneticField.cpp
+++ b/tools/MagneticField.cpp
@@ -2,7 +2,7 @@
  * \file MagneticField.cpp
  * \brief Command line utility for evaluating magnetic fields
  *
- * Copyright (c) Charles Karney (2011-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2011-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -25,7 +25,7 @@
 
 #include "MagneticField.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -71,7 +71,7 @@ int main(int argc, char* argv[]) {
             throw GeographicErr("Bad hemisphere letter on latitude");
           if (!(abs(lat) <= 90))
             throw GeographicErr("Latitude not in [-90d, 90d]");
-          h = Utility::num<real>(std::string(argv[++m]));
+          h = Utility::val<real>(std::string(argv[++m]));
           timeset = false;
           circle = true;
         }
@@ -87,7 +87,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
@@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-T") {
         if (++m == argc) return usage(1, true);
         try {
-          tguard = Utility::num<real>(std::string(argv[m]));
+          tguard = Utility::val<real>(std::string(argv[m]));
         }
         catch (const std::exception& e) {
           std::cerr << "Error decoding argument of " << arg << ": "
@@ -106,7 +106,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-H") {
         if (++m == argc) return usage(1, true);
         try {
-          hguard = Utility::num<real>(std::string(argv[m]));
+          hguard = Utility::val<real>(std::string(argv[m]));
         }
         catch (const std::exception& e) {
           std::cerr << "Error decoding argument of " << arg << ": "
diff --git a/tools/Makefile.in b/tools/Makefile.in
index b753fcb..ff05bd1 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -352,6 +352,9 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
 POD2HTML = @POD2HTML@
 POD2MAN = @POD2MAN@
 RANLIB = @RANLIB@
@@ -402,6 +405,7 @@ mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
diff --git a/tools/Planimeter.cpp b/tools/Planimeter.cpp
index 71d13cd..d8dd6f4 100644
--- a/tools/Planimeter.cpp
+++ b/tools/Planimeter.cpp
@@ -2,7 +2,7 @@
  * \file Planimeter.cpp
  * \brief Command line utility for measuring the area of geodesic polygons
  *
- * Copyright (c) Charles Karney (2010-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2010-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -26,7 +26,7 @@
 
 #include "Planimeter.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -52,7 +52,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -65,7 +65,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
diff --git a/tools/RhumbSolve.cpp b/tools/RhumbSolve.cpp
index 7d3d03c..4bc4bac 100644
--- a/tools/RhumbSolve.cpp
+++ b/tools/RhumbSolve.cpp
@@ -2,7 +2,7 @@
  * \file RhumbSolve.cpp
  * \brief Command line utility for rhumb line calculations
  *
- * Copyright (c) Charles Karney (2014-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2014-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -47,7 +47,7 @@ std::string AzimuthString(real azi, int prec, bool dms, char dmssep) {
     DMS::Encode(azi, prec + 5, DMS::NUMBER);
 }
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     Utility::set_digits();
     bool linecalc = false, inverse = false, dms = false, exact = true,
@@ -82,7 +82,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -102,7 +102,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
diff --git a/tools/TransverseMercatorProj.cpp b/tools/TransverseMercatorProj.cpp
index 3ef94a2..9e3c247 100644
--- a/tools/TransverseMercatorProj.cpp
+++ b/tools/TransverseMercatorProj.cpp
@@ -2,7 +2,7 @@
  * \file TransverseMercatorProj.cpp
  * \brief Command line utility for transverse Mercator projections
  *
- * Copyright (c) Charles Karney (2008-2016) <charles at karney.com> and licensed
+ * Copyright (c) Charles Karney (2008-2017) <charles at karney.com> and licensed
  * under the MIT/X11 License.  For more information, see
  * http://geographiclib.sourceforge.net/
  *
@@ -27,7 +27,7 @@
 
 #include "TransverseMercatorProj.usage"
 
-int main(int argc, char* argv[]) {
+int main(int argc, const char* const argv[]) {
   try {
     using namespace GeographicLib;
     typedef Math::real real;
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-k") {
         if (++m >= argc) return usage(1, true);
         try {
-          k0 = Utility::num<real>(std::string(argv[m]));
+          k0 = Utility::val<real>(std::string(argv[m]));
         }
         catch (const std::exception& e) {
           std::cerr << "Error decoding argument of " << arg << ": "
@@ -82,7 +82,7 @@ int main(int argc, char* argv[]) {
       } else if (arg == "-e") {
         if (m + 2 >= argc) return usage(1, true);
         try {
-          a = Utility::num<real>(std::string(argv[m + 1]));
+          a = Utility::val<real>(std::string(argv[m + 1]));
           f = Utility::fract<real>(std::string(argv[m + 2]));
         }
         catch (const std::exception& e) {
@@ -95,7 +95,7 @@ int main(int argc, char* argv[]) {
       else if (arg == "-p") {
         if (++m == argc) return usage(1, true);
         try {
-          prec = Utility::num<int>(std::string(argv[m]));
+          prec = Utility::val<int>(std::string(argv[m]));
         }
         catch (const std::exception&) {
           std::cerr << "Precision " << argv[m] << " is not a number\n";
@@ -194,8 +194,8 @@ int main(int argc, char* argv[]) {
         if (!(str >> stra >> strb))
           throw GeographicErr("Incomplete input: " + s);
         if (reverse) {
-          x = Utility::num<real>(stra);
-          y = Utility::num<real>(strb);
+          x = Utility::val<real>(stra);
+          y = Utility::val<real>(strb);
         } else
           DMS::DecodeLatLon(stra, strb, lat, lon, longfirst);
         if (str >> strc)
diff --git a/tools/tests.cmake b/tools/tests.cmake
index 3b52f60..134a65d 100644
--- a/tools/tests.cmake
+++ b/tools/tests.cmake
@@ -119,7 +119,7 @@ set_tests_properties (GeodSolve4 PROPERTIES PASS_REGULAR_EXPRESSION
 add_test (NAME GeodSolve5 COMMAND GeodSolve
   -p 0 --input-string "0.01777745589997 30 0 10e6")
 set_tests_properties (GeodSolve5 PROPERTIES PASS_REGULAR_EXPRESSION
-  "90\\.00000 -150\\.00000 -180\\.00000;90\\.00000 30\\.00000 0\\.00000")
+  "90\\.00000 -150\\.00000 -?180\\.00000;90\\.00000 30\\.00000 0\\.00000")
 
 # Check fix for volatile sbet12a bug found 2011-06-25 (gcc 4.4.4 x86 -O3)
 # Found again on 2012-03-27 with tdm-mingw32 (g++ 4.6.1).
@@ -251,59 +251,59 @@ add_test (NAME GeodSolve33 COMMAND GeodSolve
 add_test (NAME GeodSolve34 COMMAND GeodSolve
   -i -p 0 --input-string "0 0 0 179" -E)
 add_test (NAME GeodSolve35 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179.5")
+  -i -p 0 --input-string "0 0 0 179.5")
 add_test (NAME GeodSolve36 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179.5" -E)
+  -i -p 0 --input-string "0 0 0 179.5" -E)
 add_test (NAME GeodSolve37 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180")
+  -i -p 0 --input-string "0 0 0 180")
 add_test (NAME GeodSolve38 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180" -E)
+  -i -p 0 --input-string "0 0 0 180" -E)
 add_test (NAME GeodSolve39 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180")
+  -i -p 0 --input-string "0 0 1 180")
 add_test (NAME GeodSolve40 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180" -E)
+  -i -p 0 --input-string "0 0 1 180" -E)
 add_test (NAME GeodSolve41 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0)
+  -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0)
 add_test (NAME GeodSolve42 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0 -E)
+  -i -p 0 --input-string "0 0 0 179" -e 6.4e6 0 -E)
 add_test (NAME GeodSolve43 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0)
+  -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0)
 add_test (NAME GeodSolve44 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0 -E)
+  -i -p 0 --input-string "0 0 0 180" -e 6.4e6 0 -E)
 add_test (NAME GeodSolve45 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0)
+  -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0)
 add_test (NAME GeodSolve46 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0 -E)
+  -i -p 0 --input-string "0 0 1 180" -e 6.4e6 0 -E)
 add_test (NAME GeodSolve47 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300)
+  -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300)
 add_test (NAME GeodSolve48 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300 -E)
+  -i -p 0 --input-string "0 0 0 179" -e 6.4e6 -1/300 -E)
 add_test (NAME GeodSolve49 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300)
+  -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300)
 add_test (NAME GeodSolve50 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300 -E)
+  -i -p 0 --input-string "0 0 0 180" -e 6.4e6 -1/300 -E)
 add_test (NAME GeodSolve51 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300)
+  -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300)
 add_test (NAME GeodSolve52 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300 -E)
+  -i -p 0 --input-string "0 0 0.5 180" -e 6.4e6 -1/300 -E)
 add_test (NAME GeodSolve53 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300)
+  -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300)
 add_test (NAME GeodSolve54 COMMAND GeodSolve
- -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300 -E)
+  -i -p 0 --input-string "0 0 1 180" -e 6.4e6 -1/300 -E)
 set_tests_properties (GeodSolve33 GeodSolve34
   PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19926189")
 set_tests_properties (GeodSolve35 GeodSolve36
   PROPERTIES PASS_REGULAR_EXPRESSION "55\\.96650 124\\.03350 19980862")
 set_tests_properties (GeodSolve37 GeodSolve38
-  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20003931")
+  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20003931")
 set_tests_properties (GeodSolve39 GeodSolve40
-  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 19893357")
+  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 19893357")
 set_tests_properties (GeodSolve41 GeodSolve42
   PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492")
 set_tests_properties (GeodSolve43 GeodSolve44
-  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20106193")
+  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20106193")
 set_tests_properties (GeodSolve45 GeodSolve46
-  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 19994492")
+  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 19994492")
 set_tests_properties (GeodSolve47 GeodSolve48
   PROPERTIES PASS_REGULAR_EXPRESSION "90\\.00000 90\\.00000 19994492")
 set_tests_properties (GeodSolve49 GeodSolve50
@@ -311,7 +311,7 @@ set_tests_properties (GeodSolve49 GeodSolve50
 set_tests_properties (GeodSolve51 GeodSolve52
   PROPERTIES PASS_REGULAR_EXPRESSION "33\\.02493 146\\.97364 20082617")
 set_tests_properties (GeodSolve53 GeodSolve54
-  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -180\\.00000 20027270")
+  PROPERTIES PASS_REGULAR_EXPRESSION "0\\.00000 -?180\\.00000 20027270")
 
 if (NOT (GEOGRAPHICLIB_PRECISION EQUAL 4 AND Boost_VERSION LESS 106000))
   # Check fix for nan + point on equator or pole not returning all nans in
@@ -346,7 +346,7 @@ add_test (NAME GeodSolve63 COMMAND GeodSolve
 add_test (NAME GeodSolve64 COMMAND GeodSolve
   -u -p 0 -I 45 0 80 -0.000000000000000003 --input-string 1e7 -E)
 set_tests_properties (GeodSolve61 GeodSolve62 GeodSolve63 GeodSolve64
-  PROPERTIES PASS_REGULAR_EXPRESSION "45\\.30632 -180\\.00000 -180\\.00000")
+  PROPERTIES PASS_REGULAR_EXPRESSION "45\\.30632 -180\\.00000 -?180\\.00000")
 
 # Check for bug in east-going check in GeodesicLine (needed to check for
 # sign of 0) and sign error in area calculation due to a bogus override
@@ -357,7 +357,7 @@ add_test (NAME GeodSolve66 COMMAND GeodSolve
   -I 30 -0.000000000000000001 -31 180 -f -u -p 0 --input-string "1e7;2e7" -E)
 set_tests_properties (GeodSolve65 GeodSolve66
   PROPERTIES PASS_REGULAR_EXPRESSION
-  "30\\.00000 -0\\.00000 -180\\.00000 -60\\.23169 -0\\.00000 -180\\.00000 10000000 90\\.06544 6363636 -0\\.0012834 0\\.0013749 0[\r\n]+30\\.00000 -0\\.00000 -180\\.00000 -30\\.03547 -180\\.00000 -0\\.00000 20000000 179\\.96459 54342 -1\\.0045592 -0\\.9954339 127516405431022")
+  "30\\.00000 -0\\.00000 -?180\\.00000 -60\\.23169 -0\\.00000 -?180\\.00000 10000000 90\\.06544 6363636 -0\\.0012834 0\\.0013749 0[\r\n]+30\\.00000 -0\\.00000 -?180\\.00000 -30\\.03547 -180\\.00000 -0\\.00000 20000000 179\\.96459 54342 -1\\.0045592 -0\\.9954339 127516405431022")
 
 # Check for InverseLine if line is slightly west of S and that s13 is
 # correctly set.
@@ -390,6 +390,21 @@ add_test (NAME GeodSolve73 COMMAND GeodSolve
 set_tests_properties (GeodSolve73
   PROPERTIES PASS_REGULAR_EXPRESSION "81\\.04623 -170\\.00000 0\\.00000")
 
+# Check fix for inaccurate areas, bug introduced in v1.46, fixed
+# 2015-10-16.
+add_test (NAME GeodSolve74 COMMAND GeodSolve
+  -i -p 10 -f --input-string "54.1589 15.3872 54.1591 15.3877")
+set_tests_properties (GeodSolve74
+  PROPERTIES PASS_REGULAR_EXPRESSION
+  # Exact area is 286698586.30197
+  "54.* 15.* 55\\.72311035.* 54.* 15.* 55\\.72351567.* 39\\.52768638.* 0\\.00035549.* 39\\.52768638.* 0\\.99999999.* 0\\.99999999.* 286698586\\.302")
+add_test (NAME GeodSolve75 COMMAND GeodSolve
+  -i -p 10 -f --input-string "54.1589 15.3872 54.1591 15.3877" -E)
+set_tests_properties (GeodSolve75
+  PROPERTIES PASS_REGULAR_EXPRESSION
+  # Exact area is 286698586.30197, but -E calculation is less accurate
+  "54.* 15.* 55\\.72311035.* 54.* 15.* 55\\.72351567.* 39\\.52768638.* 0\\.00035549.* 39\\.52768638.* 0\\.99999999.* 0\\.99999999.* 286698586\\.(29[89]|30[0-5])")
+
 # Check fix for pole-encircling bug found 2011-03-16
 add_test (NAME Planimeter0 COMMAND Planimeter
   --input-string "89 0;89 90;89 180;89 270")
diff --git a/wrapper/00README.txt b/wrapper/00README.txt
new file mode 100644
index 0000000..d935f58
--- /dev/null
+++ b/wrapper/00README.txt
@@ -0,0 +1,23 @@
+Here are some examples of calling the C++ library from C, MATLAB, and
+python.
+
+Although the geodesic capabilities of GeographicLib have been
+implemented natively in several languages.  There are no plans to do the
+same for its other capabilities since this leads to a large continuing
+obligation for maintenance and documentation.  (Note however that thet
+MATLAB/Octave library includes additional capabilities, UTM, MGRS, etc.)
+
+An alternative strategy is to call the C++ library directly from another
+language, possibly via some "wrapper" routines.  This done by
+NETGeographicLib to provide access from C#.  This was relatively easy
+because of the tight integration of C# and C++ with Visual Studio on
+Windows systems.  Providing a similar interface for other languages is
+challenging because the overall interface that GeographicLib exposes is
+reasonably large and because the details often depend on the target
+system.
+
+Nevertheless, this can be a good strategy for a user who only want to
+call a few GeographicLib routines from another language.
+
+Please contribute other examples, either for the languages given here or
+for other languages.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/geographiclib.git



More information about the Pkg-grass-devel mailing list