mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-15 03:28:41 +00:00
Fix after tests
This commit is contained in:
parent
56b0a40c81
commit
7c2ebba47b
|
|
@ -26,6 +26,15 @@ namespace phpOMS\Utils\Converter;
|
|||
*/
|
||||
class Measurement
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert temperature.
|
||||
|
|
@ -88,7 +97,7 @@ class Measurement
|
|||
$value = ($value - 273.15) * 1.5 - 100;
|
||||
break;
|
||||
case TemperatureType::NEWTON:
|
||||
$value = ($value - 273.15) / 0.33;
|
||||
$value = ($value - 273.15) * 0.33;
|
||||
break;
|
||||
case TemperatureType::ROMER:
|
||||
$value = ($value - 273.15) * 0.525 + 7.5;
|
||||
|
|
@ -1221,7 +1230,7 @@ class Measurement
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function convertEnergie(float $value, string $from = EnergyPowerType::JOULS, string $to = EnergyPowerType::KILOWATT_HOUERS) : float
|
||||
public static function convertEnergy(float $value, string $from = EnergyPowerType::JOULS, string $to = EnergyPowerType::KILOWATT_HOUERS) : float
|
||||
{
|
||||
switch ($from) {
|
||||
case EnergyPowerType::JOULS:
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class Numeric
|
|||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
|
|
@ -73,7 +74,7 @@ class Numeric
|
|||
$newOutput = 0;
|
||||
|
||||
for ($i = 1; $i <= $numberLen; $i++) {
|
||||
$newOutput = bcadd($newOutput, bcmul(array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i)));
|
||||
$newOutput = bcadd((string) $newOutput, bcmul((string) array_search($number[$i - 1], $fromBase), bcpow((string) $fromLen, (string) ($numberLen - $i))));
|
||||
}
|
||||
|
||||
return $newOutput;
|
||||
|
|
@ -86,8 +87,8 @@ class Numeric
|
|||
}
|
||||
|
||||
while ($base10 !== '0') {
|
||||
$newOutput = $toBase[bcmod($base10, $toLen)] . $newOutput;
|
||||
$base10 = bcdiv($base10, $toLen, 0);
|
||||
$newOutput = $toBase[bcmod($base10, (string) $toLen)] . $newOutput;
|
||||
$base10 = bcdiv($base10, (string) $toLen, 0);
|
||||
}
|
||||
|
||||
return $newOutput;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user