Lua SPOT
v1.0

se.krka.kahlua.stdlib
Class MathLib

java.lang.Object
  extended by se.krka.kahlua.stdlib.MathLib
All Implemented Interfaces:
JavaFunction

public final class MathLib
extends java.lang.Object
implements JavaFunction


Field Summary
static double EPS
           
 
Constructor Summary
MathLib(int index)
           
 
Method Summary
static double acos(double arg)
           
static double asin(double arg)
           
static double atan(double arg)
           
static double atan2(double arg1, double arg2)
           
 int call(LuaCallFrame callFrame, int nArguments)
          General contract

Input:
callFrame = the frame that contains all the arguments, and where all the results should be put.
nArgs = number of function arguments
callFrame.get(i) = an argument (0 <= i < nArgs)
static double exp(double x)
           
static double ipow(double base, int exponent)
           
static boolean isNegative(double vDouble)
           
static double ln(double x)
           
static double pow(double base, double exponent)
           
static void register(LuaState state)
           
static double round(double x)
          Rounds towards even numbers
static double roundToPrecision(double x, int precision)
          Rounds to keep precision decimals.
static double roundToSignificantNumbers(double x, int precision)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EPS

public static final double EPS
See Also:
Constant Field Values
Constructor Detail

MathLib

public MathLib(int index)
Method Detail

register

public static void register(LuaState state)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

call

public int call(LuaCallFrame callFrame,
                int nArguments)
Description copied from interface: JavaFunction
General contract

Input:
callFrame = the frame that contains all the arguments, and where all the results should be put.
nArgs = number of function arguments
callFrame.get(i) = an argument (0 <= i < nArgs)

Specified by:
call in interface JavaFunction
Parameters:
callFrame - - the current callframe for the function
nArguments - - number of function arguments
Returns:
N - number of return values. The N top objects on the stack are considered the return values

isNegative

public static boolean isNegative(double vDouble)

round

public static double round(double x)
Rounds towards even numbers

Parameters:
x -

roundToPrecision

public static double roundToPrecision(double x,
                                      int precision)
Rounds to keep precision decimals. Rounds towards even numbers.

Parameters:
x - the number to round
precision - the precision to round to. A precision of 3 will for instance round 1.65432 to 1.654
Returns:
the rounded number

roundToSignificantNumbers

public static double roundToSignificantNumbers(double x,
                                               int precision)

exp

public static double exp(double x)

ln

public static double ln(double x)

pow

public static double pow(double base,
                         double exponent)

ipow

public static double ipow(double base,
                          int exponent)

atan

public static double atan(double arg)

atan2

public static double atan2(double arg1,
                           double arg2)

asin

public static double asin(double arg)

acos

public static double acos(double arg)

Lua SPOT
v1.0