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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 calculation problem with float data type

Author  Topic 

s0ftw4r32002
Starting Member

6 Posts

Posted - 2008-08-27 : 01:54:40
DECLARE @qty float
DECLARE @value float
DECLARE @cogs float
SET @qty = 65300000.00
SET @value = 26491627.7334113 ---> original value
set @cogs = @value / @qty

select @qty * @cogs

result : 26491627.7334112

why the result not back orginal value?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-27 : 01:56:31
same as before . float is only an approximate value.Try more accurate datatypes like decimal or numeric
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-08-27 : 01:58:18
because because . . . float is approximate value . . .

see http://msdn.microsoft.com/en-us/library/ms173773.aspx?wt.slv=RightRail


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -