NetLogo/NetLogo — Issue #62: BehaviorSpace: floating point error can cause last step to be skipped
Author: SethTisue
Created: 2012-01-17 18:55:44+00:00
State: open

so e.g. add this to `ProtocolTests`:

```
test("floating-point steps 1") {
val protocol = new Protocol("float 1", "", "", "", 1, true, 0, "", Nil,
List(new SteppedValueSet("foo", 0.2d, 0.025d, 0.3d)))
expect(5)(protocol.countRuns)
}
test("floating-point steps 2") {
val protocol2 = new Protocol("float 2", "", "", "", 1, true, 0, "", Nil,
List(new SteppedValueSet("foo", 0.4d, 0.05d, 0.6d)))
expect(5)(protocol2.countRuns)
}
```

on both tests you get 4 instead of 5 because the last value is skipped.

the workaround is to use a stop value of e.g. 0.30001 instead of 0.3.

reported by Steve Railsback

in order to fix this, we should probably make SteppedValueSet use BigDecimal to do its step calculations, only returning floating point values at the end