split out common double-precision unit test code