Jump to content

Decimal(3,2)


Donovan

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.