Question : Float in conditions

In http://msdn.microsoft.com/en-us/library/ms187912%28SQL.90%29.aspx, we read:

"Avoid using float or real columns in WHERE clause search conditions, especially the = and <> operators. It is best to limit float and real columns to > or < comparisons."

what is the technical reason for the above?

Answer : Float in conditions

because they are approximate datatype, so when you do an equal or not equal comparison, if you don't have precision your comparison can fail. For example

100.123903  = 100.12390299 will fail although they are approximately the same .

Random Solutions  
 
programming4us programming4us