Fix unit tests to be tolerant to double precision limitations