Use new macros to make sure LC_NUMERIC is correctly set
This uses the macros added in the previous commit to make sure the
current LC_NUMERIC locale is correct during the operation being done;
restoring it to its prior condition afterwards. Outside of 'use locale'
the locale should be C; inside it should be the underlying default
locale. The macros handle the whole thing. In most of the places here,
the code was trying to do what the macros do more elegantly, but there
are some additional places where we set the locale correctly around an
operation that is affected by it.