示例#1
0
 public abstract Ops opsWith(DoubleOps x);
示例#2
0
 public override Ops opsWith(DoubleOps x)
 {
     return DOUBLE_OPS;
 }
示例#3
0
 public override Ops opsWith(DoubleOps x)
 {
     return this;
 }
示例#4
0
 public Ops opsWith(DoubleOps x)
 {
     return DOUBLE_OPS;
 }
示例#5
0
 public Ops opsWith(DoubleOps x)
 {
     return this;
 }
        private void AppendFloat(char type)
        {
            double v;

            if (!Converter.TryConvertToDouble(_opts.Value, out v))
            {
                throw PythonOps.TypeError("float argument required");
            }

            // scientific exponential format
            Debug.Assert(type == 'E' || type == 'e' ||
                         // floating point decimal
                         type == 'F' || type == 'f' ||
                         // Same as "e" if exponent is less than -4 or more than precision, "f" otherwise.
                         type == 'G' || type == 'g');

            bool forceDot = false;

            // update our precision first...
            if (_opts.Precision != UnspecifiedPrecision)
            {
                if (_opts.Precision == 0 && _opts.AltForm)
                {
                    forceDot = true;
                }
                if (_opts.Precision > 50)
                {
                    _opts.Precision = 50;
                }
            }
            else
            {
                // alternate form (#) specified, set precision to zero...
                if (_opts.AltForm)
                {
                    _opts.Precision = 0;
                    forceDot        = true;
                }
                else
                {
                    _opts.Precision = 6;
                }
            }

            type = AdjustForG(type, v);
            nfi.NumberDecimalDigits = _opts.Precision;

            // then append
            if (_opts.LeftAdj)
            {
                AppendLeftAdj(v, DoubleOps.Sign(v) >= 0, type);
            }
            else if (_opts.ZeroPad)
            {
                AppendZeroPadFloat(v, type);
            }
            else
            {
                AppendNumeric(v, DoubleOps.Sign(v) >= 0, type);
            }
            if (DoubleOps.Sign(v) < 0 && v > -1 && _buf[0] != '-')
            {
                FixupFloatMinus();
            }

            if (forceDot)
            {
                FixupAltFormDot(v);
            }
        }
示例#7
0
 private static int DoubleHash(object o)
 {
     return(DoubleOps.__hash__((double)o));
 }
示例#8
0
 public static double copysign(double x, double y)
 {
     return(DoubleOps.Sign(y) * Math.Abs(x));
 }
示例#9
0
 public static double copysign(double x, double y)
 {
     return(DoubleOps.CopySign(x, y));
 }