Archives of the TeradataForum
Message Posted: Thu, 26 Oct 2006 @ 13:48:38 GMT
Subj: | | Re: Question about Oracle ROUND() function UDF |
|
From: | | Michael Larkins |
You probably don't want to do this:
| You can try select cast(0.25+0.01 as decimal(15,1)). | |
Think about this situation:
cast(0.34 +.01 as dec(15,1)) ------> becomes: 0.4 when it should be 0.3.
If you are going to adjust, use a value smaller than you are rounding to ie:
cast(0.34 +.001 as dec(15,1)) --> becomes: 0.3 and it should be 0.3.
cast(0.25 +.001 as dec(15,1)) --> becomes: 0.3 and it should be 0.3
because .251 is more than half way.
Hope this helps,
Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
|