Do you use the float datatype?
I thought I’d perhaps blog about this although I don’t truly think this is of any real significance unless you like to use the flat datatype, which I hope you don’t.
I had restored a production backup onto a development box and the guys had run a couple of checks and found a sum of the data returned different values. As this is a financial system the fact there is a difference is important.
My initial thought was that there was something about a float datatype but I couldn’t remember exactly what, my vague memories were that the floating point precision of the cpu affected the accuracy – I should point out that I don’t recommend using the float datatype and always use numeric, however, this is a client database and an answer was required.
I posted and eventually received confirmation:-
http://www.sqlcommunity.com/Discussions/tabid/54/forumid/10/threadid/18/scope/posts/Default.aspx
A float is an approximately data type. It will not produce the same results from one processor architecture to another and won't even necessarily do so from one machine to another. In addition, you are using a float in computations, then you will be compounding rounding factors which magnifies the effect. If you need the calculations to a high precision as well as also requiring them to be exactly the same regardless of machine or processor architecture, then you need to replace the float data type with a decimal data type.
Michael Hotek Vice-President MHS Enterprises, Inc President FilAm Software Technology, Inc.
Shawn also pointed me to Ken Henderson’s blog , thanks,
http://blogs.msdn.com/khen1234/archive/2005/05/13/417153.aspx
However I took Ken’s sample code and ran it across a few servers, on the SQL 2000 servers I got the same results as Ken but I could not get this with SQL 2005 32 or 64 bit so maybe the float isn’t so vague in SQL 2005.