This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: floating point precision on gcc-4 differs using variables orarrays


Hi Asfand,

#1:  C does a lot of its calculations in double, or long double (depending on platform).

#2:  Intermediate results are often in long double.

#3:  Consider carefully if you should be using float, double, long double, integer or fixed point for your purposes.  The floating point numbers are finite precision.

If you are concerned about twiddly floating point number differences (which, otherwise, are to be EXPECTED)....

#4: Use -msoft-float to avoid twitchy hardware differences.  (I'm not sure if this is 100% IEEE 754 compliant; check the documentation.)  This will affect performance adversely.

Also...

As I recall, in the old days (pre-GCC 4.0), for many operations you'd have to explicitly use SSE instructions.  Still required the SSE flag to be explicitly given.  Hence, I believe Brian Budge's comments are valid and shouldn't be discounted out of hand.

#5: GCC 4.x has not been released yet.  Use with caveats.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]