mjurmann Posted November 15, 2006 Share Posted November 15, 2006 Hi guys. I'm trying to round a floating number to only 2 decimal places. However, with the code i'm using, it isn't rounding at all. Can someone tell me what simple error I made?Code:[code]echo '<br/>' . round((($row_Recordset2['rating_number']/$row_Recordset2['rating_overall']) * 10), 2) . '/' . 10 ;[/code] Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/ Share on other sites More sharing options...
mjurmann Posted November 15, 2006 Author Share Posted November 15, 2006 Anyone? Please? Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/#findComment-125233 Share on other sites More sharing options...
kenrbnsn Posted November 15, 2006 Share Posted November 15, 2006 What problem are you seeing?Please don't bump your posts so quickly. Wait at least an hour or two for responses.Ken Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/#findComment-125235 Share on other sites More sharing options...
mjurmann Posted November 15, 2006 Author Share Posted November 15, 2006 Sorry about that.Instead of getting 3.94 I'm getting 3.94736842105. Any ideas? Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/#findComment-125242 Share on other sites More sharing options...
roopurt18 Posted November 15, 2006 Share Posted November 15, 2006 number_format(3.947368, 2); Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/#findComment-125273 Share on other sites More sharing options...
doni49 Posted November 15, 2006 Share Posted November 15, 2006 round(3.94736842105,2);www.php.net/round Link to comment https://forums.phpfreaks.com/topic/27382-simple-decimal-rounding-issue/#findComment-125278 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.