Hi Mike,

well, first of all you must have a typo, since the sql you show will
return 14170, not 0.69 or anything like it.

Yes, typo, sorry. The short version returns 14169 but should give 14170, as per my correction a minute ago.

however, one thing springs out:

Total * 100 + 100 is wrong IMHO, unless you are looking for CEILING functionallity. "round" would need : total * 100 +50 (which rounds to nearest integer at
two decimal points, not to the nearest LARGER integer,
which is what your sample does)

I shouldn't have complicated my question by using the word "round". It's not the rounding that I'm trying to do. The input values are already rounded to two decimal places (cents of the dollar). I am trying to output fixed decimal places. So 141.7 should output as 141.70, and 23 should output as 23.00 etc.

I think I actually found a fix to the apparent bug in cast, by rounding the product to zero decimal places, even though the result should be the same:

select cast( 141.70 * 100 as integer)

gives the incorrect 14169

but this workaround:

select cast( round(141.70 * 100, 0) as integer)

gives the correct: 14170

Now the question is, does this fix the problem, or only for some numbers?

Tom


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to