math formula problems
Posted: Fri Nov 26, 2010 2:59 pm
I am pretty new to PHP but am having a math problem I am hoping to get some help with. I have broke this down to it's simplest form and still can not get the result I am looking for.
When I run this code I get 0.13 with the expected result of 0.134911. This works for now as I can work out the decimal places later
When I change both occurrences of "4000" to "4200" I get 0.18 when the expected result is 0.140663
Can someone help me out with what is not working here. I have used this same formula in Excel spreadsheet and Visual basic and it works as expected.
Code: Select all
<?php
{
$x = (0.25*(4000 / 65) - 0.0005*(4000 / 65)^2) / 100;
printf($x);
}
?>When I change both occurrences of "4000" to "4200" I get 0.18 when the expected result is 0.140663
Can someone help me out with what is not working here. I have used this same formula in Excel spreadsheet and Visual basic and it works as expected.