I have some floating field problem

i have 2 field , field A as float, field B as float

in a record field A has 0.15 value and field B has 0.15 value also (Using Select statement)

but when i use “Select fieldA – fieldB From tableName Where KeyField = Key” the result is 2.77555756156289E-17

i encountered the problem when i have unexpected result from my stored procedure that determine deviation of the two fields. i still dunno why this happening (i’m using sql server 2008)

]]>select Cos((90 – 38.588032) / (180 / PI())) * Cos((90 – 38.588032) / (180 / PI())) + Sin((90 – 38.588032) / (180 / PI())) * Sin((90 – 38.588032) / (180 / PI())) * Cos((-90.585533 – -90.585533) / (180 / PI()))

fails:

select Acos(Cos((90 – 38.588032) / (180 / PI())) * Cos((90 – 38.588032) / (180 / PI())) + Sin((90 – 38.588032) / (180 / PI())) * Sin((90 – 38.588032) / (180 / PI())) * Cos((-90.585533 – -90.585533) / (180 / PI())))

And just FYI, your blog has helped me SO VERY MUCH in my job as an analyst. Thank you thank you thank you!

]]>