Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003
    Posts
    16

    Unanswered: Db2 Bigdecimal to Real conversion error

    Hi All,
    I am trying to insert java BigDecimal object into Db2 real column type. This works fine in general. However, when I have a 9 digit number, rounding takes place. For eg, when I am trying to insert 1234567.89 into real type column, the data stored in the db2 column is 1234567.85

    Could anyone tell me how to avoid this rounding. The above occurs only for 9 or more digit numbers.

    Thanks
    Sk

  2. #2
    Join Date
    May 2002
    Location
    General Deheza, Cba, Arg.
    Posts
    276

    Re: Db2 Bigdecimal to Real conversion error

    Hi,
    Where you see this value rounding?

  3. #3
    Join Date
    Apr 2003
    Posts
    191

    Re: Db2 Bigdecimal to Real conversion error

    Hi,

    datatype REAL's internal represantation is 4 bytes long. Try to store in DOUBLE instead and you should be fine.

    BTW, with REAL I got a loss of accuracy when I went from 7 to 8 digits. So after all, you are not that bad off!

    Johann

    Originally posted by sselvakumar72
    Hi All,
    I am trying to insert java BigDecimal object into Db2 real column type. This works fine in general. However, when I have a 9 digit number, rounding takes place. For eg, when I am trying to insert 1234567.89 into real type column, the data stored in the db2 column is 1234567.85

    Could anyone tell me how to avoid this rounding. The above occurs only for 9 or more digit numbers.

    Thanks
    Sk

Posting Permissions

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