PCSX2 Documentation/Nightmare on Floating-Point Street: Difference between revisions
PCSX2 Documentation/Nightmare on Floating-Point Street (view source)
Revision as of 23:47, 8 January 2015
, 8 January 2015no edit summary
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
In the end Pcsx2 does all its floating-point operations with SSE since it is easier to cache the registers. Two different rounding modes are used for the FPU and VUs. Whenever a divide or rsqrt occur on the FPU, overflow is checked. Overflow is checked much more frequently with the VUs. The fact that VUs handle both integer and floating-point data in the same SSE register makes the checking a little longer. In the future, Pcsx2 will read the rounding mode and overflow settings from the patch files. This is so that all games can be accommodated with the best/fastest settings. | In the end Pcsx2 does all its floating-point operations with SSE since it is easier to cache the registers. Two different rounding modes are used for the FPU and VUs. Whenever a divide or rsqrt occur on the FPU, overflow is checked. Overflow is checked much more frequently with the VUs. The fact that VUs handle both integer and floating-point data in the same SSE register makes the checking a little longer. In the future, Pcsx2 will read the rounding mode and overflow settings from the patch files. This is so that all games can be accommodated with the best/fastest settings. | ||
Moral of the blog When comparing two floating point numbers a and b, never use a == b. Instead use something along the lines of | '''Moral of the blog''' | ||
When comparing two floating point numbers a and b, never use <code>a == b</code>. Instead use something along the lines of <code>fabs(a-b)< epsilon</code> | |||
fabs(a-b) < epsilon | |||
where epsilon is some very small number. | where epsilon is some very small number. |