Hi,

some time ago there was an error reported when running the testsuite on ix86, 
in the date.test/date-2.2c-*.

The error happens as a string like 1237962480.003 gets parsed and rounded to 
1237962480.002999... and is later truncated to 1237962480.002.

The rounding error happend in date.c:parseModifier(...):
p->iJD = (sqlite3_int64)r;

i.e. the double r is truncated by casting it to int.

Doing the following change fixes the error on ix86, and lets the testsuites
pass on i586, x86_64, aarch64, ppc64le, ...

- p->iJD = (sqlite3_int64)r;
+ p->iJD = (sqlite3_int64)(r + 0.5);

Also compare with date.c:setRawDateNumber(...), where rounding is already 
applied:

p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);

Kind regards,

Stefan

-- 
Stefan Brüns  /  Bergstraße 21  /  52062 Aachen
home: +49 241 53809034     mobile: +49 151 50412019

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to