update #5

Merged
Llewellyn merged 1 commits from dev into master 2023-08-18 06:06:33 +00:00
3 changed files with 0 additions and 61 deletions

View File

@ -13,7 +13,6 @@
abstract MathHelper #Orange {
+ {static} bc(string $type, int $val1, ...) : string|int|null|bool
+ {static} sum(array $array, int $scale = 4) : float
+ {static} sum(array $array, int $scale = 4) : float
}
note right of MathHelper::bc
@ -32,10 +31,6 @@ end note
note right of MathHelper::sum
Basic sum of an array with more precision
since: 3.0.9
return: float
Basic sum of an array with more precision
since: 3.0.9
return: float
end note

View File

@ -98,33 +98,5 @@ abstract class MathHelper
return array_sum($array);
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float
*
* @since 3.0.9
*/
public static function sum($array, $scale = 4)
{
// use the bcadd function if available
if (function_exists('bcadd'))
{
// set the start value
$value = 0.0;
// loop the values and run bcadd
foreach($array as $val)
{
$value = bcadd($value, (string) $val, $scale);
}
return $value;
}
// fall back on array sum
return array_sum($array);
}
}

View File

@ -76,31 +76,3 @@
// fall back on array sum
return array_sum($array);
}
/**
* Basic sum of an array with more precision
*
* @param array $array The values to sum
* @param int $scale The scale value
*
* @return float
*
* @since 3.0.9
*/
public static function sum($array, $scale = 4)
{
// use the bcadd function if available
if (function_exists('bcadd'))
{
// set the start value
$value = 0.0;
// loop the values and run bcadd
foreach($array as $val)
{
$value = bcadd($value, (string) $val, $scale);
}
return $value;
}
// fall back on array sum
return array_sum($array);
}