sql server - Incorrect conversion from Float to Decimal -
my query relatively simple know root cause
sql query convert float decimal gives incorrect results.
example:
select cast(convert(decimal(25,8), convert(float,338193293.16))as varchar(255)) expected result: 338193293.16000000
actual result: 338193293.16000003
where did 3come from?
the number of digits - no matter after decimal point 2. use shorter number e.g. 38193293.16 or use float(24). normal float there "precision = 7 digits".
Comments
Post a Comment