com.caucho.quercus.lib
Class MathModule

java.lang.Object
  extended by com.caucho.quercus.module.AbstractQuercusModule
      extended by com.caucho.quercus.lib.MathModule
All Implemented Interfaces:
QuercusModule

public class MathModule
extends AbstractQuercusModule

PHP math routines.


Field Summary
static double M_1_PI
           
static double M_2_PI
           
static double M_2_SQRTPI
           
static double M_E
           
static double M_EULER
           
static double M_LN10
           
static double M_LN2
           
static double M_LNPI
           
static double M_LOG10E
           
static double M_LOG2E
           
static double M_PI
           
static double M_PI_2
           
static double M_PI_4
           
static double M_SQRT1_2
           
static double M_SQRT2
           
static double M_SQRT3
           
static double M_SQRTPI
           
static long RAND_MAX
           
 
Fields inherited from class com.caucho.quercus.module.AbstractQuercusModule
PHP_INI_ALL, PHP_INI_PERDIR, PHP_INI_SYSTEM, PHP_INI_USER
 
Constructor Summary
MathModule()
           
 
Method Summary
static Value abs(Value value)
           
static double acos(double value)
           
static double acosh(Env env, double value)
           
static Value asin(Value value)
           
static double asinh(double value)
           
static double atan(double value)
           
static double atan2(double yV, double xV)
           
static double atanh(double value)
           
static Value base_convert(Env env, StringValue str, int fromBase, int toBase)
          Convert a number between arbitrary bases
static Value bindec(Env env, StringValue bin)
          Returns the decimal equivalent of the binary number represented by the binary string argument.
static double ceil(double value)
           
static double cos(double value)
           
static double cosh(double value)
           
static StringValue decbin(Env env, long value)
          Returns a binary representation of a number.
static StringValue dechex(Env env, long value)
          Returns a hexadecimal representation of a number.
static StringValue decoct(Env env, long value)
          Returns an octal representation of a number.
static double deg2rad(double value)
           
static Value exp(Value value)
           
static Value expm1(Value value)
           
static Value floor(Value value)
           
static double fmod(double xV, double yV)
           
static Value getrandmax()
           
static Value hexdec(Env env, StringValue s)
           
static double hypot(double a, double b)
           
static boolean is_finite(Value value)
           
static Value is_infinite(Value value)
           
static Value is_nan(Value value)
           
static double lcg_value()
           
static double log(double value)
           
static double log10(double value)
           
static double log1p(double value)
           
static Value max(Env env, Value[] args)
           
static Value min(Env env, Value[] args)
           
static Value mt_getrandmax()
           
static long mt_rand(long min, long max)
           
static Value mt_srand(long seed)
           
static Value octdec(Env env, StringValue oct)
          Returns the decimal equivalent of the octal number represented by the octal_string argument.
static double pi()
           
static double pow(double base, double exp)
           
static double rad2deg(double value)
           
static long rand(int min, int max)
           
static double round(double value, int precision)
           
static double sin(double value)
           
static Value sinh(Value value)
           
static double sqrt(double value)
           
static Value srand(long seed)
           
static double tan(double value)
           
static double tanh(double value)
           
 
Methods inherited from class com.caucho.quercus.module.AbstractQuercusModule
addConstant, addConstant, addConstant, getConstMap, getIniDefinitions, getLoadedExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_PI

public static final double M_PI
See Also:
Constant Field Values

M_E

public static final double M_E
See Also:
Constant Field Values

RAND_MAX

public static final long RAND_MAX
See Also:
Constant Field Values

M_LOG2E

public static final double M_LOG2E

M_LOG10E

public static final double M_LOG10E

M_LN2

public static final double M_LN2

M_LN10

public static final double M_LN10

M_PI_2

public static final double M_PI_2
See Also:
Constant Field Values

M_PI_4

public static final double M_PI_4
See Also:
Constant Field Values

M_1_PI

public static final double M_1_PI
See Also:
Constant Field Values

M_2_PI

public static final double M_2_PI
See Also:
Constant Field Values

M_SQRTPI

public static final double M_SQRTPI

M_2_SQRTPI

public static final double M_2_SQRTPI

M_SQRT2

public static final double M_SQRT2

M_SQRT3

public static final double M_SQRT3

M_SQRT1_2

public static final double M_SQRT1_2

M_LNPI

public static final double M_LNPI

M_EULER

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

MathModule

public MathModule()
Method Detail

abs

public static Value abs(Value value)

acos

public static double acos(double value)

acosh

public static double acosh(Env env,
                           double value)

asin

public static Value asin(Value value)

asinh

public static double asinh(double value)

atan2

public static double atan2(double yV,
                           double xV)

atan

public static double atan(double value)

atanh

public static double atanh(double value)

base_convert

public static Value base_convert(Env env,
                                 StringValue str,
                                 int fromBase,
                                 int toBase)
Convert a number between arbitrary bases

Parameters:
number - A string represeantion of an binary number.
fromBase - The base of the number parameter.
toBase - The base of convert to.
Returns:
the number as a Value, either a LongValue or a DoubleValue.

bindec

public static Value bindec(Env env,
                           StringValue bin)
Returns the decimal equivalent of the binary number represented by the binary string argument.

Parameters:
bin - A string representation of an binary number.
Returns:
the decimal equivalent of the binary number

ceil

public static double ceil(double value)

cos

public static double cos(double value)

cosh

public static double cosh(double value)

decbin

public static StringValue decbin(Env env,
                                 long value)
Returns a binary representation of a number.

Parameters:
value - the number

dechex

public static StringValue dechex(Env env,
                                 long value)
Returns a hexadecimal representation of a number.

Parameters:
value - the number

decoct

public static StringValue decoct(Env env,
                                 long value)
Returns an octal representation of a number.

Parameters:
value - the number

deg2rad

public static double deg2rad(double value)

exp

public static Value exp(Value value)

expm1

public static Value expm1(Value value)

floor

public static Value floor(Value value)

fmod

public static double fmod(double xV,
                          double yV)

hexdec

public static Value hexdec(Env env,
                           StringValue s)

hypot

public static double hypot(double a,
                           double b)

is_finite

public static boolean is_finite(Value value)

is_infinite

public static Value is_infinite(Value value)

is_nan

public static Value is_nan(Value value)

log

public static double log(double value)

log10

public static double log10(double value)

log1p

public static double log1p(double value)

getrandmax

public static Value getrandmax()

max

public static Value max(Env env,
                        Value[] args)

min

public static Value min(Env env,
                        Value[] args)

mt_getrandmax

public static Value mt_getrandmax()

mt_rand

public static long mt_rand(long min,
                           long max)

mt_srand

public static Value mt_srand(long seed)

lcg_value

public static double lcg_value()

octdec

public static Value octdec(Env env,
                           StringValue oct)
Returns the decimal equivalent of the octal number represented by the octal_string argument.

Parameters:
oct - A string represeantion of an octal number.
Returns:
the decimal equivalent of the octal number

pi

public static double pi()

pow

public static double pow(double base,
                         double exp)

rad2deg

public static double rad2deg(double value)

rand

public static long rand(int min,
                        int max)

round

public static double round(double value,
                           int precision)

sin

public static double sin(double value)

sinh

public static Value sinh(Value value)

sqrt

public static double sqrt(double value)

srand

public static Value srand(long seed)

tan

public static double tan(double value)

tanh

public static double tanh(double value)