Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1101795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:05:14+00:00 2026-05-17T01:05:14+00:00

My table has few fields with an amount column of type decimal. This column

  • 0
  1. My table has few fields with an amount column of type decimal.
  2. This column will have either a deposited amount (a positive value) or a withdraw amount (a negative value).
  3. I store the positive value as just 120 and the negative value as -50.
  4. I sum the column and got the result as expected.
  5. Mysql version is: 5.1.33-community.
  6. When i checked mysql documentation about decimal i confused with their description.

  7. Before MySQL 5.0.3, if you inserted
    +0003.1 into a DECIMAL(5,1) column, it was stored as +0003.1. As of MySQL
    5.0.3, it is stored as 3.1. For negative numbers, a literal –
    character is no longer stored.
    Applications that rely on the older
    behavior must be modified to account
    for this change. http://dev.mysql.com/doc/refman/5.0/en/precision-math-decimal-changes.html

  8. When i listed the rows in phpmyadmin i could see the negative sign and when i calculated the result was as expected. but the documentation said no sign will appear.

  9. Is it good to store negative number in decimal(haven’t i studied in school? confused)?… or do we have to use float.

  10. I learn’t that float would complicate calculations and was advised to stick with decimal for certain conditions.

    I would like to have suggestions for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:05:15+00:00Added an answer on May 17, 2026 at 1:05 am

    From what I understand, the documentation is saying it won’t store a literal “-” character, which means it’s probably now doing what the other signed INTEGER fields have always done and it’s storing a sign bit to denote negative numbers instead.

    You’re still seeing a minus sign preceding the number because it’s being generated by MySQL as a result of that sign bit.

    If you don’t understand the sign bit, you can consider how a signed byte can store numbers from -128 to 127, while an unsigned byte can store numbers from 0 to 255. That’s because one of the 8 bits in a signed number is being used to store +/- (1 is negative, 0 is positive), while the remaining bits offer numbers up to 2^7 (-128 or 127).

    So, for example, if the bits 1111 had a sign bit they would equal -7 (negative+4+2+1), but if they were unsigned they’d equal 15 (8+4+2+1). It’s still the same amount of bits being stored.

    You may wonder why the negative bound in a signed number can use the 8th bit, while the positive bound is limited to the sum of the 7 bits (1 less than the 8th bit). This is because 10000000 is considered to be both negative and the 8th bit simultaneously, because its representation of -0 otherwise is redundant with 00000000 which represents 0. There’s no distinction between negative and positive zero, so a negative most significant bit is always the value of that bit itself (but negative).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a table source, the form has a few fields
I have table with permissions that has few bit fields. I want to group
I have a table, tblDocs that has a few columns: DocName varchar(50) DocLocation int
My DB table has a column that can contain a very big amount of
I have few thousands of records with few 100 fields in a MySQL Table.
I have a table that I am drawing information on that has a few
I have a nice clean UI within a table view which has a few
Problem: A Table in MySQL that has a few normal fields and one text
I'm not really sure how to define this. I have a table that has
I have a jqgrid where the database table has a few thousand rows, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.