Exemplo n.º 1
0
        public override ValueEval Evaluate(int srcCellRow, int srcCellCol, ValueEval arg0)
        {
            double d;

            try
            {
                ValueEval ve = OperandResolver.GetSingleValue(arg0, srcCellRow, srcCellCol);
                if (ve is BlankEval)
                {
                    return(NumberEval.ZERO);
                }
                if (ve is StringEval)
                {
                    // Note - asymmetric with UnaryMinus
                    // -"hello" Evaluates to #VALUE!
                    // but +"hello" Evaluates to "hello"
                    return(ve);
                }
                d = OperandResolver.CoerceValueToDouble(ve);
            }
            catch (EvaluationException e)
            {
                return(e.GetErrorEval());
            }
            return(new NumberEval(+d));
        }
Exemplo n.º 2
0
        public override ValueEval Evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0)
        {
            double d0;

            try
            {
                ValueEval ve = OperandResolver.GetSingleValue(arg0, srcRowIndex, srcColumnIndex);
                d0 = OperandResolver.CoerceValueToDouble(ve);
            }
            catch (EvaluationException e)
            {
                return(e.GetErrorEval());
            }
            if (d0 == 0.0)
            { // this '==' matches +0.0 and -0.0
                return(NumberEval.ZERO);
            }
            return(new NumberEval(d0 / 100));
        }
Exemplo n.º 3
0
        protected double SingleOperandEvaluate(ValueEval arg, int srcCellRow, int srcCellCol)
        {
            ValueEval ve = OperandResolver.GetSingleValue(arg, srcCellRow, srcCellCol);

            return(OperandResolver.CoerceValueToDouble(ve));
        }