I am writing a quick script that will take baseball statistics for innings pitched and convert it to usable mathematical form.
"What was that" you may say.
Well, if a pitcher pitches 80 complete innings and then gets 1 out in an inning and gets pulled it is written as 80.1 - whereas mathematically he has really pitched 80 1/3
.1 is notation for 1 out
.2 for two outs
so... i wrote the following, which should convert IP from 10.1 to 10.33333333, but it does not work! What on earth am I doing wrong?
Thanks!
AlNeri
<?
$IP=10.1;
$IPwhole=intval($IP);
$IPremain=$IP-$IPwhole;
if ($IPremain==0.1)
{
$convertedIP=$IPwhole+(1/3);
}
elseif($IPremain==0.2)
{
$convertedIP=$IPwhole+(2/3);
}
else {$convertedIP=$IP;}
echo "$IP would be rewritten as $convertedIP";
"What was that" you may say.
Well, if a pitcher pitches 80 complete innings and then gets 1 out in an inning and gets pulled it is written as 80.1 - whereas mathematically he has really pitched 80 1/3
.1 is notation for 1 out
.2 for two outs
so... i wrote the following, which should convert IP from 10.1 to 10.33333333, but it does not work! What on earth am I doing wrong?
Thanks!
AlNeri
<?
$IP=10.1;
$IPwhole=intval($IP);
$IPremain=$IP-$IPwhole;
if ($IPremain==0.1)
{
$convertedIP=$IPwhole+(1/3);
}
elseif($IPremain==0.2)
{
$convertedIP=$IPwhole+(2/3);
}
else {$convertedIP=$IP;}
echo "$IP would be rewritten as $convertedIP";