id summary reporter owner description type status milestone component version severity resolution keywords cc 7177 Students t returns rubbihs values for undefined input instead of throw Paul A. Bristow Paul A. Bristow "Reported by Thomas Mang According to the documentation, in boost 1-50 non-member functions of moments (e.g. mean, variance) which are not defined for a given distribution shall issue compile-time errors, or throw a domain_error at runtime otherwise. For the Cauchy Distribution, that's what it does. For the t-distribution, that's not what it does - the non-member functions happily return some complete rubbish values for mean and variance (and hence I'd also suppose standard deviation). For kurtosis and skewness it seems to work correctly but are subject to mathematical definitions. I have not tested other non-member functions. typedef boost::math::students_t_distribution t_distr; // this is ok std::cout << ""mean(t(2)): "" << boost::math::mean( t_distr(2) ) << std::endl; // this is NOT ok - first moment not defined for given distribution std::cout << ""mean(t(1)): "" << boost::math::mean( t_distr(1) ) << std::endl; // this is ok std::cout << ""var(t(3)): "" << boost::math::variance( t_distr(3) ) << std::endl; // this might be ok or not // depending on point of view, either Inf or undefined std::cout << ""var(t(2)): "" << boost::math::variance( t_distr(2) ) << std::endl; // this is NOT ok - second moment not defined for the given distribution std::cout << ""var(t(1)): "" << boost::math::variance( t_distr(1) ) << std::endl; " Bugs closed Boost 1.52.0 math Boost Development Trunk Problem fixed math students t