Reputation: 688
I created console application where I'm using EF. I've got model where are some float variables. In my Database I also use FLOAT.
In c# I have got this value: 3,3 After insert it to my database there is value: 3,29999995231628
Why is it happening?
Upvotes: 0
Views: 654
Reputation: 33
This is because FLOAT
is an approximate numeric datatype. You can use DECIMAL
or NUMERIC
, instead.
For detailed explanation, check this SO post: Difference between numeric, float and decimal in SQL Server
Upvotes: 1
Reputation: 47464
The FLOAT
data type is not a precise data type. If you need exact precision then you should be using DECIMAL
or NUMERIC
.
Upvotes: 4