float type data problem
-
Hi all, I've got a problem when manipulating on float type data, I'm working on SQL Server 2005. Here is the code: DECLARE @First float, @Second float, @Third float SET @First = 1.22 SET @Second = 2.72 SET @Third = 3.94 SELECT @First + @Second - @Third The result is "4.44089209850063E-16" instead "0" I can't understand this situation Thanks a lot
-
Hi all, I've got a problem when manipulating on float type data, I'm working on SQL Server 2005. Here is the code: DECLARE @First float, @Second float, @Third float SET @First = 1.22 SET @Second = 2.72 SET @Third = 3.94 SELECT @First + @Second - @Third The result is "4.44089209850063E-16" instead "0" I can't understand this situation Thanks a lot
-
Hi all, I've got a problem when manipulating on float type data, I'm working on SQL Server 2005. Here is the code: DECLARE @First float, @Second float, @Third float SET @First = 1.22 SET @Second = 2.72 SET @Third = 3.94 SELECT @First + @Second - @Third The result is "4.44089209850063E-16" instead "0" I can't understand this situation Thanks a lot
Yeah floating point arithmetic isn't ever exact. 4.4 * 10^-16 is so small its pretty much zero anyway - close enough! ;)
Mark Churchill Director Dunn & Churchill Free Download:
Diamond Binding: The simple, powerful, reliable, and effective data layer toolkit for Visual Studio.