Unexpected output from Double Precision

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Unexpected output from Double Precision

Post by vamsi.4a6 »

Source is a sequential file, reading COL1 and COL2 as Double Precision. Target is an Oracle table. Output is not what is expected.

SOURCE:
COL1,COL2
-10240547.950000,219892.738536

current output:
COL1,COL2
-10240547.949999999,219892.73853599999

expected output:
COL1,COL2
-10240547.950000,219892.738536

In DataStage both COL1 AND COL2 are defined as Double.

In target Oracle table both columns are defined as Float(126). I do not have any control over target format table data type or length.

[Note: Topic / Title edited for clarity - Andy]
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
vamsi.4a6
Participant
Posts: 334
Joined: Sun Jan 22, 2012 7:06 am
Contact:

Post by vamsi.4a6 »

could anybody please help on this issue?
Thanks and Regards
Vamsi krishna.v
http://datastage-vamsi.blogspot.in/
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not really sure how. Welcome to the Wonderful World of Floating Point... it seems that someone made a less than ideal choice as to the target data type, unless there is some reason why it needs to be a float? They always complicate things. :(

Oracle even recommends you do not use FLOAT as a data type but rather their BINARY_FLOAT or BINARY_DOUBLE types as they are 'more robust'. And just as an FYI, 126 digits of binary precision is roughly equivalent to 38 digits of decimal precision. Scroll up a little bit up from here to begin their discussion of the data type.

Perhaps try to CAST the string to FLOAT in your target SQL? Or the double but I'd probably just read the fields from the file as plain old strings.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply