shan_cool Posted March 27, 2006 Share Posted March 27, 2006 Hi all I want to add 2 fields in PHP and i don't want the output to be rounded off,I need the exact value,say for egIst field value is 1.23 and2nd field value is 2.89I want the output to be 4.12 not 4can anybody help meshan Link to comment https://forums.phpfreaks.com/topic/5915-exact-value/ Share on other sites More sharing options...
shocker-z Posted March 27, 2006 Share Posted March 27, 2006 [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?php$number1=1.23;$number2=2.89;echo $number1 + $number2;?>[/quote]That works fine for me :) Link to comment https://forums.phpfreaks.com/topic/5915-exact-value/#findComment-21125 Share on other sites More sharing options...
redbullmarky Posted March 27, 2006 Share Posted March 27, 2006 decimal/float numbers don't get rounded off unless you specify.[code]$a = 1.23;$b = 2.89;$c = $a+b;echo $c;// output is 4.12[/code] Link to comment https://forums.phpfreaks.com/topic/5915-exact-value/#findComment-21126 Share on other sites More sharing options...
shan_cool Posted March 27, 2006 Author Share Posted March 27, 2006 Hi, Thanks very much for ur reply,I am printing the value in excel so it rounding off by itself,so how can i do this..Please helpThnks in Advance,shan Link to comment https://forums.phpfreaks.com/topic/5915-exact-value/#findComment-21131 Share on other sites More sharing options...
Barand Posted March 27, 2006 Share Posted March 27, 2006 In case you hadn't noticed, this is a PHP forum, NOT M$ Office. Link to comment https://forums.phpfreaks.com/topic/5915-exact-value/#findComment-21133 Share on other sites More sharing options...
Recommended Posts