Examples of AviatorDouble


Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.cos(number)");
        }
        Number num = FunctionUtils.getNumberValue(0, args, env);

        return new AviatorDouble(Math.cos(num.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.log(number)");
        }
        Number num = FunctionUtils.getNumberValue(0, args, env);

        return new AviatorDouble(Math.log(num.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.log10(number)");
        }
        Number num = FunctionUtils.getNumberValue(0, args, env);

        return new AviatorDouble(Math.log10(num.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.tan(number)");
        }
        Number num = FunctionUtils.getNumberValue(0, args, env);

        return new AviatorDouble(Math.tan(num.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.abs(number)");
        }
        Number number = FunctionUtils.getNumberValue(0, args, env);
        if (number instanceof Double || number instanceof Float) {
            return new AviatorDouble(Math.abs(number.doubleValue()));
        }
        else {
            return new AviatorLong(Math.abs(number.longValue()));
        }
    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

    public AviatorObject call(Map<String, Object> env, AviatorObject... args) {
        if (args.length != 1) {
            throw new IllegalArgumentException("math.sqrt(number)");
        }
        Number number = FunctionUtils.getNumberValue(0, args, env);
        return new AviatorDouble(Math.sqrt(number.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 1) {
            throw new IllegalArgumentException("math.sin(number)");
        }
        Number num = FunctionUtils.getNumberValue(0, args, env);

        return new AviatorDouble(Math.sin(num.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

        if (args.length != 2) {
            throw new IllegalArgumentException("math.pow(base,exp)");
        }
        Number left = FunctionUtils.getNumberValue(0, args, env);
        Number right = FunctionUtils.getNumberValue(1, args, env);
        return new AviatorDouble(Math.pow(left.doubleValue(), right.doubleValue()));

    }
View Full Code Here

Examples of com.googlecode.aviator.runtime.type.AviatorDouble

            if (args.length != 2) {
                throw new IllegalArgumentException("Add only supports two arguments");
            }
            Number left = FunctionUtils.getNumberValue(0, args, env);
            Number right = FunctionUtils.getNumberValue(1, args, env);
            return new AviatorDouble(left.doubleValue() + right.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.