Results 1 to 5 of 5

Thread: DataType Decimal or double for Currency?

  1. #1
    Join Date
    Jan 2009
    Posts
    36

    DataType Decimal or double for Currency?

    Hello friends!

    I have a simple question about data type for money

    Which is a better practice to use decimal or double for currency or money?

    What you guys say?

  2. #2
    Join Date
    Jan 2009
    Posts
    9

    Re: DataType Decimal or double for Currency?

    I always use Decimal when I need to do anything with decimals, especially currency. This was told to us by our .net professor!

  3. #3
    Join Date
    Jan 2009
    Posts
    19

    Re: DataType Decimal or double for Currency?

    In general discussion about decimal & double.

    If it is "scientific" measurement (I mean weight, length, area etc) use double.

    If it is financial, or has anything to do with law (e.g. the area of a property) then use decimal.

    The hard part is rounding.

    If the tax is 2.4% do you round in the details or after the sum?

    Most of the time yo have to do both (AND fix the difs)

  4. #4
    Join Date
    Aug 2008
    Posts
    145

    Re: DataType Decimal or double for Currency?

    Money should be a money type assuming that everything is going to be either in whole cents or (like gasoline) in whole mils (tenths of a cent)

    Quantity is tricky.

    4.5 L... is it always going to be a whole number of mL? If so, a decimal type with three decimal places would be a good choice, or just use int and store mL internally.

  5. #5
    Join Date
    Jan 2009
    Posts
    18

    Re: DataType Decimal or double for Currency?

    Please have a look at this
    http://www.yoda.arachsys.com/csharp/decimal.html
    here you will find the exact importance of using decimal over double for currency or money!

Similar Threads

  1. Replies: 7
    Last Post: 28-12-2011, 05:18 PM
  2. Changing the entity of a datatype
    By GOOL in forum Software Development
    Replies: 6
    Last Post: 06-01-2011, 08:31 AM
  3. Change double datatype in parameter
    By ISAIAH in forum Software Development
    Replies: 5
    Last Post: 08-03-2010, 09:24 AM
  4. Reducing Double to 2 Decimal Places
    By Level8 in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 09:00 PM
  5. C# timestamp datatype
    By Mehraj in forum Software Development
    Replies: 3
    Last Post: 04-08-2009, 06:58 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,726,977,005.92587 seconds with 17 queries