|
This isn't so much a question but more like a "what the?!". If I have the float value "3.4173900000000001E+000" and issue a "ROUND( 3.4173900000000001E+000, 2 )", I get (drum roll) 3.4199999999999999E+000. Cast as a dec with 2 decimal places and viola! You get 3.41739 rounded to 3.41. This statement shows it all. SELECT FLOAT(3.41739) AS NUM, ROUND( FLOAT(3.41739), 2 ) AS ROUNDED_NUM, CAST( ROUND( FLOAT(3.41739), 2 ) AS DEC(5,2) ) AS CASTED_ROUNDED_NUM FROM SYSIBM/SYSDUMMY1 Output: NUM ROUNDED_NUM CASTED_ROUNDED_NUM 3.4173900000000001E+000 3.4199999999999999E+000 3.41 Of course I know to cast it to 3 decimal places before the round, but still... Mark
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.