PRECISION
When using floating-point the results of 2 identical-looking expressions with
the same values are not normally guaranteed to give exactly the same results.
This is because PC processors normally do all their floating-point calculations
at extended precision (80 bits), regardless of what type the variables or C expressions
have. This is not normally a problem with a renderer or a single player
game because if the pixels or movement aren't exactly the same, you probably won't
notice. (The variations are extremely small). However, with a multi-player
network game, this is a problem because all computers on the network need to do
exactly the same physics or movement code to come up with the same results.
With 3D Now! and Streaming SIMD Extensions the problems become even more serious
because these use single-precision floating-point values and also use flush-to-zero
mode (making very small values be zero).
To solve this problem, VectorC has a compiler pragma called '#pragma precision'.
Use this to switch between forcing consistent precision and inconsistent precision.
'#pragma precision+' will force consistent precision. 3D Now! and SSE
will not be used. Floating-point optimizations that give inconsistent
results will not be applied. Expression temporaries will always use 80-bit
precision. Floating-point variables that are not 80-bit will not be kept
in registers. The resulting code will give the same results across a network
of PCs using different processors and different optimization settings.
The code will, however, be slower than if this option was not set.
- You must make sure that you do not call any floating-point functions
that use inconsistent precision within consistent precision code sections.
VectorC cannot check this for you.
- This option will not guarantee consistence with other compilers.
'#pragma precision-' will enable all floating-point optimizations. Floating-point
variables can be stored in floating-point registers. Floating-point expression
temporaries will be stored with the size of their types. The resulting
code will be faster.
|