C# Класс Pchp.Library.PhpMath

Implements PHP mathematical functions and constants.
Показать файл Открыть проект

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