Fixed peculiar bug in the doubles library that should have broken all the tests by generating stack overflows. Unclear how this wasn't detected before. Fixed.