peterjc Posted September 10, 2007 Share Posted September 10, 2007 I have a problem here. When i try to sum the float number, I does not get accurate answer. For example: 20.5 + 10.8 = 31.3 (This is correct) But if i use the Mysql Sum function to sum the two number, the answer is inaccurate, just for example, you may get 31.300000054 What is the problem and how to solve this problem? thank Quote Link to comment Share on other sites More sharing options...
Illusion Posted September 10, 2007 Share Posted September 10, 2007 ROUND() Quote Link to comment Share on other sites More sharing options...
peterjc Posted September 11, 2007 Author Share Posted September 11, 2007 Illusion, could you please explain it a bit more details about the "ROUND()"? i am a new the this actually so do not understand so much. Thank you Quote Link to comment Share on other sites More sharing options...
Illusion Posted September 11, 2007 Share Posted September 11, 2007 select ROUND(SUM(20.5 + 10.,1) ; the second argument for ROUND function is the no of decimal places. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.