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.
Author |
Topic |
thangnc
Starting Member
7 Posts |
Posted - 2013-05-13 : 01:01:40
|
Hi all!My code:declare @f1 float, @f2 float, @f float;select @f1 = 0.3, @f2 = 0.3set @f = @f1 + @f2select @f +=@f1select @f = @f -0.9select @f----------------result @f: -1.11022302462516E-16why @f not = 0?How to do @f = 0? |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-13 : 01:18:30
|
float and real are only approximate numerical data types. so they actually precision may differ from what you see. SO if you want to deal with accurate numeric data use decimal or numeric------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|