C# 클래스 Pchp.Library.PhpMath

Implements PHP mathematical functions and constants.
파일 보기 프로젝트 열기: iolevel/peachpie

Private Properties

프로퍼티 타입 설명
AbsolutizeRange void
BaseToDouble double
ConvertToLong PhpNumber
DoubleToBase string
FindExtreme Pchp.Core.PhpValue
GetExtreme Pchp.Core.PhpValue
Power10Value double
Random01 int
RoundInternal double
_Log10Abs int
base_convert string

공개 메소드들

메소드 설명
abs ( PhpNumber x ) : PhpNumber

Returns the absolute value of x.

abs ( long lx ) : PhpNumber
abs ( double x ) : double
acos ( double x ) : double

Returns the arc cosine of arg in radians. acos() is the complementary function of cos(), which means that x==cos(acos(x)) for every value of a that is within acos()' range.

acosh ( double x ) : double
asin ( double x ) : double

Returns the arc sine of arg in radians. asin() is the complementary function of sin(), which means that x==sin(asin(x)) for every value of a that is within asin()'s range.

asinh ( double x ) : double
atan ( double x ) : double
atan2 ( double y, double x ) : double
atanh ( double x ) : double
bindec ( string str ) : PhpNumber

Returns the decimal equivalent of the binary number represented by the binary_string argument. bindec() converts a binary number to an integer or, if needed for size reasons, double.

ceil ( double x ) : double

Returns the next highest integer value by rounding up x if necessary.

cos ( double x ) : double
cosh ( double x ) : double
decbin ( double number ) : string

Converts the lowest 32 bits of the given number to a binary string.

dechex ( long number ) : string

Returns a string containing a hexadecimal representation of the given number argument.

decoct ( int number ) : string

Returns a string containing an octal representation of the given number argument.

deg2rad ( double degrees ) : double

Degrees to radians.

exp ( double x ) : double

Returns e raised to the power of x.

expm1 ( double x ) : double

expm1() returns the equivalent to 'exp(arg) - 1' computed in a way that is accurate even if the value of arg is near zero, a case where 'exp (arg) - 1' would be inaccurate due to subtraction of two numbers that are nearly equal.

floor ( double x ) : double

Returns the next lowest integer value by rounding down x if necessary.

fmod ( double x, double y ) : double

Returns the floating point remainder (modulo) of the division of the arguments.

getrandmax ( ) : int

Show largest possible random value.

hexdec ( string str ) : PhpNumber

Hexadecimal to decimal. Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument. hexdec() converts a hexadecimal string to a decimal number. hexdec() will ignore any non-hexadecimal characters it encounters.

hypot ( double x, double y ) : double
is_finite ( double x ) : bool
is_infinite ( double x ) : bool
is_nan ( double x ) : bool
lcg_value ( ) : double

Generates a pseudo-random number using linear congruential generator in the range of (0,1).

This method uses the Framwork rand() generator which may or may not be the same generator as the PHP one (L(CG(2^31 - 85),CG(2^31 - 249))).

log ( double x ) : double
log ( double x, double logBase ) : double

If the optional logBase parameter is specified, log() returns log(logBase) x, otherwise log() returns the natural logarithm of x.

log10 ( double x ) : double

Returns the base-10 logarithm of x.

log1p ( double x ) : double

log1p() returns log(1 + number) computed in a way that is accurate even when the value of number is close to zero. log() might only return log(1) in this case due to lack of precision.

max ( ) : PhpValue

Find highest value. If the first and only parameter is an array, max() returns the highest value in that array. If at least two parameters are provided, max() returns the biggest of these values.

max ( PhpArray array ) : PhpValue

Find highest value.

max ( long a, long b ) : long

Find highest value.

min ( ) : PhpValue

Find lowest value. If the first and only parameter is an array, min() returns the lowest value in that array. If at least two parameters are provided, min() returns the smallest of these values.

min ( PhpArray array ) : PhpValue

Find lowest value.

min ( long a, long b ) : long

Find lowest value.

mt_getrandmax ( ) : int
mt_rand ( ) : int
mt_rand ( int min, int max ) : int
mt_srand ( ) : void

Seed the better random number generator. No return value.

mt_srand ( int seed ) : void

Seed the better random number generator. No return value.

octdec ( string str ) : PhpNumber

Returns the decimal equivalent of the octal number represented by the str argument.

pi ( ) : double

Returns an approximation of pi.

pow ( PhpNumber @base, PhpNumber exp ) : PhpNumber

Returns base raised to the power of exp.

rad2deg ( double radians ) : double

Radians to degrees.

rand ( ) : int

Generate a random integer.

rand ( int min, int max ) : int

Generate a random integer.

round ( double x ) : double

Rounds a float.

round ( double x, int precision ) : double

Rounds a float.

round ( double x, int precision, RoundMode mode = RoundMode.HalfUp ) : double

Rounds a float.

sin ( double x ) : double
sinh ( double x ) : double
sqrt ( double x ) : double
srand ( ) : void

Seed the random number generator. No return value.

srand ( int seed ) : void

Seed the random number generator. No return value.

tan ( double x ) : double
tanh ( double x ) : double
uniqid ( ) : string

Generate a unique ID. Gets a prefixed unique identifier based on the current time in microseconds.

uniqid ( string prefix ) : string

Generate a unique ID. Gets a prefixed unique identifier based on the current time in microseconds.

uniqid ( string prefix, bool more_entropy ) : string

Generate a unique ID.

With an empty prefix, the returned string will be 13 characters long. If more_entropy is TRUE, it will be 23 characters.

비공개 메소드들

메소드 설명
AbsolutizeRange ( int &offset, int &length, int count ) : void

Absolutizes range specified by an offset and a length relatively to a dimension of an array.

Ensures that [offset,offset + length] is subrange of [0,count].

BaseToDouble ( string number, int fromBase ) : double
ConvertToLong ( double number ) : PhpNumber

Converts the given number to int64 (if the number is whole and fits into the int64's range).

DoubleToBase ( double number, int toBase ) : string
FindExtreme ( IEnumerable array, bool maximum ) : PhpValue
GetExtreme ( PhpValue numbers, bool maximum ) : PhpValue
Power10Value ( int power ) : double

Returns precise value of 10^power.

Random01 ( ) : int

Gets 0 or 1 randomly.

RoundInternal ( double value, RoundMode mode ) : double
_Log10Abs ( double value ) : int
base_convert ( string number, int fromBase, int toBase ) : string

메소드 상세

abs() 공개 정적인 메소드

Returns the absolute value of x.
public static abs ( PhpNumber x ) : PhpNumber
x PhpNumber The numeric value to process.
리턴 PhpNumber

abs() 공개 정적인 메소드

public static abs ( long lx ) : PhpNumber
lx long
리턴 PhpNumber

abs() 공개 정적인 메소드

public static abs ( double x ) : double
x double
리턴 double

acos() 공개 정적인 메소드

Returns the arc cosine of arg in radians. acos() is the complementary function of cos(), which means that x==cos(acos(x)) for every value of a that is within acos()' range.
public static acos ( double x ) : double
x double The argument to process.
리턴 double

acosh() 공개 정적인 메소드

public static acosh ( double x ) : double
x double
리턴 double

asin() 공개 정적인 메소드

Returns the arc sine of arg in radians. asin() is the complementary function of sin(), which means that x==sin(asin(x)) for every value of a that is within asin()'s range.
public static asin ( double x ) : double
x double The argument to process.
리턴 double

asinh() 공개 정적인 메소드

public static asinh ( double x ) : double
x double
리턴 double

atan() 공개 정적인 메소드

public static atan ( double x ) : double
x double
리턴 double

atan2() 공개 정적인 메소드

public static atan2 ( double y, double x ) : double
y double
x double
리턴 double

atanh() 공개 정적인 메소드

public static atanh ( double x ) : double
x double
리턴 double

bindec() 공개 정적인 메소드

Returns the decimal equivalent of the binary number represented by the binary_string argument. bindec() converts a binary number to an integer or, if needed for size reasons, double.
public static bindec ( string str ) : PhpNumber
str string The binary string to convert.
리턴 PhpNumber

ceil() 공개 정적인 메소드

Returns the next highest integer value by rounding up x if necessary.
public static ceil ( double x ) : double
x double The value to round.
리턴 double

cos() 공개 정적인 메소드

public static cos ( double x ) : double
x double
리턴 double

cosh() 공개 정적인 메소드

public static cosh ( double x ) : double
x double
리턴 double

decbin() 공개 정적인 메소드

Converts the lowest 32 bits of the given number to a binary string.
public static decbin ( double number ) : string
number double
리턴 string

dechex() 공개 정적인 메소드

Returns a string containing a hexadecimal representation of the given number argument.
public static dechex ( long number ) : string
number long Decimal value to convert.
리턴 string

decoct() 공개 정적인 메소드

Returns a string containing an octal representation of the given number argument.
public static decoct ( int number ) : string
number int Decimal value to convert.
리턴 string

deg2rad() 공개 정적인 메소드

Degrees to radians.
public static deg2rad ( double degrees ) : double
degrees double
리턴 double

exp() 공개 정적인 메소드

Returns e raised to the power of x.
public static exp ( double x ) : double
x double
리턴 double

expm1() 공개 정적인 메소드

expm1() returns the equivalent to 'exp(arg) - 1' computed in a way that is accurate even if the value of arg is near zero, a case where 'exp (arg) - 1' would be inaccurate due to subtraction of two numbers that are nearly equal.
public static expm1 ( double x ) : double
x double The argument to process
리턴 double

floor() 공개 정적인 메소드

Returns the next lowest integer value by rounding down x if necessary.
public static floor ( double x ) : double
x double The numeric value to round.
리턴 double

fmod() 공개 정적인 메소드

Returns the floating point remainder (modulo) of the division of the arguments.
public static fmod ( double x, double y ) : double
x double The dividend.
y double The divisor.
리턴 double

getrandmax() 공개 정적인 메소드

Show largest possible random value.
public static getrandmax ( ) : int
리턴 int

hexdec() 공개 정적인 메소드

Hexadecimal to decimal. Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument. hexdec() converts a hexadecimal string to a decimal number. hexdec() will ignore any non-hexadecimal characters it encounters.
public static hexdec ( string str ) : PhpNumber
str string The hexadecimal string to convert.
리턴 PhpNumber

hypot() 공개 정적인 메소드

public static hypot ( double x, double y ) : double
x double
y double
리턴 double

is_finite() 공개 정적인 메소드

public static is_finite ( double x ) : bool
x double
리턴 bool

is_infinite() 공개 정적인 메소드

public static is_infinite ( double x ) : bool
x double
리턴 bool

is_nan() 공개 정적인 메소드

public static is_nan ( double x ) : bool
x double
리턴 bool

lcg_value() 공개 정적인 메소드

Generates a pseudo-random number using linear congruential generator in the range of (0,1).
This method uses the Framwork rand() generator which may or may not be the same generator as the PHP one (L(CG(2^31 - 85),CG(2^31 - 249))).
public static lcg_value ( ) : double
리턴 double

log() 공개 정적인 메소드

public static log ( double x ) : double
x double
리턴 double

log() 공개 정적인 메소드

If the optional logBase parameter is specified, log() returns log(logBase) x, otherwise log() returns the natural logarithm of x.
public static log ( double x, double logBase ) : double
x double
logBase double
리턴 double

log10() 공개 정적인 메소드

Returns the base-10 logarithm of x.
public static log10 ( double x ) : double
x double
리턴 double

log1p() 공개 정적인 메소드

log1p() returns log(1 + number) computed in a way that is accurate even when the value of number is close to zero. log() might only return log(1) in this case due to lack of precision.
public static log1p ( double x ) : double
x double The argument to process
리턴 double

max() 공개 정적인 메소드

Find highest value. If the first and only parameter is an array, max() returns the highest value in that array. If at least two parameters are provided, max() returns the biggest of these values.
public static max ( ) : PhpValue
리턴 Pchp.Core.PhpValue

max() 공개 정적인 메소드

Find highest value.
public static max ( PhpArray array ) : PhpValue
array Pchp.Core.PhpArray
리턴 Pchp.Core.PhpValue

max() 공개 정적인 메소드

Find highest value.
public static max ( long a, long b ) : long
a long
b long
리턴 long

min() 공개 정적인 메소드

Find lowest value. If the first and only parameter is an array, min() returns the lowest value in that array. If at least two parameters are provided, min() returns the smallest of these values.
public static min ( ) : PhpValue
리턴 Pchp.Core.PhpValue

min() 공개 정적인 메소드

Find lowest value.
public static min ( PhpArray array ) : PhpValue
array Pchp.Core.PhpArray
리턴 Pchp.Core.PhpValue

min() 공개 정적인 메소드

Find lowest value.
public static min ( long a, long b ) : long
a long
b long
리턴 long

mt_getrandmax() 공개 정적인 메소드

public static mt_getrandmax ( ) : int
리턴 int

mt_rand() 공개 정적인 메소드

public static mt_rand ( ) : int
리턴 int

mt_rand() 공개 정적인 메소드

public static mt_rand ( int min, int max ) : int
min int
max int
리턴 int

mt_srand() 공개 정적인 메소드

Seed the better random number generator. No return value.
public static mt_srand ( ) : void
리턴 void

mt_srand() 공개 정적인 메소드

Seed the better random number generator. No return value.
public static mt_srand ( int seed ) : void
seed int Optional seed value.
리턴 void

octdec() 공개 정적인 메소드

Returns the decimal equivalent of the octal number represented by the str argument.
public static octdec ( string str ) : PhpNumber
str string The octal string to convert.
리턴 PhpNumber

pi() 공개 정적인 메소드

Returns an approximation of pi.
public static pi ( ) : double
리턴 double

pow() 공개 정적인 메소드

Returns base raised to the power of exp.
public static pow ( PhpNumber @base, PhpNumber exp ) : PhpNumber
@base PhpNumber
exp PhpNumber
리턴 PhpNumber

rad2deg() 공개 정적인 메소드

Radians to degrees.
public static rad2deg ( double radians ) : double
radians double
리턴 double

rand() 공개 정적인 메소드

Generate a random integer.
public static rand ( ) : int
리턴 int

rand() 공개 정적인 메소드

Generate a random integer.
public static rand ( int min, int max ) : int
min int The lowest value to return.
max int The highest value to return.
리턴 int

round() 공개 정적인 메소드

Rounds a float.
public static round ( double x ) : double
x double The value to round.
리턴 double

round() 공개 정적인 메소드

Rounds a float.
public static round ( double x, int precision ) : double
x double The value to round.
precision int The optional number of decimal digits to round to. Can be less than zero to ommit digits at the end. Default is 0.
리턴 double

round() 공개 정적인 메소드

Rounds a float.
public static round ( double x, int precision, RoundMode mode = RoundMode.HalfUp ) : double
x double The value to round.
precision int The optional number of decimal digits to round to. Can be less than zero to ommit digits at the end. Default is 0.
mode RoundMode One of PHP_ROUND_HALF_UP, PHP_ROUND_HALF_DOWN, PHP_ROUND_HALF_EVEN, or PHP_ROUND_HALF_ODD. Default is PHP_ROUND_HALF_UP.
리턴 double

sin() 공개 정적인 메소드

public static sin ( double x ) : double
x double
리턴 double

sinh() 공개 정적인 메소드

public static sinh ( double x ) : double
x double
리턴 double

sqrt() 공개 정적인 메소드

public static sqrt ( double x ) : double
x double
리턴 double

srand() 공개 정적인 메소드

Seed the random number generator. No return value.
public static srand ( ) : void
리턴 void

srand() 공개 정적인 메소드

Seed the random number generator. No return value.
public static srand ( int seed ) : void
seed int Optional seed value.
리턴 void

tan() 공개 정적인 메소드

public static tan ( double x ) : double
x double
리턴 double

tanh() 공개 정적인 메소드

public static tanh ( double x ) : double
x double
리턴 double

uniqid() 공개 정적인 메소드

Generate a unique ID. Gets a prefixed unique identifier based on the current time in microseconds.
public static uniqid ( ) : string
리턴 string

uniqid() 공개 정적인 메소드

Generate a unique ID. Gets a prefixed unique identifier based on the current time in microseconds.
public static uniqid ( string prefix ) : string
prefix string Can be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond. /// With an empty prefix , the returned string will be 13 characters long. ///
리턴 string

uniqid() 공개 정적인 메소드

Generate a unique ID.
With an empty prefix, the returned string will be 13 characters long. If more_entropy is TRUE, it will be 23 characters.
public static uniqid ( string prefix, bool more_entropy ) : string
prefix string Use the specified prefix.
more_entropy bool Use LCG to generate a random postfix.
리턴 string