Php acting funny with large numbers


During one of my college competition the problem stated to take input from a file as numbers and then simply add half of it to itself.  The numbers were 18 digit long integers. Most of my php output differed from actual answer (most of the differences were powers of 2).
  Note: I have also set the floating point precision to 30 places so that php does not print it as 1.3434...E+18 but rather all the 18 digits.
  And heres my code for the contest.

while(!feof($file))   $inp[] = (double)fgets($file);
$i = 0;  while(isset($inp[$i])) {   $half = $inp[$i]/2;   $sum = $inp[$i] + $half;   echo "$sum
";   $i++;   }  ?>  

I have checked the input array value with values in file and there is no error while taking or storing the values as float.

Also after I calculated the answer in python (and stored them in a file) and tried to read the actual answers as numbers