commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Al Chou <hotfusion...@yahoo.com>
Subject Re: [math] Static Utils and Methods (was: Re: [math] proposed ordering for task list, scope of initial release)
Date Tue, 10 Jun 2003 23:19:56 GMT
--- "O'brien, Tim" <tobrien@transolutions.net> wrote:
> On Tue, 2003-06-10 at 16:26, Mark R. Diggory wrote:
> > [-1]
> > 
> > Um, I'm not too clear on this one, how is calling 
> > MathUtils.isPositive(d) clearer than (d >= 0)?
> 
> [+0], Mark, if I follow the discussion correctly, the concept isn't
> trying to ascertain if a given number is greater than or equal to zero. 
> I believe that the discussion revolved around the mathematical concept
> of "Positive".  Is a given number "positive" is a different question
> from is a given number greater than or equal to zero - depending on your
> specific definition and needs.
> 
> An application that needs to test for a Non-negative numbers, would
> benefit from a isNonNegative method.  Even though, the function simply
> contains d >= 0.  MathUtils.isNonNegative( 3 ) is conceptually different
> from 3 >= 0.  Personally, I would choose, "3 >= 0", but if a programmer
> wished to invoke that operation via MathUtils.isNonNegative to attain a
> sort of conceptual "purity", I don't think this is our decision to make.
> 
> > I included Al's functions because they were a little more complex than 
> > that, they provided different return type when dealing with different 
> > evaluations. Of course these could be captured inline quite easily as 
> > well with examples like:
> > 
> > d >= 0 ? 1d : -1d
> > d > 0 ? 1d : -1d
> 
> I'm not sure why that function would not return a boolean primitive,
> anyone have any good reasons not to?

I needed a function that returned a number so I could multiply by it.


> > definitely reinvents the wheel in a very big way. I think in general its 
> > best to keep static functions in MathUtil's that simplify complex 
> > calculations like factorials.
> 
> Again, I can see someone wanting these functions if one wants to be
> absolutely sure that they are complying with strict conceptual
> definitions in a very large system.  I don't personally have a need for
> isPositive, but that isn't to say that Al hasn't found a good reason to
> use them in the past.  
> 
> Al?  what was the motivation here?

Wasn't my idea in the first place, I think it was Brent's.



Al

=====
Albert Davidson Chou

    Get answers to Mac questions at http://www.Mac-Mgrs.org/ .

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message