Closed apiss2 closed 1 week ago
The method v_w it is used to computes the mean and variance of a truncated Gaussian. This is a well known problem so maybe we can use a tested solution of another package, to ensure no error. Did you encounter a specific ZeroDivisionError in the v_w function? If so, do you can replicate the bug?
It is a good point to avoid possible floting-point caclutations errors that may occur for example in math.sqrt(1-w).
Handling ZeroDivisionError in the v_w Function
It is possible that cdf(-_alpha, 0, 1) or (cdf(_beta, 0, 1) - cdf(_alpha, 0, 1)) could become zero. What values of v or w are expected when a division by zero occurs?
Additionally, due to floating-point calculation errors, w might exceed 1. In such cases, the math.sqrt(1-w) within the trunc function might throw an error. Is it necessary to implement special handling for cases where w exceeds 1?