IsNegativeZero() static private method

static private IsNegativeZero ( double value ) : bool
value double
return bool
コード例 #1
0
ファイル: ComplexOps.cs プロジェクト: leo459028/ironpython3
        public static string __str__(CodeContext /*!*/ context, Complex x)
        {
            if (x.Real != 0)
            {
                if (x.Imaginary() < 0 || DoubleOps.IsNegativeZero(x.Imaginary()))
                {
                    return("(" + FormatComplexValue(context, x.Real) + FormatComplexValue(context, x.Imaginary()) + "j)");
                }
                else   /* x.Imaginary() is NaN or >= +0.0 */
                {
                    return("(" + FormatComplexValue(context, x.Real) + "+" + FormatComplexValue(context, x.Imaginary()) + "j)");
                }
            }

            return(FormatComplexValue(context, x.Imaginary()) + "j");
        }
コード例 #2
0
        public static string __str__(CodeContext /*!*/ context, Complex x)
        {
            string j = (double.IsInfinity(x.Imaginary()) || double.IsNaN(x.Imaginary())) ? "*j" : "j";

            if (x.Real != 0)
            {
                if (x.Imaginary() < 0 || DoubleOps.IsNegativeZero(x.Imaginary()))
                {
                    return("(" + FormatComplexValue(context, x.Real) + FormatComplexValue(context, x.Imaginary()) + j + ")");
                }
                else   /* x.Imaginary() is NaN or >= +0.0 */
                {
                    return("(" + FormatComplexValue(context, x.Real) + "+" + FormatComplexValue(context, x.Imaginary()) + j + ")");
                }
            }

            return(FormatComplexValue(context, x.Imaginary()) + j);
        }