Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Round Function

0 views
Skip to first unread message

Steven Black

unread,
Jun 7, 2001, 8:22:39 AM6/7/01
to
I am having a problem I can't believe that the round() function only
rounds up a 6 or above. I want it to round 91.25 to 91.3 but it
doesn't it only starts to round with 91.26 or above. Is there anyway
to alter the round function or does anyone have a round UDF that will
do this? Please help. Thanks

Serge Rielau

unread,
Jun 7, 2001, 11:10:19 AM6/7/01
to
Hi,

This is fixed in V7.2 (or Fixpack 3) with the introduction of
SYSIBM.ROUND that handles decimal directly instead of converting to
floating point. Problem with the value given is that in floating point
the internal value is equivalent to 9.1249999999999999999999999....E+001.
Hence, it rounds down.
Here's the V7.2 test:

values round(91.25,1);

1
-------
91.30

1 record(s) selected.

When upgrading to FP3/V7.2 you may need to run the db2updv7 tool to place
the
new function in teh catalogs.

Cheers
Serge

0 new messages