Page 1 of 1
PHP division operator outputing letters and hyphens
Posted: Wed Jul 08, 2009 1:59 pm
by ballinonabudget
Hi. Please help! for some reason my mathematical operation below is outputting an "E" and a "-" at the end. I tried to debug by omitting the
division part from the end and I got no letters or dashes. Not sure why the division bit is causing this output. Any thoughts?
This is the output for $timeDelay : 1.2256517540567E-8
Code: Select all
$_SESSION['timeDelay'] = sqrt($dielectricConstant) * $length / 3000000000;
$timeDelay = $_SESSION['timeDelay'];
Re: PHP division operator outputing letters and hyphens
Posted: Wed Jul 08, 2009 3:42 pm
by flying_circus
Isn't that just scientific notation for 8 trailing zero's?
Re: PHP division operator outputing letters and hyphens
Posted: Wed Jul 08, 2009 3:51 pm
by Eric!
You're working with dielectric constants and the speed of light, but you don't know this number format?
1.2256517540567E-8 = 0.000000012265...
or 12.2565 nano seconds (ns)
Re: PHP division operator outputing letters and hyphens
Posted: Wed Jul 08, 2009 4:49 pm
by VladSun
Eric! wrote:You're working with dielectric constants and the speed of light, but you don't know this number format?
Frankly, it's more often used in IT and CS than in other engineer sciences.
It's the normalized value of 0.000000012256517540567 :
1.2256517540567 * 10^(-8)
Or
XXXE-YY = XXX * 10^(-YY)
XXXE+YY = XXX * 10^(+YY)
Try using
http://bg.php.net/number_format
Re: PHP division operator outputing letters and hyphens
Posted: Wed Jul 08, 2009 5:50 pm
by Eric!
VladSun wrote:Frankly, it's more often used in IT and CS than in other engineer sciences.
Being an electrical engineer, I can tell you it is pretty common in my field. I use dielectric constants too, especially for high frequency work and antenna design. It is also used in physics and mechanical enginering a lot. In fact most calculators default to allowing xxxEyy notation for entry.