lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Glenn Maynard wrote:
On Tue, Jun 14, 2005 at 11:55:39PM -0500, Rici Lake wrote:

On 14-Jun-05, at 7:19 PM, Chris Marrin wrote:

I have gotten recent experience with QueryPerformanceCounter(). I

I find this a bit puzzling. A double has 53 bits of precision. A day has 86400 seconds; log2 of 86400*3e9 is 47.88; in other words, a double can accurately represent a number of 3GHz ticks up to a bit over 34 days. After that, it should lose one bit of precision, which should be barely noticeable. In a year, you would lose less than four bits of precision. If you are reduced to a precision of 100ms, you are losing something like 28 bits of precision. This suggests that you were doing arithmetic with floats rather than doubles; floats have 24 bits of precision, or 29 less than doubles, which would work out to about the loss you are reporting.

Just to toss this out:

Are you using D3D, or something else that plays with the FPUCW?

Ahhhh, that explains a lot! Yes, we are using D3D, via Ogre. I remember on my last project we had a similar problem. My precision is low because D3D is resetting it to single-precision!!! Oh, well. I need to figure out how to get Ogre to set D3DCREATE_FPU_PRESERVE.

Thanks! But damn, now I don't have a tricky, subtle problem to solve :-)

chris marrin                ,""$, b`    $                             ,,.
(408) 955-3049          mP     b'                            , 1$'
Sony    ,.`           ,b`    ,`                              :$$'
     ,|`             mP    ,`                                       ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`
"As a general rule,don't solve puzzles that open portals to Hell"'