Explicit typecasting to avoid a bug where Pr is occasionally reported as NaN