commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: svn commit: r1179928 - in [...]
Date Fri, 07 Oct 2011 12:06:49 GMT




On Oct 7, 2011, at 2:59 AM, gilles@harfang.homelinux.org wrote:

> On Fri, Oct 07, 2011 at 03:20:40AM -0000, psteitz@apache.org wrote:
>> Author: psteitz
>> Date: Fri Oct  7 03:20:39 2011
>> New Revision: 1179928
>> 
>> URL: http://svn.apache.org/viewvc?rev=1179928&view=rev
>> Log:
>> Javadoc fixes.
>> 
>> Modified:
>> [...]
>>    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/function/Sinc.java
> 
>> [...]
> 
>> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/function/Sinc.java
>> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/function/Sinc.java?rev=1179928&r1=1179927&r2=1179928&view=diff
>> ==============================================================================
>> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/function/Sinc.java
(original)
>> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/function/Sinc.java
Fri Oct  7 03:20:39 2011
>> @@ -21,7 +21,11 @@ import org.apache.commons.math.analysis.
>> import org.apache.commons.math.util.FastMath;
>> 
>> /**
>> - * Sinc function.
>> + * Sinc function, defined by <pre><code>
>> + *
>> + * sinc(x) = 1 if abs(x) < 1e-9;
>> + *           sin(x) / x; otherwise
>> + * </code></pre>
> 
> I would not document the first part of the alternative since it is an
> implementation detail.  "1e-9" was chosen just because, with "double"
> precision, the function value will be indistinguishable from 1. Strictly
> speaking it is not part of the definition of "sinc". [This part of the
> implementation could even be removed if it is deemed that we lose more time
> doing the check than we gain when the user asks the value of points below
> 1e-9.]
> 
> Also, there probably should not be a ";" after the statements.

If it a) makes a difference in the returned result and b) is correct (up to double equality),
I think we should leave the check in and document it.   We should always document top-coding
or other departures from the formulas we define things by. 

I am fine changing the semicolons (which are being used as punctuation) to commas or even
dropping them altogether. 

Phil
> 
> 
> Regards,
> Gilles
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 

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


Mime
View raw message