update 2023-08-18 07:57:37

This commit is contained in:
Robot 2023-08-18 07:57:37 +02:00
parent 3d5c34a922
commit b727169617
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 0 additions and 61 deletions

View File

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

View File

@ -97,34 +97,6 @@ abstract class MathHelper
// fall back on array sum // fall back on array sum
return array_sum($array); 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 // fall back on array sum
return array_sum($array); 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);
}