# Thread: make the results to two decimal places

1. ## make the results to two decimal places

First of all (some background) - I know nothing about programming in anything except VB for Applications in Excel and a little SQL.

21 months ago my employer insisted in purchasing custom software I specified from a Chinese company with limited English skills. Today there is no end in sight. (Additionally, I am not certain he is using C++, but I believe it is a C language.) Last conference call w/screen sharing he opened his code and I was able to read it enough to find some errors in his calculations.

I have questioned him why on every calculation he multiplies by .01 and then multiplies by 100. His answer to this question was "multiply by *.01 then multiply by *100 is to make the results to two decimal places". Which seems absurd to me.

Sample code:
Code:
`@MinPer=(select top 1 cast(MinPer as numeric(9,2))*0.01/(case when UOM='sec' then 60 else 1 end)*100 `
Doesn't the 2 in numeric(9,2) mean truncate to two decimal places?

2. >> Doesn't the 2 in numeric(9,2) mean truncate to two decimal places?
Something like that it seems: decimal and numeric (Transact-SQL)

>> Which seems absurd to me.
Seems that way to me too. In an expression using decimal data types, dividing by 100 then multiplying by 100 neither truncates nor rounds.

I'm no SQL guru, but it seems to have similar data type precedence rules as C: Data Type Precedence (Transact-SQL)

gg