Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161

    Unanswered: 1.00 ends up as 0.99 in float(2,2) field

    Hi

    I have a Distance filename of float(2,2) type but when I inserted 1.00 it end up with 0.99. Any way to get it exactly 1.00 ?

    Thanks
    MySQL 5.1

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    yes, there's a real easy way to get 1.00 when you insert 1.00

    use DECIMAL(3,2)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    161
    Oh...I thought it was declared as x digits before the decimal followed by y digits after the decimal place.

    Thanks
    MySQL 5.1

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no, it is declared as x total digits, y digits after the decimal

    but the main thing is, if you want an accurate value, don't use FLOAT
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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