
Paul A. Bristow wrote:
Often you just want to return a NaN, infinity or a 'best guess'.
So John devised the rather complicated - but very useful - policies.
Most important they are needed to provide the C++ Standard library C-style error behaviour.
Hi Paul, John, I'm trying get a better feel on your wanted error checking/validation behavior in the dist lib. If I get the objective, then I'll know better what type of code to write. I we have the following code that constructs a faulty distribution and uses that in follow-up steps, what would be wanted behavior regarding error handling? 1: normal N(0,0); // a normal distribution with invalid std 2: double y = pdf(N, 0.3); 3: double k = kurtosis(N); Case 1: strict, formal 1:throw an error "invalid std" 2:throw an error "invalid dist passed to pdf" 3:throw an error "invalid dist passed to kurtosis" Case 2: minimalistic 1:throw an error "invalid std" 2:*no* checking of disk, divide by zero error 3: return "0", all valid normal distribution have a kurtosis of 0. We don't even have to look at the distribution details Case 3: error tolerant, but preventing numerical errors 1:throw an error "invalid std" 2:throw an error "invalid dist passed to pdf" 3: return "0", all valid normal distribution have a kurtosis of 0. We don't even have to Cheers, thijs -- SITMO Quantitative Financial Consultancy - Software Development M.A. (Thijs) van den Berg Tel.+31 (0)6 2411 0061 Fax.+31 (0)15 285 1984 thijs@sitmo.com <mailto:thijs@sitmo.com> - www.sitmo.com <http://www.sitmo.com>