#8435·pymc

BUG: Cauchy 和 StudentT 的 logcdf 在下尾部返回 -inf,而真实值是有限的

作者: siddhant-shahhh创建于 2026年9月14日更新于 2026年9月14日
标签bug

Describe the issue: logcdf for Cauchy and StudentT drifts in the lower tail and eventually returns -inf, where the true value is finite and nowhere near the limits of a float. In both cases it comes from cancellation in the argument handed to log. Cauchy(0, 1): | value | pm.logcdf | scipy | abs err | --- | --- | --- | --- | -1e12 | -28.7759535 | -28.7757510 | 2.0e-04 | -1e14 | -33.3868965 | -33.3809212 | 6.0e-03 | -1e15 | -35.8205098 | -35.6835063 | 1.4e-01 | -1e16 | -inf | -37.9860914 | -1e20 | -inf | -47.1964317 | StudentT(nu, 0, 1) — the -inf kicks in somewhere between -7e7 (nu=1) and -4e8 (nu=30), and the last finite values before that are already off by up to ~2 nats: | nu | value | pm.logcdf | scipy | --- | --- | --- | --- | 1 | -1e8 | -inf | -19.5654106 | 2 | -1e8 | -37.4299478 | -37.5345087 | 2 | -1e9 | -inf | -42.1396789 | 5 | -1e8 | -91.8824720 | -89.8531475 | 5 | -1e9 | -inf | -101.366073 | PyMC's own logp is still finite at those same points. For Cauchy(0, 1) at value=-1e16, logp gives -74.83 while logcdf gives -inf: the density is finite but the cumulative probability is reported as exactly zero, and those can't both be right. This isn't just a precision complaint. logcdf is what pm.Censored and the truncated distributions call, so a censored or truncated Cauchy/StudentT with a low bound ends up with an -inf logp and the sampler is stuck.