Results 1 to 2 of 2

Thread: sql express 2005 float field

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    sql express 2005 float field

    Hey,

    I have a field called tax in my table which is of type float.
    When I save a value of 0.08 for example, it is stored in the table as
    0.079999998211860657. Is this normal? Why isn't it stored as 0.08?

    Thanks,
    Don't anthropomorphize computers -- they hate it

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: sql express 2005 float field

    Quote Originally Posted by vbgladiator
    Hey,

    I have a field called tax in my table which is of type float.
    When I save a value of 0.08 for example, it is stored in the table as
    0.079999998211860657. Is this normal? Why isn't it stored as 0.08?

    Thanks,
    There is a DB section to this forum - btw

    MONEY is the proper datatype for "accurate" values that might go to 4 decimal places. FLOATING point datatypes store values the way you have reported - do not use them...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

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



Click Here to Expand Forum to Full Width