numenta/htm.java

Bug in util/ArrayUtils.java clip

angers2807 opened this issue · 1 comments

public static double[] clip(double[] values, double min, double max) { for (int i = 0; i < values.length; i++) { values[i] = Math.min(1, Math.max(0, values[i])); } return values; }
Doesn't ever reference the min and max parameters, instead it always clips to 0,1
This doesn't currently cause a problem because the only usages (in SpatialPooler) call it with params that currently happen to be 0,1 (c.getSynPermMin(), c.getSynPermMax())
However this is a bug just waiting to happen

Sorry, I'm not setup to make contributions

Hi @angers2807,

Thanks! good catch! We'll take a look...