Does anyone know why this happens and if it can be fixed. I'm comparing results from C and PHP, but PHP is giving me different results.
I can supply some code if needed but has anyone experienced this before?
PHP code
$tempnum = 1.0e - 5 * -44954; // substr($line1,53,6); $bstar = $tempnum / pow(10.0, 3); $bstar gives me -0.00044954 in PHP but it should be -0.000450
C code
double tempnum = 1.0e - 5 * -44954; double bstar = tempnum / pow(10.0, 3); printf bstar gives me -0.000450
Thanks for your responses so far, but how does PHP come to this conclusion...
$twopi = 6.28318530717958623; /* 2*Pi */ $xmnpda= 1440; //1.44E3 ; /* Minutes per day */ $temp = (($twopi/$xmnpda)/$xmnpda); $xndt2o = -0.000603; $xndt2o = $xndt2o * $temp; echo $xndt2o gives me -1.8256568188E-9 in PHP but in C it gives me -0.000000
I don't know what all that is about in PHP.