Petr Savicky wrote:
You were using -mfpmath=387 (possible as the default), and that uses
Intel native arithmetic, which is NOT standard IEEE 754 double, but
an extended format.
If you use -mfpmath=sse, you will get what you expect.
Thank you for your reply. This explains the problem.
However, solving the problem seems to be harder.
I tried "gcc -mfpmath=sse", but obtained the warning:
SSE instruction set disabled, using 387 arithmetics.
gcc version: 3.3.3
uname -m -p -i: i686 i686 i386
/proc/cpuinfo:
vendor_id : GenuineIntel
cpu family : 15
model : 2
model name : Intel(R) Xeon(TM) CPU 2.80GHz
I obtained the same on another computer with
gcc version: 4.1.0
uname -m -p -i: i686 i686 i386
/proc/cpuinfo:
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Celeron (Coppermine)
man gcc says: For the i386 compiler, you need to use -march=cpu-type, -msse or -msse2 switches
to enable SSE extensions and make this option effective.
The choices for cpu-type are the same as for -mtune.
-mtune=cpu-type has possible values itanium, itanium1, merced, itanium2, and mckinley
none of which seems to fit my computers.
With "gcc -mfpmath=sse -msse" I obtained no warning/error, but the program
behaves in the old wrong way.
So, I think that SSE is not available on my computers. Is this correct?
Why didn't you follow the advice you quoted?
gcc -march=pentium4 -mfpmath=sse
When you compile code for pentium2, of course SSE is not available to
the compiler.