Hi, I would like to report the following as a bug in SQLITE:
The SQLITE "round" function fails to round between 4.1 and 4.6% of numbers correctly to x decimal places when held as x+1 decimal places. The simplest example I have found with x=1 is: "select round(1.15,1)" Result: "1.1" (should be 1.2) Here is a script which demonstrates the problem where x=6: <<<<< --Temporary table for random numbers create table _x (R real not null); --Populate random numbers with x as ( --10 rows select 0 as x union all select 1 union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 ) insert into _x select round(abs(random()/10000000000000.0),7) as R from x,x,x,x; --10,000 rows rounded to 7dp --Round to 6dp and display the rows with rounding errors select R ,round(R,6) as Rounded --Sometimes wrong ,round(R*1000000,0)/1000000 as Workarounded --Always correct from _x where round(R,6) <> round(R*1000000,0)/1000000; --Tidy up drop table _x; >>>>> Neither SQL Server nor Oracle exhibit this problem. Best regards, Adrian Sherwin _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users