Examples of ExprDouble


Examples of org.boris.expr.ExprDouble

    public static Expr sum(Expr[] args) throws ExprException {
        double res = 0;
        for (Expr arg : args)
            res += sum(arg);
        return new ExprDouble(res);
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

    protected Expr evaluate(Counter counter) throws ExprException {
        double n = counter.count;
        double kurt = (n * (n + 1) / ((n - 1) * (n - 2) * (n - 3))) *
                counter.value3 - (3 * Math.pow(n - 1, 2)) / ((n - 2) * (n - 3));
        return new ExprDouble(kurt);
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

            return ExprError.NUM;

        if (cost == 0)
            return ExprDouble.ZERO;

        return new ExprDouble(Financials.db(cost, salvage, life, period, month));
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr a = evalArg(args[0]);
        if (a instanceof ExprString) {
            return new ExprDouble(2);
        } else if (a instanceof ExprInteger || a instanceof ExprDouble) {
            return new ExprDouble(1);
        } else if (a instanceof ExprBoolean) {
            return new ExprDouble(4);
        } else if (a instanceof ExprArray) {
            return new ExprDouble(64);
        } else {
            return new ExprDouble(16);
        }
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

        String str = null;
        if (a instanceof ExprString)
            str = ((ExprString) a).str;
        else
            str = a.toString();
        return new ExprDouble(str.length());
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

        if ((val < 0 && rnd > 0) || (val > 0 && rnd < 0))
            return ExprError.NUM;
        double m = val % rnd;
        if (rnd < 0)
            rnd = 0;
        return new ExprDouble(val - m + rnd);
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

        values[0] = values[1] = 0;

        for (Expr a : args)
            eval(a, average, values, true);

        return new ExprDouble(values[0] / (values[1] - (allPopulation ? 0 : 1)));
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

    public static Expr stdev(Expr[] args, boolean allPopulation)
            throws ExprException {
        Expr res = variance(args, allPopulation);
        if (res instanceof ExprDouble) {
            res = new ExprDouble(Math.sqrt(((ExprDouble) res).doubleValue()));
        }
        return res;
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

{
    public Expr evaluate(Expr[] args) throws ExprException {
        assertArgCount(args, 1);
        Expr e = args[0];
        if (e instanceof ExprVariable) {
            return new ExprDouble(1);
        }
        return null;
    }
View Full Code Here

Examples of org.boris.expr.ExprDouble

        assertArgCount(args, 1);
        double value = asDouble(args[0], true);
        if (value < 0)
            return ExprError.NUM;

        return new ExprDouble(Statistics.factorial((int) value).doubleValue());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.