[Repast-developer] [ repast-Bugs-1372204 ] off by one for float parms in parameter file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Repast-developer] [ repast-Bugs-1372204 ] off by one for float parms in parameter file

SourceForge.net
Bugs item #1372204, was opened at 2005-12-02 21:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1372204&group_id=1703

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Repast J
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Kenrick Mock (kenrickm)
Assigned to: Nobody/Anonymous (nobody)
Summary: off by one for float parms in parameter file

Initial Comment:
There are inconsistent results for the number of runs
with small floats.  Sometimes the runs will include
current==end, and sometimes the runs will exclude
current==end.  For example, in a parameter file such as
the following:

Parm {
  start: 0.80
  end: 1.0
  incr: 0.05
}

The simulation generates runs for Parm = 0.8, 0.85,
0.9, and stops at 0.95.

If start is changed to 0.85 then the simulation
generates runs for Parm = 0.85, 0.9, 0.95, and stops at
1.0.

This appears to stem from the code in increment() in
AddIncrementer.java which is:

    curVal += incr;
    if (curVal > end) {
      retVal = false;
      curVal = start;
    }

since curVal and end are both doubles, due to floating
point inaccuracies sometimes curVal may be slightly
larger than end and stop the run, when the two should
be considered equal.  A workaround is to make end equal
to something like 1.0001.


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101703&aid=1372204&group_id=1703


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Repast-developer mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-developer