Fix to handling of double precision values, and improved test cases for this