/** * Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. */ public static double random() { return ScriptHelper.evalDouble("Math.random()", null); }
/** * Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 * from this random number generator's sequence. */ public double nextDouble() { return ScriptHelper.evalDouble("Math.random()", this); }
/** * Returns the trigonometric cosine of an angle. */ public static double cos(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.cos(a)", null); }
/** * Returns the absolute value of a double value. */ public static double abs(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.abs(a)", null); }
/** * Returns the trigonometric sine of an angle. */ public static double sin(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.sin(a)", null); }
/** * Returns the trigonometric tangent of an angle. */ public static double tan(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.tan(a)", null); }
/** * Returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2. */ public static double atan(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.atan(a)", null); }
/** * Returns the smallest (closest to negative infinity) double value that is greater than * or equal to the argument and is equal to a mathematical integer. */ public static double ceil(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.ceil(a)", null); }
/** * Returns the largest (closest to positive infinity) double value that is less than * or equal to the argument and is equal to a mathematical integer. */ public static double floor(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.floor(a)", null); }
public static double signum(double d) { ScriptHelper.put("x", d, null); return ScriptHelper.evalDouble("x?x<0?-1:1:0", null); }
/** * Returns the arc sine of a value; the returned angle is in the range -pi/2 through pi/2. */ public static double asin(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.asin(a)", null); }
/** * Returns the arc cosine of a value; the returned angle is in the range 0.0 through pi. */ public static double acos(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.acos(a)", null); }
/** * Returns the correctly rounded positive square root of a double value. */ public static double sqrt(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.sqrt(a)", null); }
public static double log(double a) { ScriptHelper.put("a", a, null); return ScriptHelper.evalDouble("Math.log(a)", null); }
public static double exp(double x) { ScriptHelper.put("x", x, null); return ScriptHelper.evalDouble("Math.exp(x)", null); }
public static double log10(double a) { ScriptHelper.put("x", a, null); return ScriptHelper.evalDouble("(Math.log(x)) / (Math.log(10))", null); }
/** * Returns the greater of two double values. */ public static double max(double a, double b) { ScriptHelper.put("a", a, null); ScriptHelper.put("b", b, null); return ScriptHelper.evalDouble("Math.max(a, b)", null); }
public static double atan2(double y, double x) { ScriptHelper.put("y", y, null); ScriptHelper.put("x", x, null); return ScriptHelper.evalDouble("Math.atan2(y, x)", null); }
/** * Returns the smaller of two double values. */ public static double min(double a, double b) { ScriptHelper.put("a", a, null); ScriptHelper.put("b", b, null); return ScriptHelper.evalDouble("Math.min(a, b)", null); }
public static double pow(double a, double b) { ScriptHelper.put("a", a, null); ScriptHelper.put("b", b, null); return ScriptHelper.evalDouble("Math.pow(a, b)", null); }