\Jetpack_Constrained_Array_Rounding

Lets you round the numeric elements of an array to integers while preserving their sum.

Usage:

Jetpack_Constrained_Array_Rounding::get_rounded_constrained_array( $bound_array ) if a specific sum doesn't need to be specified for the bound array

Jetpack_Constrained_Array_Rounding::get_rounded_constrained_array( $bound_array, $sum ) If the sum of $bound_array must equal $sum after rounding.

If $sum is less than the sum of the floor of the elements of the array, the class defaults to using the sum of the array elements.

Summary

Methods
Properties
Constants
get_rounded_constrained_array()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
get_int_floor_array()
adjust_constrained_array()
cmp_desc_fraction()
cmp_asc_index()
No private properties found
N/A

Methods

get_rounded_constrained_array()

get_rounded_constrained_array( $bound_array,  $sum)

Parameters

$bound_array
$sum

get_int_floor_array()

get_int_floor_array( $bound_array)

Parameters

$bound_array

adjust_constrained_array()

adjust_constrained_array( $bound_array_int,  $adjustment)

Parameters

$bound_array_int
$adjustment

cmp_desc_fraction()

cmp_desc_fraction( $a,  $b)

Parameters

$a
$b

cmp_asc_index()

cmp_asc_index( $a,  $b)

Parameters

$a
$b