News for hackers. Stuff that matters.
Re:Quake 2 Source Code Review by 0x0 on Tuesday September 20, 2011 @05:07PM (#3019575)
I noticed this comment in the "notes.html":

  // Set the floating point precision ...
  _controlfp                           
  // Question: Why do that for every frames ? Probably because precision is altered during the loop execution.
  // Answer: The is no other call to this function. It appears that floating point precision remains the same during program execution.
I seem to vaguely recall reading something about some versions of Windows not preserving the FPU state across task switches. Could it be that this call to configure the FPU for every frame is a workaround for that?
Re:Quake 2 Source Code Review by apaprocki on Tuesday September 20, 2011 @06:14PM (#3019835)
http://gafferongames.com/networking-for-game-programmers/flo...

Search for _controlfp.. seems some MS API calls could change it.

Re:Quake 2 Source Code Review by daemin on Tuesday September 20, 2011 @08:47PM (#3020264)
I've also experienced Windows / DirectX API's use MMX, hence the floating point code I was using (x87 FPU) required a femms instruction before it to change back from MMX state.

This just goes to show that if you need a particular state on a processor (CPU, FPU, GFX, etc) you need to set it explicitly before use.

Re:Quake 2 Source Code Review by AshleysBrain on Tuesday September 20, 2011 @05:49PM (#3019754)
Maybe it's because the calls to functions in DLLs could, in theory, change it?
Re:Quake 2 Source Code Review by cdavid on Wednesday September 21, 2011 @08:21AM (#3021672)
You may mix up with linux (which does not save the FPU state: that's why you can't use most floating point operations in the kernel).