I want to add following numbers
$res = 0.000000002 + 0.000000002 + 0.000000002; I got result like this
4.2E-8 can any one explain , how to get 0.000000006
thanks
You should get the following result:
echo 0.000000002 + 0.000000002 + 0.000000002; 6.0E-9 Which means you haven't told us the truth.
One way to get 4.2E-8 is to add 0.00000002 + 0.00000002 + 0.000000002; (I removed a zero from two of them).
Please try this .
$res = 0.000000002 + 0.000000002 + 0.000000002; echo number_format($res, 9, '.', '');die; here 9 no is describe after dot how many digit you want to show.
0.000000006as result, you should get6.0E-9.4.2E-8means0.000000042printf( 0.000000002 + 0.000000002 + 0.000000002);; if anything, you should have got a warning.... printf() requires a format mask as the first argument