htm.java icon indicating copy to clipboard operation
htm.java copied to clipboard

Bug in util/ArrayUtils.java clip

Open angers2807 opened this issue 8 years ago • 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

angers2807 avatar Feb 06 '18 03:02 angers2807

Hi @angers2807,

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

cogmission avatar Feb 07 '18 23:02 cogmission