std.math.algebraic

This is a submodule of std.math.

It contains classical algebraic functions like abs, sqrt, and poly.

Members

Functions

abs
auto abs(Num x)

Calculates the absolute value of a number.

cbrt
real cbrt(real x)

Calculates the cube root of x.

fabs
real fabs(real x)
double fabs(double x)
float fabs(float x)

Returns |x|

hypot
T hypot(T x, T 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:

hypot
T hypot(T x, T y, T z)

Calculates the distance of the point (x, y, z) from the origin (0, 0, 0) in three-dimensional space. The distance is the value of the square root of the sums of the squares of x, y, and z:

nextPow2
T nextPow2(T val)

Gives the next power of two after val. T can be any built-in numerical type.

poly
Unqual!(CommonType!(T1, T2)) poly(T1 x, T2[] A)
Unqual!(CommonType!(T1, T2)) poly(T1 x, T2[N] A)

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

sqrt
float sqrt(float x)
double sqrt(double x)
real sqrt(real x)

Compute square root of x.

truncPow2
T truncPow2(T val)

Gives the last power of two before val. $(T) can be any built-in numerical type.

Meta

Authors

Walter Bright, Don Clugston, Conversion of CEPHES math library to D by Iain Buclaw and David Nadlinger