DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24962

[math] MathUtils.sign(NaN) returns -1 instead of NaN





------- Additional Comments From [EMAIL PROTECTED]  2003-11-25 23:06 -------
All we're talking about is consistent behavior with NaN's in this case though,
not dramatically altering the behavior of this function... Does a NaN have a
sign? And is the Complex functionality its used in above become inaccurate when
this is the case? I suggest leaving the method the same name and focusing on the
conditions properly being handled where it is used. All we're really talking
about is what is the proper way to handle NaN, a discussion we often seem to
have ;-) I'm suggesting something liek the following:

    /**
     * For a double precision value x, this method returns +1.0 if x >= 0
     * and -1.0 if x < 0.
     * @param x the value, a double
     * @return +1.0 or -1.0, depending on the the sign of x
     */
    public static double sign(final double x) {
        if (Double.isNaN(x))){
            return Double.NaN;
        } else if (x >= 0.0) {
            return 1.0;
        } else {
            return -1.0;
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to