lua-users home
lua-l archive

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


Hi,

Sebastian Rohde wrote:
> Okay I think I got the point. Would you say that there is no reason to set
> the FPU state? From my naïve point of view I would be surprised if there
> were no performance difference between the precision modes. 
> Do you have sources which state otherwise?

Here is a good summary: http://www.agner.org/assem/
The differences are minimal on modern x86 CPUs. Basically only
divisions are affected and most of the latency is shadowed by
out-of-order execution. I guess even this is irrelevant since
most computations are done by the GPU nowadays.

The point of the D3DCREATE_FPU_PRESERVE flag was that _switching_
the modes was slow on older CPUs, too. This is no longer true.
Even if you specify the flag, any DirectX drivers still run with
reduced precision (whether this has an impact or not).

> Nonetheless I would say that this should be noted more specifically in the
> api reference section of the reference manual or as an assertion (blame me
> if I did not just see it).

Well, I've filed this several times as a bug report ...

Suggestions for assertions in your own code:

  -- Initialize DirectX first, then check this:
  do local x = 100000000; assert(x+1 ~= x) end
  do local x = 111111111; assert(tostring(x) == tostring(x+0)) end
  assert(({1})[1] == 1)

Bye,
     Mike