开发者

Float.parse of string number result in a another number in the DB

开发者 https://www.devze.com 2023-03-28 03:29 出处:网络
Why when I float.Parse a string \"109.7\" and inser开发者_高级运维t the result into the DB to a \'float\' column I get 109.69999694824219 instead of 109.7?

Why when I float.Parse a string "109.7" and inser开发者_高级运维t the result into the DB to a 'float' column I get 109.69999694824219 instead of 109.7?

I am using Microsoft SQL Server 2008 and C#. The string of the number is taken from a Text input field.


floats do not have full precision. You should use decimal.Parse instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消