This reverts commit 494dee0f. Related to the other reverts, causes test failure due to nan/inf mismatch.