math: add double precision error handling functions