ae.utils.math

Number stuff

Modules

distribution
module ae.utils.math.distribution

Very basic (and probably buggy) numeric distribution / probability operations. WIP, do not use.

longmul
module ae.utils.math.longmul

Wrapper for long integer multiplication / division opcodes

Members

Aliases

eq
alias eq = binary!"=="
Undocumented in source.
flipBits
alias flipBits = unary!'~'

Like the ~ operator, but without int-promotion.

ge
alias ge = binary!">="
Undocumented in source.
gt
alias gt = binary!">"
Undocumented in source.
le
alias le = binary!"<="
Undocumented in source.
lt
alias lt = binary!"<"
Undocumented in source.
ne
alias ne = binary!"!="
Undocumented in source.

Functions

average
auto average(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
between
bool between(T point, T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.
bitsFor
ubyte bitsFor(T n)

Returns the number of bits needed to store a number up to n (inclusive).

bound
typeof(Ta + Tb + Tc) bound(Ta a, Tb b, Tc c)
Undocumented in source. Be warned that the author may not have intended to support it.
compare
int compare(T a, T b)
Undocumented in source. Be warned that the author may not have intended to support it.
ilog2
ubyte ilog2(T n)

Integer log2.

isPowerOfTwo
bool isPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
itpl
T itpl(T low, T high, U r, U rLow, U rHigh)
Undocumented in source. Be warned that the author may not have intended to support it.
maximize
void maximize(T v, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.
minimize
void minimize(T v, Args args)
Undocumented in source. Be warned that the author may not have intended to support it.
nextPowerOfTwo
T nextPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
op
auto op(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
rangeIntersection
T rangeIntersection(T a0, T a1, T b0, T b1)
Undocumented in source. Be warned that the author may not have intended to support it.
roundUpToPowerOfTwo
T roundUpToPowerOfTwo(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sign
byte sign(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sort2
void sort2(T x, T y)
Undocumented in source. Be warned that the author may not have intended to support it.
sqr
auto sqr(T x)
Undocumented in source. Be warned that the author may not have intended to support it.
sum
auto sum(T args)
Undocumented in source. Be warned that the author may not have intended to support it.
swapBytes
T swapBytes(T b)
Undocumented in source. Be warned that the author may not have intended to support it.

Templates

TypeForBits
template TypeForBits(uint bits)

Get the smallest built-in unsigned integer type that can store this many bits of data.

binary
template binary(string op)
Undocumented in source.
unary
template unary(char op)
Undocumented in source.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <vladimir@thecybershadow.net>