Re: [Boost-bugs] [Boost C++ Libraries] #9672: PDF and CDF of a laplace distribution throwing domain_error

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9672: PDF and CDF of a laplace distribution throwing domain_error
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-20 07:53:37

#9672: PDF and CDF of a laplace distribution throwing domain_error
  Reporter: HS <tan@…> | Owner: pbristow
      Type: Feature Requests | Status: closed
 Milestone: Boost 1.56.0 | Component: math
   Version: Boost Development Trunk | Severity: Showstopper
Resolution: fixed | Keywords: laplace

Comment (by HS <tan@…>):

 Replying to [comment:6 pbristow]:
> Good :-)
> Useful to have a professional statistician's view on when infinity
 should always be supported.
> In a sense, we already provide a way of achieving this view policies.
 If you implement a policy to ignore domain and or overflow errors, then
 you will get a NaN. You can achieve this now but studying the examples of
 using policies.
> When Boost.Math was first developed, the implementation of infinity and
 NaN was poorly and/or inconsistently supported, so our instinct was to
 duck the issues.
> But then John devised the 'policies' control of what happens when
 overflow or domain error is encountered. (This allows us to mimic what
 happens when you have C view of error handling and error return codes).
> Also other parts of Boost.Math have been extended to make it appear that
 infinity and NaN are fully supported. So we have started to permit
 infinity in some cases, but not all because of the work involved to
 changes things (and the many tests) in all the many functions. It has
 become a bit labyrinthine as a consequence. I'll put a fuller review on my
 TODO list.

 Dear Paul,

 Sorry for the late response---trying to get use to modular-boost and "git

 Thanks for the reminder about policies---it is a beautiful pattern and I
 feel it is very well implemented in boost::math.

 Yes, I do use my own policies. While exceptions and/or error numbers are
 great tools in programming, I (as a statistician) do not find them useful
 here for me with distributions: for example, if any of the distribution
 parameters are invalid, then any caller (programmer or actual user) should
 get a "non-answer" (implemented by silent NaN which is wonderful since it
 "propagates")---no need to "leak" an exception; and each "proper"
 distribution (meaning all its parameters are valid) should also returns
 NaN when the input value is NaN.

 Thanks for including +-infinity as possible input values ... they do
 represent the sets of "large" (and "small") numbers ... and we do want to
 return 0 as the P-value when a test statistic is "infinite" (or "large" in
 mathematical sense).

 Let me know if you would like an extra pair of eyes to look over your
 proposed changes: I am not very good in reading code but I think I am a
 better reader of documents. :)

 With best regards,[[br]]

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC