seems to work, ish, but now there's a precision issue for p=1-epsilon