bugGNU Scientific Library - Bugs: bug #44612, Bug in vegas.c

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #44612: Bug in vegas.c

Submitter:  Patrick Alken <psa>
Submitted:  Mon 23 Mar 2015 08:21:35 PM UTC
   
 
Category:  Runtime error Severity:  3 - Normal
Operating System:  Status:  None
Assigned to:  None Open/Closed:  Open
Release: 

Mon 23 Mar 2015 08:21:35 PM UTC, original submission:  

From diazona =at= ellipsix =dot= net

I'm fairly sure I've identified a small bug in the VEGAS implementation: in
lines 280-283 of vegas.c on the master branch,

    if (var > 0) { wgt = 1.0 / var; }

very small but nonzero values of var (like 1e-322) will cause wgt to be set
to inf, and that in turn causes gsl_monte_vegas_integrate to return nan.
The logical fix seems to be to treat any value of var satisfying
1.0/var==inf as zero, i.e.

-    if (var > 0)
+    if (var > 0 && gsl_finite(1.0 / var))

I don't know if that would break anything else, but I can't imagine how.
Thoughts?

I can send a proper patch file if desired (it's on my other computer).

 David

Patrick Alken <psa>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #33433:  gsl_vegas_bug_demo.c added by psa (2KiB - text/x-csrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Submitted the item)
  •  

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-23 psa Attached File- Added gsl_vegas_bug_demo.c, #33433

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code