views:

130

answers:

1

What determines the default setting of the x87 FPU control word -- specifically, the precision control field? Does the compiler set it based on the target processor? Is there a compiler option to change it?

Using Microsoft Visual C++ 2008 Express Edition on an Intel Core Duo processor, the default setting for the precision control field is "01b", meaning double (53 bit) precision. I'm wondering -- why is the default not "11"b, or extended (64 bit) precision?

(I know I can change it using _controlfp.)

A: 

From a theoretical standpoint: probably the last thing that used it, or barring that, whatever Intel decided would be a good default.

From a practical standpoint: just set it to your desired precision before you begin work. Explicit defaults are usually better than implied defaults.

Broam
But I'm asking, if I'm the 'first thing that uses it', how did it get set to start with? Why would the default be 53 bit and not 64 bit?
Rick Regan
But you're **not** the first thing that uses it. There's probably BIOS code that's executing.
Broam
That's one thing I'm trying to find out -- where it's initialized.
Rick Regan
Since he's using Visual C++, I bet he is on Windows, which means that MS rather than Intel is responsible for the default since it should be part of the startup configuration for new processes. The BIOS was used really long ago when a Windows process starts.
erikkallen
Depends on your definition of "first" :)
Broam