Wednesday, June 26, 2013

Accuracy of float values

Hi Satheesh, float(53) is only upto double precision. You can use decimal or real.


Check the below:



DECLARE @a FLOAT(53),@b FLOAT(53),@c FLOAT(53);
DECLARE @Tab TABLE(ID INT IDENTITY(1,1), Num FLOAT(53));

select @a = 0.79,@b = 0.75,@c = 0.04;

INSERT @Tab
SELECT @a;

INSERT @Tab
SELECT @b + @c;

--Two rows
SELECT ID, Num
FROM @Tab;

--This gives one row
SELECT Id, Num
FROM @Tab
WHERE Num = 0.79;

--This gives two rows
SELECT Id, Num
FROM @Tab
WHERE Num between 0.78 AND 0.80;





Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.


No comments:

Post a Comment