www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] How do you store this number in the database.

  1. #1
    Join Date
    Jan 2010
    Posts
    11

    resolved [RESOLVED] How do you store this number in the database.

    Hi,

    For all people good with numbers, Im not very good with numbers and i cant seem to store this number in the database, 0.025, it always gets round up to 0.030, what can i do, can you explain me what it means. its for storing money. Im using decimal(4, 3)
    Thanks very much, i really need help
    Last edited by juanlr; 04-11-2013 at 12:54 AM.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,408
    As far as I know, that should be okay, but remember that the "4" in the type definition is the number of significant digits (not just the number of digits to the left of the decimal), so rounding may occur with a value like 12.025, which would require 5 significant digits to avoid any rounding. But in this specific circumstance, I'd be more suspicious of the application code for now, until proven otherwise.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Oct 2010
    Location
    Ohio
    Posts
    233
    For what its worth, 0.025 comes back as 0.025 in SQL Server and MySQL:
    SQL Server Fiddle
    MySQL Fiddle
    ~Ryan
    www.rdennispallas.com <-- Personal Site, changing regularly cuz its ugly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles