Wolfram Alpha的說將給予以下公式正確的結果:PHP,計算指數胡蘿蔔(^)失敗
((0.0004954*($current^2))-((0.935*$current)+378.486))-
((0.0004954*($desired^2))-((0.935*$desired)+378.486));
但是當我在PHP中運行它,它並沒有給出正確的答案,爲什麼不?
$current = mysql_escape_string($_POST['current']);
$desired = mysql_escape_string($_POST['desired']);
$username = mysql_escape_string($_POST['username']);
$password = mysql_escape_string($_POST['password']);
$email = mysql_escape_string($_POST['email']);
$ip = $_SERVER["REMOTE_ADDR"];
$time = time();
$elo = $desired - $current;
if($current < 1200) {
$price = ($elo/100)*30;
} elseif($current < 1400) {
$price = ($elo/100)*35;
} elseif($current < 1901) {
$price = ((0.0004954*($current^2))-((0.935*$current)+378.486))-((0.0004954*($desired^2))-((0.935*$desired)+378.486));
}