|
From: Nicolai L. <nl...@cb...> - 2010-05-27 09:30:19
|
Kakhkhor Abdijalilov <kabdijalilov <at> gmail.com> writes: > > Bug Report: > > Where: In "normaldistribution.cpp". > What: Undefined behavior or floating point exception. > Severity: Subtle. > Burden: Easy to fix. See below. > > Description. > If the argument x is close to 0.0 or 1.0, the implementation sets it > exactly to 0.0 or 1.0. > This leads to an attempt to evaluate std::log(0.0) or std::log(1.0). > I propose that we cut it at x=1E-12 and x = 1 - 1E-12, which covers > all draws between > plus/minus 7 standard deviations. Any argument value beyond that range > should be considered > as either erroneous or astronomically improbable. > > Regards, > Kakhkhor Abdijalilov. I am currently looking into replacing the Quantlib implementation of statistical distributions with the implementation provided by Boost. The best solution (in my opinion anyway) would be to get totally rid of the Quantlib distribution folder and rely totally on Boost - this would eliminate a layer of indirection but it would break backward compatibility. Therefore I have currently just replaced the internal parts of the Quantlib normaldistribution.xpp with the Boost implementation. Unfortunately these makes some testcases fail, and I am currently looking into why this can be. If someone is interested I can post my modified normaldistribution.xpp files here. Br, Nicolai |