class CRM_Utils_Number

Class CRM_Utils_Number

Methods

static float
createRandomDecimal(array $precision)

Create a random number with a given precision.

static float
createTruncatedDecimal(int|float $keyValue, array $precision)

Given a number, coerce it to meet the precision requirement. If possible, it should keep the number as-is. If necessary, this may drop the least-significant digits and/or move the decimal place.

static int
formatUnitSize(string $size, bool $checkForPostMax = FALSE)

Some kind of numbery-looky-printy thing.

Details

at line 47
static float createRandomDecimal(array $precision)

Create a random number with a given precision.

Parameters

array $precision (int $significantDigits, int $postDecimalDigits).

Return Value

float

at line 64
static float createTruncatedDecimal(int|float $keyValue, array $precision)

Given a number, coerce it to meet the precision requirement. If possible, it should keep the number as-is. If necessary, this may drop the least-significant digits and/or move the decimal place.

Parameters

int|float $keyValue
array $precision (int $significantDigits, int $postDecimalDigits).

Return Value

float

at line 88
static int formatUnitSize(string $size, bool $checkForPostMax = FALSE)

Some kind of numbery-looky-printy thing.

Parameters

string $size
bool $checkForPostMax

Return Value

int