Donovan Posted January 23, 2008 Share Posted January 23, 2008 If I have a Decimal(3,2) datatype, and try to enter a value such as 100 it returns 99.99. Why is that? I have a table for student grades and need to enter in either 100 or any other possible grade such as 98.60 or 87.43... etc. This works with Decimal(4,2) but I don't know why. Quote Link to comment Share on other sites More sharing options...
obsidian Posted January 23, 2008 Share Posted January 23, 2008 If I have a Decimal(3,2) datatype, and try to enter a value such as 100 it returns 99.99. Why is that? I have a table for student grades and need to enter in either 100 or any other possible grade such as 98.60 or 87.43... etc. This works with Decimal(4,2) but I don't know why. According to the MySql manual page, the first number is the total number of digits, and the second number is the number of digits to the right of the decimal, so hypothetically, to do your calculations correctly, you really should use (5, 2) since 100.00 is five digits and 2 digits are past the decimal. 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.