commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [Math] MATH-740 (FastMath's slow methods)
Date Sun, 05 Aug 2012 02:40:47 GMT
Looks right.

Is strict equality correct in the first case? or should that be x <= -1?

On Sat, Aug 4, 2012 at 5:33 PM, Gilles Sadowski <
gilles@harfang.homelinux.org> wrote:

> Hi.
>
> I notice this code at the top of "FastMath.log1p":
> ---CUT---
>         if (x == -1) {
>             return x/0.0;   // -Infinity
>         }
>
>         if (x > 0 && 1/x == 0) { // x = Infinity
>             return x;
>         }
>  ---CUT---
>
> which I'm tempted to rewrite as:
> ---CUT---
>         if (x == -1) {
>             return Double.NEGATIVE_INFINITY;
>         }
>
>         if (x == Double.POSITIVE_INFINITY) {
>             return Double.POSITIVE_INFINITY;
>         }
> ---CUT---
>
> Any objection?
>
>
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message