long double

ふむ、gcc 3.3.4 と 3.4.1 では sizeof だと 12Byte(96bit)になっている。(x86
atan(1.0)*4.
atan(1.0L)*4.Lの結果 gcc-3.4.1
3.141592653589793 115997963468544185161590576171875
3.141592653589793238 51280895940618620443274267017841339111328125
3.141592653589793238462643383279502884197169399375105820974944592...
http://ja.wikipedia.org/wiki/%E5%86%86%E5%91%A8%E7%8E%87
3桁ほど精度が上っている。(四捨五入を考えると4桁ほどと見てもよいか?)

-m128bit-long-double つうオプションを使うと128bitになります。

3.14159265358979323851280895940618620443274267017841339111328125
3.141592653589793238462643383279502884197169399375105820974944592...
計算結果が変らないのはなぜ? x86-64でないと無理なのかなぁ?


-m96bit-long-double
-m128bit-long-double
These switches control the size of long double type. The i386 application binary interface specifies the size to be 96 bits, so -m96bit-long-double is the default in 32 bit mode.

Modern architectures (Pentium and newer) would prefer long double to be aligned to an 8 or 16 byte boundary. In arrays or structures conforming to the ABI, this would not be possible. So specifying a -m128bit-long-double will align long double to a 16 byte boundary by padding the long double with an additional 32 bit zero.

In the x86-64 compiler, -m128bit-long-double is the default choice as its ABI specifies that long double is to be aligned on 16 byte boundary.

Notice that neither of these options enable any extra precision over the x87 standard of 80 bits for a long double.

Warning: if you override the default value for your target ABI, the structures and arrays containing long double variables will change their size as well as function calling convention for function taking long double will be modified. Hence they will not be binary compatible with arrays or structures in code compiled without that switch.

x87 は80bitしか精度がないのかよ。 x86-64(AMD64)はより高精度な計算ができるユニットを持ってるみたい。