Sample Header Ad - 728x90

Does Sqlserver store number of relevant decimals in a float field

0 votes
1 answer
182 views
I have a table in sql server containing a float field. This field displays a different number of decimals from row to row. I know for a fact that a float field CAN NOT contain the exact value 3173.77, so some rounding is going on here below: SELECT Weight ... FROM ... WHERE ... result : 3173,77001953125 3173,77 but somehow sqlserverstudio somehow rounds to different lengths. Is this because a precision is stored ? SELECT CAST(Weight AS DECIMAL(38,30)) ... FROM ... WHERE ... result : 3173.770019531250000000000000000000 3173.769999999999981810105964541435 or is this because the second number in this case can round to 3173.77000000000000
Asked by Bob (1 rep)
Mar 23, 2023, 03:19 PM
Last activity: Mar 23, 2023, 06:01 PM