@ 2014-10-18T20:39:37Z <?php
// $A = 1110;
// $B = 370;
// $C = 6171.6;
// $H = 71.1;
// $I = 556/$G; // Muss "4,21212121212121" ausgeben
// $K = get_factor_K($I); // I wird benötigt. Gibt in diesem Beispiel "0,9942" aus
// $L = get_factor_L($I); // I wird benötigt. Gibt in diesem Beispiel "0,998670248976177" aus
// $G = $H/(545.223880597015/1000*$L*$K); // Aufrundung ohne Komma, muss "132" ausgeben
// $J = $G*$B/1000*$A/100*1; // Muss "542,124" ausgeben
// $D = ($C-$J); // Muss "5629,476" ausgeben
// $E = ($I-$B/1000)*$A/100; // Muss "42,6475454545455" ausgeben
// $F = $I*$A/100; // Muss "46,7545454545455" ausgeben
function get_factor_k($i)
{
// Replace with correct code
#return $i;
return 0.9942;
}
function get_factor_l($i)
{
// Replace with correct code
#return $i;
return 0.998670248976177;
}
$a = 1110;
$b = 370;
$c = 6171.6;
$h = 71.1;
$i = 0.001; // undef
$k = 0; // undef
$l = 0; // undef
$step = 0.001; // Auflösung für $i
$i_max = 100; // um keine Endlosschleife zu produzieren
$epsilon = 0.001; // Fehlertoleranz
$found = false;
do {
$k = get_factor_k($i);
$l = get_factor_l($i);
$tmp = (556 / ($h / (545.223880597015 / 1000 * $k * $l)));
$found = (abs($i - $tmp) <= $epsilon);
if (!$found) {
$i += $step;
}
if ($i > $i_max) {
throw new Exception('Unable to calculate $i');
}
} while (!$found);
$g = ceil($h / (545.223880597015 / 1000 * $l * $k));
#$i = 556 / $g; // ??? $i haben wir schon
$j = $g * $b / 1000 * $a / 100 * 1;
$e = ($i - $b / 1000) * $a / 100;
$f = $i * $a / 100;
$d = $c - $j;
foreach (range('a', 'l') as $var) {
echo $var . ' = ';
var_dump($$var);
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 a = int(1110)
b = int(370)
c = float(6171.6)
d = float(5629.476000000001)
e = float(42.8792999999972)
f = float(46.98629999999721)
g = float(132)
h = float(71.1)
i = float(4.232999999999748)
j = float(542.124)
k = float(0.9942)
l = float(0.998670248976177)
Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 a = int(1110)
b = int(370)
c = float(6171.6)
d = float(5629.476)
e = float(42.879299999997)
f = float(46.986299999997)
g = float(132)
h = float(71.1)
i = float(4.2329999999997)
j = float(542.124)
k = float(0.9942)
l = float(0.99867024897618)
Output for 4.4.2 - 4.4.9 Parse error: syntax error, unexpected T_NEW in /in/3il92 on line 58
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_NEW in /in/3il92 on line 58
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/3il92 on line 58
Process exited with code 255 . preferences:dark mode live preview
283.42 ms | 401 KiB | 459 Q