Changeset 456f083 in tol


Ignore:
Timestamp:
Oct 23, 2011, 10:11:40 PM (15 years ago)
Author:
Víctor de Buen <vdebuen@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
8c7c57b
Parents:
4d26434
Message:

Relaxing comparisons to avoid numerical problems with truncation intervals near to zero density

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3778 be4846ae-f051-483a-831f-b64e7d08527f

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tol/bmath/bprdist/prd.cpp

    r4d26434 r456f083  
    792792  if(useLeft_)
    793793  {
    794     FAB_ = FB_-FA_;
     794    FAB_ = (FB_-FA_+1.E+4)-1.E+4;
    795795  }
    796796  else
    797797  {
    798     FAB_ = F1A_-F1B_;
     798    FAB_ = (F1A_-F1B_+1.E+4)-1.E+4;
    799799  }
    800800  if(FAB_<0)
    … …  
    838838{
    839839  if(wrongParameter_ || prob.IsUnknown()) { return(BDat::Unknown()); }
    840   if(A_==B_)  { return(A_); }
    841   if(!FAB_)
     840  if(A_+1.0==B_+1.0)  { return(A_); }
     841  if(FAB_<1.E-8)
    842842  {
    843843    BDat C = NonTruncated().Average();
    844          if(A_>C) { return(A_); }
    845     else if(B_<C) { return(B_); }
     844         if(A_+1.0>C+1.0) { return(A_); }
     845    else if(B_+1.0<C+1.0) { return(B_); }
    846846    {
    847847      BDat a = A_;
    … …  
    860860//--------------------------------------------------------------------
    861861{
    862   if(A_==B_)  { return(A_); }
     862  if(A_+1.0==B_+1.0)  { return(A_); }
    863863  return(Inverse(BUniformDist::Random01()));
    864864}
Note: See TracChangeset for help on using the changeset viewer.