Actually, NEGATIVE_INFINITY is the smallest value. Not sure we should open up a JIRA for every super-minor refactoring like this though...
-Yonik http://lucidworks.com On Fri, Jun 7, 2013 at 10:29 AM, Erick Erickson <[email protected]> wrote: > Looks good, the discussion at the link you provided hurts my head <G>... > > I'd recommend you go ahead and open up a JIRA and attach a patch... > > Best > Erick > > On Fri, Jun 7, 2013 at 10:24 AM, Yogi Valani <[email protected]> wrote: >> Erica thanks for the reply and the helpful comments (I will try and follow >> convention in the future). >> >> That change is much better. With regards to Float.MIN_VALUE see >> http://stackoverflow.com/questions/9746850/min-value-of-float-in-java-is-positive-why >> >> How about we change the line and a comment stating why we use negative >> MAX_VALUE >> >> float val = -Float.MAX_VALUE; // NB. MIN_VALUE represents the smallest >> positive value and -MAX_VALUE represents the the mathematical minimum >> >> What do you think? >> >> Regards >> >> Yogi >> >> >> >> On Fri, Jun 7, 2013 at 11:55 AM, Erick Erickson <[email protected]> >> wrote: >>> >>> Thanks for looking at this... >>> >>> Couple of things: >>> 1> your code won't compile, the "doc" variable in the initialValue >>> method is undefined. >>> 2> on the "how to contribute" page, there should be links to style >>> files for Eclipse and IntelliJ >>> For instance, indents should be two spaces.... Not a big deal, but >>> if you intend to get into >>> more code it's worth the time to install it.... >>> >>> What do you think about this alternative? >>> >>> protected float func(int doc, FunctionValues[] valsArr) { >>> if (valsArr.length == 0) return 0.0f; >>> float val = Float.MIN_VALUE; >>> for (FunctionValues vals : valsArr) { >>> val = Math.max(vals.floatVal(doc), val); >>> } >>> return val; >>> } >>> >>> Best >>> Erick >>> >>> On Thu, Jun 6, 2013 at 6:53 PM, Yogi Valani <[email protected]> wrote: >>> > Hi I noticed that the function 'func' in MaxFloatFunction.java could be >>> > refactored a little, so that the if statement is only evaluated >>> > once.Should >>> > make it run a little faster over large arrays. >>> > >>> > Please share your thoughts on the change I have attached a patch file. >>> > >>> > Many thanks >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> > --------------------------------------------------------------------- >>> > To unsubscribe, e-mail: [email protected] >>> > For additional commands, e-mail: [email protected] >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
