I'm running DB2 v7 for z/OS. When I use SPUFI, SELECT CAST(6.0 AS
FLOAT)/CAST(10.0 AS FLOAT) FROM SYSIBM.SYSDUMMY 1 returns
0.6000000000000 000E+00. When I use DSNTIAUL,DSNTEP 2, or DSNALI (call
attach facility), the same statement returns 0.5999999999999 9999E 00.
The only reason I$B!G(Bve heard to explain this behavior is that float
stores too much precision, but I$B!G(Bve used double-precision floating-
point data types in SQL Server$B!G(Bs Transact-SQL, COBOL, VB.NET and I
haven$B!G(Bt seen this odd behavior. DB2$B!G(Bs SQL is the only language I know
of where 6/10 $B!b(B 0.6.
My particular problem is that my COBOL programs are getting inacurate
results (6/10 $B!b(B 10) when using CAF to divide the values of some FLOAT
columns on a DB2 table. The only two work-arounds I can think of are
a) Don$B!G(Bt use SQL to do divide the column values
b) Round the resulting value
I$B!G(Bm not keen on either band-aid, but I don$B!G(Bt see any DSNALI call
parameters that could solve this problem. Can anyone help?
P.S. Changing the data type is not an option for us. We need to store
a wide variety of precisions in these columns.
Thanks in advance,
Mike
FLOAT)/CAST(10.0 AS FLOAT) FROM SYSIBM.SYSDUMMY 1 returns
0.6000000000000 000E+00. When I use DSNTIAUL,DSNTEP 2, or DSNALI (call
attach facility), the same statement returns 0.5999999999999 9999E 00.
The only reason I$B!G(Bve heard to explain this behavior is that float
stores too much precision, but I$B!G(Bve used double-precision floating-
point data types in SQL Server$B!G(Bs Transact-SQL, COBOL, VB.NET and I
haven$B!G(Bt seen this odd behavior. DB2$B!G(Bs SQL is the only language I know
of where 6/10 $B!b(B 0.6.
My particular problem is that my COBOL programs are getting inacurate
results (6/10 $B!b(B 10) when using CAF to divide the values of some FLOAT
columns on a DB2 table. The only two work-arounds I can think of are
a) Don$B!G(Bt use SQL to do divide the column values
b) Round the resulting value
I$B!G(Bm not keen on either band-aid, but I don$B!G(Bt see any DSNALI call
parameters that could solve this problem. Can anyone help?
P.S. Changing the data type is not an option for us. We need to store
a wide variety of precisions in these columns.
Thanks in advance,
Mike
Comment