commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject [Math] Formatting (Was: svn commit: r1379270 - /commons/proper/math/trunk/...)
Date Fri, 31 Aug 2012 12:49:19 GMT
Hello S├ębastien.

> Author: celestin
> Date: Fri Aug 31 03:12:16 2012
> New Revision: 1379270
> 
> URL: http://svn.apache.org/viewvc?rev=1379270&view=rev
> Log:
> MATH-849: changed boundary case x = 8.0 in double Gamma.logGamma(double).
> 
> Modified:
>     commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
> 
> Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
> URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java?rev=1379270&r1=1379269&r2=1379270&view=diff
> ==============================================================================
> --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
(original)
> +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/special/Gamma.java
Fri Aug 31 03:12:16 2012
> @@ -222,9 +222,9 @@ public class Gamma {
>       * Returns the value of log&nbsp;&Gamma;(x) for x&nbsp;&gt;&nbsp;0.
>       * </p>
>       * <p>
> -     * For x &lt; 8, the implementation is based on the double precision
> +     * For x &le; 8, the implementation is based on the double precision

My personal taste would be to write this as
---
 {@code x <= 8}
---
[As I'm not an HTML parser, it always takes me a few moments to figure out a
sequence such as "x &lt; 8", while it is easier to focus on the central part
of "{@code x <= 8}".]

So, if nobody disagrees, this could become a formatting rule. [The rationale
(to be included in the document you proposed to create) would be that
Javadoc comments should be as easy as possible to read in their source form,
for the developer's sake.]


Best regards,
Gilles

>       * implementation in the <em>NSWC Library of Mathematics Subroutines</em>,
> -     * {@code DGAMLN}. For x &ge; 8, the implementation is based on
> +     * {@code DGAMLN}. For x &gt; 8, the implementation is based on
>       * </p>
>       * <ul>
>       * <li><a href="http://mathworld.wolfram.com/GammaFunction.html">Gamma
> @@ -249,7 +249,7 @@ public class Gamma {
>              return logGamma1p(x) - FastMath.log(x);
>          } else if (x <= 2.5) {
>              return logGamma1p((x - 0.5) - 0.5);
> -        } else if (x < 8.0) {
> +        } else if (x <= 8.0) {
>              final int n = (int) FastMath.floor(x - 1.5);
>              double prod = 1.0;
>              for (int i = 1; i <= n; i++) {
> 
> 

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


Mime
View raw message