ocean.math.Math

Members

Functions

abs
real abs(real x)
long abs(long x)
int abs(int x)
deprecated real abs(creal z)
deprecated real abs(ireal y)

Calculates the absolute value

acos
real acos(real x)

Calculates the arc cosine of x, returning a value ranging from 0 to π.

acos
deprecated creal acos(creal z)

Complex inverse cosine

acosh
real acosh(real x)

Calculates the inverse hyperbolic cosine of x.

asin
real asin(real x)

Calculates the arc sine of x, returning a value ranging from -π/2 to π/2.

asin
deprecated creal asin(creal z)

Complex inverse sine

asinh
real asinh(real x)

Calculates the inverse hyperbolic sine of x.

atan
real atan(real x)

Calculates the arc tangent of x, returning a value ranging from -π/2 to π/2.

atan2
real atan2(real y, real x)

Calculates the arc tangent of y / x, returning a value ranging from -π to π.

atanPi
real atanPi(real x)

Sine, cosine, and arctangent of multiple of π

atanh
real atanh(real x)
deprecated creal atanh(ireal y)
deprecated creal atanh(creal z)

Calculates the inverse hyperbolic tangent of x, returning a value from ranging from -1 to 1.

cbrt
real cbrt(real x)

Calculates the cube root of x.

ceil
real ceil(real x)

Returns the value of x rounded upward to the next integer (toward positive infinity).

conj
deprecated creal conj(creal z)
deprecated ireal conj(ireal y)

Complex conjugate

cos
real cos(real x)

Returns cosine of x. x is in radians.

cos
deprecated creal cos(creal z)
deprecated real cos(ireal y)

cosine, complex and imaginary

cosPi
real cosPi(real x)

Sine, cosine, and arctangent of multiple of π

cosh
real cosh(real x)

Calculates the hyperbolic cosine of x.

cosh
deprecated creal cosh(creal z)
deprecated real cosh(ireal y)

hyperbolic cosine, complex and imaginary

divRoundEven
T divRoundEven(T a, T b)

Does an integer division, rounding towards the nearest integer. Rounds to the even one if both integers are equal near.

exp
real exp(real x)

Calculates e$(SUP x).

exp
deprecated creal exp(ireal y)
deprecated creal exp(creal z)

Exponential, complex and imaginary

exp2
real exp2(real x)

Calculates 2$(SUP x).

expm1
real expm1(real x)

Calculates the value of the natural logarithm base (e) raised to the power of x, minus 1.

floor
real floor(real x)

Returns the value of x rounded downward to the next integer (toward negative infinity).

hypot
real hypot(real x, real y)

Calculates the length of the hypotenuse of a right-angled triangle with sides of length x and y. The hypotenuse is the value of the square root of the sums of the squares of x and y:

log
real log(real x)

Calculate the natural logarithm of x.

log
deprecated creal log(creal z)

Natural logarithm, complex

log10
real log10(real x)

Calculate the base-10 logarithm of x.

log1p
real log1p(real x)

Calculates the natural logarithm of 1 + x.

log2
real log2(real x)

Calculates the base-2 logarithm of x: log2x

max
minmaxtype!(T) max(T arg)

Return the maximum of the supplied arguments.

maxNaN
real maxNaN(real x, real y)

Returns the maximum of x and y, favouring NaNs over numbers

maxNum
real maxNum(real x, real y)

Returns the maximum number of x and y, favouring numbers over NaNs.

min
minmaxtype!(T) min(T arg)

Return the minimum of the supplied arguments.

minNaN
real minNaN(real x, real y)

Returns the minimum of x and y, favouring NaNs over numbers

minNum
real minNum(real x, real y)

Returns the minimum number of x and y, favouring numbers over NaNs.

poly
T poly(T x, T[] A)

Evaluate polynomial A(x) = a0 + a1x + a2x2 + a3x3; ...

pow
real pow(real x, uint n)
real pow(real x, int n)

Fast integral powers.

pow
real pow(real x, real y)

Calculates x$(SUP y).

pow
ulong pow(ulong base, ulong power)

Integer pow function. Returns the power'th power of base

rationalPoly
T rationalPoly(T x, T[] numerator, T[] denominator)
Undocumented in source. Be warned that the author may not have intended to support it.
rndint
int rndint(real x)
rndlong
long rndlong(real x)

Rounds x to the nearest int or long.

rndlong (from ocean.math.Math)
long rndlong(real x) via public import ocean.math.Math : rndlong;

Rounds x to the nearest int or long.

round
real round(real x)

Return the value of x rounded to the nearest integer. If the fractional part of x is exactly 0.5, the return value is rounded to the even integer.

sin
real sin(real x)

Returns sine of x. x is in radians.

sin
deprecated creal sin(creal z)
deprecated ireal sin(ireal y)

sine, complex and imaginary

sinPi
real sinPi(real x)

Sine, cosine, and arctangent of multiple of π

sinh
real sinh(real x)

Calculates the hyperbolic sine of x.

sinh
deprecated creal sinh(creal z)
deprecated ireal sinh(ireal y)

hyperbolic sine, complex and imaginary

sqrt
float sqrt(float x)

Compute square root of x.

sqrt
double sqrt(double x)
Undocumented in source. Be warned that the author may not have intended to support it.
sqrt
real sqrt(real x)
Undocumented in source. Be warned that the author may not have intended to support it.
sqrt
deprecated creal sqrt(creal z)

Compute square root of x.

tan
real tan(real x)

Returns tangent of x. x is in radians.

tanh
real tanh(real x)

Calculates the hyperbolic tangent of x.

trunc
real trunc(real x)

Returns the integer portion of x, dropping the fractional portion.

Static variables

E
real E;

e

EULERGAMMA
real EULERGAMMA;

Euler-Mascheroni constant 0.57721566..

LN10
real LN10;

ln 10

LN2
real LN2;

ln 2

LOG10E
real LOG10E;

log10e

LOG2
real LOG2;

log102

LOG2E
real LOG2E;

log2e

LOG2T
real LOG2T;

log210

MAXLOG
real MAXLOG;

log(real.max)

MINLOG
real MINLOG;

log(real.min*real.epsilon)

M_1_PI
real M_1_PI;

1 / π

M_2_PI
real M_2_PI;

2 / π

M_2_SQRTPI
real M_2_SQRTPI;

2 / √π

PI
real PI;

$(_PI)

PI_2
real PI_2;

π / 2

PI_4
real PI_4;

π / 4

SQRT1_2
real SQRT1_2;

√$(HALF)

SQRT2
real SQRT2;

√2

Meta