Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    134

    Unanswered: Float or Decimal?

    When should I choose decimal over float and vice versa?

    Mike B

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    You should always use a decimal if your data is definable. If it's not and you requiret the ability to perform float operations, you should use float. This should be rare or never. It's better to define the scope of the data in the planning stage.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I use DECIMAL for things that are really counts of something, like money. I use FLOAT for things that are measures, like distance or most kinds of weight. The two usages are fundamentally different, and the implementations (both from a storage and a manipulation perspective) are different too. It rarely works well if you use the wrong one!

    -PatP

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Yeah, you don't really want your accounting application to use FLOAT. (grin)
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by derrickleggett
    Yeah, you don't really want your accounting application to use FLOAT. (grin)
    Now that isn't entirely true!

    If you work for the kind of business that thinks about money in terms of "3 inches of $50 bills", then I'd have no problem with using a FLOAT. This would also make it lots easier to handle the conversion between money and grams of product too!

    I don't know of anybody that does accounting that way, but if they did then I'd be fine with the idea of using reals in that particular accounting system! The rest of us will have to make do with using more conventional things like MONEY or DECIMAL columns.

    -PatP

Posting Permissions

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