Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hi all,I've got a problem when manipulating on float type dataHere is the code:DECLARE @First float, @Second float, @Third floatSET @First = 1.22SET @Second = 2.72SET @Third = 3.94SELECT @First + @Second - @ThirdThe result is "4.44089209850063E-16" instead "0"How was that ?Thanks a lot
khtan
In (Som, Ni, Yak)
17689 Posts
Posted - 2008-07-06 : 22:58:33
float is approximate value. Use numeric or decimal instead if you don't required the high precision.KH[spoiler]Time is always against us[/spoiler]
Produced 0.0000The Numeric and Decimal types are specified by <type>(LENGTH,PRECISION). so (10,4) is 10 wide with 4 decimal places. (so 999999.9999 is the biggest number it can hold.-------------Charlie