Re: [sqlite] problem with date/time
On 7/26/07, JJ <[EMAIL PROTECTED]> wrote: Hi, I've solved the problem at last. One thing I didn't know that creating DirectX device will lower float point precision, it is written in their documentation... So creating DX app and running float calculations is no, no... :) Ah, interesting. Thanks for posting this, good to know the problem! - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem with date/time
Hi, I've solved the problem at last. One thing I didn't know that creating DirectX device will lower float point precision, it is written in their documentation... So creating DX app and running float calculations is no, no... :) On the other hand one might use D3DCREATE_FPU_PRESERVE flag, to avoid this problem at cost of perfomance. For my mapping software it didn't influence perfomance at all. D3DCREATE_FPU_PRESERVE Forces Direct3D to not change the floating-point unit control word, running the pipeline using the precision of the calling thread. Without this flag, Direct3D defaults to setting the floating-point unit to single-precision round-to-nearest mode. Using this flag with the floating-point unit in double-precision mode will reduce Direct3D performance. Perhaps will save someones day or two.. On Thu, 26 Jul 2007 19:35:13 +0300, JJ <[EMAIL PROTECTED]> wrote: > First, I have to say that it is likely another "memory leak" (mine) type > unobvious bug, it happens only once specific place in my program calls SQLite > with date/time function. I can't imagine how memory leak would cause > arithmetics to go bizzare, only perhaps something with floating point flags > in cpu (and thats far more than I am willing to know :)) > It seems that other compilers did job better. > > I've placed this into sqlite3WinCurrentTime() for test, in comments are bad > results I am getting. > >ft.dwHighDateTime = 29872031; >ft.dwLowDateTime = 49589324; >now = ((double)ft.dwHighDateTime) * 4294967296.0; // > 1.2829940050506547e+017 >rez = (now + ft.dwLowDateTime); // 1.2829940050506547e+017 >rez = (now + ft.dwLowDateTime)/8640.0; // 148494.6718750 >rez = (now + ft.dwLowDateTime)/8640.0 + 2305813.5; // > 2454308.25 > > System info: > Brand = Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz > Family = 6 > Model = 15 > Stepping = 6 > > And here is compiler logo/options as run in msvc2007: > > 1>Compiling... > 1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for > 80x86 > 1>Copyright (C) Microsoft Corporation. All rights reserved. > 1>cl /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "OS_WIN" /D > "NO_TCL" /D "DB_SQLITE_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_WINDLL" > /Gm /EHa /RTC1 /MTd /fp:strict /fp:except /Fo"Debug\\" /Fd"Debug\vc80.pdb" > /W3 /c /ZI /TC .\sqlite\where.c > > Hope anything usefull for you. > > On Tue, 24 Jul 2007 23:49:28 +0300, Trevor Talbot <[EMAIL PROTECTED]> wrote: > >> On 7/24/07, JJ <[EMAIL PROTECTED]> wrote: >> > >> Would you be willing to post a small test case (or send to me >> privately)? Along with the exact compiler version and CPU. I very >> much want to figure out exactly what this problem is, since it's >> supposed to work. >> > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem with date/time
First, I have to say that it is likely another "memory leak" (mine) type unobvious bug, it happens only once specific place in my program calls SQLite with date/time function. I can't imagine how memory leak would cause arithmetics to go bizzare, only perhaps something with floating point flags in cpu (and thats far more than I am willing to know :)) It seems that other compilers did job better. I've placed this into sqlite3WinCurrentTime() for test, in comments are bad results I am getting. ft.dwHighDateTime = 29872031; ft.dwLowDateTime = 49589324; now = ((double)ft.dwHighDateTime) * 4294967296.0; // 1.2829940050506547e+017 rez = (now + ft.dwLowDateTime); // 1.2829940050506547e+017 rez = (now + ft.dwLowDateTime)/8640.0; // 148494.6718750 rez = (now + ft.dwLowDateTime)/8640.0 + 2305813.5; // 2454308.25 System info: Brand = Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz Family = 6 Model = 15 Stepping = 6 And here is compiler logo/options as run in msvc2007: 1>Compiling... 1>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>cl /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "OS_WIN" /D "NO_TCL" /D "DB_SQLITE_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_WINDLL" /Gm /EHa /RTC1 /MTd /fp:strict /fp:except /Fo"Debug\\" /Fd"Debug\vc80.pdb" /W3 /c /ZI /TC .\sqlite\where.c Hope anything usefull for you. On Tue, 24 Jul 2007 23:49:28 +0300, Trevor Talbot <[EMAIL PROTECTED]> wrote: > On 7/24/07, JJ <[EMAIL PROTECTED]> wrote: > > Would you be willing to post a small test case (or send to me > privately)? Along with the exact compiler version and CPU. I very > much want to figure out exactly what this problem is, since it's > supposed to work. > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re[2]: [sqlite] problem with date/time
Hello Trevor, Tuesday, July 24, 2007, 4:49:28 PM, you wrote: TT> On 7/24/07, JJ <[EMAIL PROTECTED]> wrote: >> Yes it were returning same number all the time, I've broke down calculations >> of UTC to Julian date type and saw significant floating point errors >> (rounding) in calculation, it couldn't hold such numbers and to me seemed to >> ignore double data type, but used float instead. (i've played through bunch >> of compiler settings, pragmas, etc with no significant gain). Actually tried >> my own calculation which operates with smaller numbers, but in the end when >> result should be stored, numbers got messed again. Damn, I didn't meant to >> spend 4 hours on this... TT> Hmm, that's worrying. >> I've abandoned msvc compiler and using trial intel compiler for now... No >> problems on new compiler with calculations.. TT> Would you be willing to post a small test case (or send to me TT> privately)? Along with the exact compiler version and CPU. I very TT> much want to figure out exactly what this problem is, since it's TT> supposed to work. TT> - TT> To unsubscribe, send email to [EMAIL PROTECTED] TT> - Have you played with the different floating point options in the compiler? In MSVC under floating point options you can specify "fast" or "precise". -- Best regards, Tegmailto:[EMAIL PROTECTED] - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem with date/time
On 7/24/07, JJ <[EMAIL PROTECTED]> wrote: Yes it were returning same number all the time, I've broke down calculations of UTC to Julian date type and saw significant floating point errors (rounding) in calculation, it couldn't hold such numbers and to me seemed to ignore double data type, but used float instead. (i've played through bunch of compiler settings, pragmas, etc with no significant gain). Actually tried my own calculation which operates with smaller numbers, but in the end when result should be stored, numbers got messed again. Damn, I didn't meant to spend 4 hours on this... Hmm, that's worrying. I've abandoned msvc compiler and using trial intel compiler for now... No problems on new compiler with calculations.. Would you be willing to post a small test case (or send to me privately)? Along with the exact compiler version and CPU. I very much want to figure out exactly what this problem is, since it's supposed to work. - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem with date/time
Yes it were returning same number all the time, I've broke down calculations of UTC to Julian date type and saw significant floating point errors (rounding) in calculation, it couldn't hold such numbers and to me seemed to ignore double data type, but used float instead. (i've played through bunch of compiler settings, pragmas, etc with no significant gain). Actually tried my own calculation which operates with smaller numbers, but in the end when result should be stored, numbers got messed again. Damn, I didn't meant to spend 4 hours on this... I've abandoned msvc compiler and using trial intel compiler for now... No problems on new compiler with calculations.. On Tue, 24 Jul 2007 02:13:46 +0300, Trevor Talbot <[EMAIL PROTECTED]> wrote: > On 7/23/07, JJ <[EMAIL PROTECTED]> wrote: >> Hi, I am having problems with my compiled sqlite (win32/vs2005). All was >> working fine until I needed to use date/time functions, following sql always >> returns same date/time (date part is correct only time was pointing to 18:00) >> >> SELECT strftime( '%s', 'now') > > So it's always returning 1185213600 exactly? > >> After diging source code with debuger, I found out that my top of the line >> OS/Compiler/CPU couldn't handle data type double. I've tried all possible >> floating point models, with and without SSE, nothing seems to allow it >> handle data with any significant precision. > > There's nothing technically wrong with vs2005 on x86. I suspect the > problem is with algorithmic conversion somewhere, not the data type. > > - > To unsubscribe, send email to [EMAIL PROTECTED] > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] problem with date/time
On 7/23/07, JJ <[EMAIL PROTECTED]> wrote: Hi, I am having problems with my compiled sqlite (win32/vs2005). All was working fine until I needed to use date/time functions, following sql always returns same date/time (date part is correct only time was pointing to 18:00) SELECT strftime( '%s', 'now') So it's always returning 1185213600 exactly? After diging source code with debuger, I found out that my top of the line OS/Compiler/CPU couldn't handle data type double. I've tried all possible floating point models, with and without SSE, nothing seems to allow it handle data with any significant precision. There's nothing technically wrong with vs2005 on x86. I suspect the problem is with algorithmic conversion somewhere, not the data type. - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] problem with date/time
Hi, I am having problems with my compiled sqlite (win32/vs2005). All was working fine until I needed to use date/time functions, following sql always returns same date/time (date part is correct only time was pointing to 18:00) SELECT strftime( '%s', 'now') After diging source code with debuger, I found out that my top of the line OS/Compiler/CPU couldn't handle data type double. I've tried all possible floating point models, with and without SSE, nothing seems to allow it handle data with any significant precision. I know that it is not directly related to sqlite bug (as it turned out now), but ANY help before I get hold of intel compiler, would be much appreciated. - To unsubscribe, send email to [EMAIL PROTECTED] -