0
I am trying to sum up positive and negative values in the Sqlserver database, but the same done by the calculator returns a different value.
I’m using
SUM(NR_QUANTIDADE)
The NR_QUANTIDADE column is of the float type in the database.
My values in the database are:
-9,9961
-30,41
-19,5939
60
Already the result of my select is returning:
-5,32907051820075E-15
And it would be right to return 0.
Enter your select here
– Leonardo Pessoa
Its problem is not of positive or negative numbers but of precision pq is impossible for the computer to have infinite precision and so there are always inaccuracies when dealing with decimal numbers. There are many questions about this here on the site, you can delete this issue that is redundant is looking for posts like these:https://answall.com/search?q=%5Bsql%5D+error+rounding
– jean