Add filter to normalize numbers.

Numbers are stored internally as strings. To ensure that +1 == 1 and
0 == -0 == +0, some re-writing of the strings has to be performed.
Instead of doing the re-writing everywhere it's needed. A filter
function was implemented to do the work.

During testing some numerical bugs were discovered and fixed. Test
cases were added to ensure they don't come back.
Use valgrind to check for memory leaks/errors.