source data:sequential file
source value:2324.6199999999999
destination database: db2
data type :decimal(23,10)
We use float datatype to read the file and transform it to decimal(23,10), then the value in the db is 2324.6201171875
why?
how can i make the db2 value is also 2324.6199999999
precision problem from sequential file to DB2
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Try making the source data type VarChar or Char, rather than float.
Floating point numbers can not be fully accurately represented in digital computers; you can read about the IEEE 754 standard to understand why this is.
Conversion from string to decimal is far more likely to preserve the actual digits in the number represented in the text file.
Floating point numbers can not be fully accurately represented in digital computers; you can read about the IEEE 754 standard to understand why this is.
Conversion from string to decimal is far more likely to preserve the actual digits in the number represented in the text file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: