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: Int cast / floating point isuses


joe <jhughesjr@comcast.net> writes:

> I guess in my situation, even if the 80 bit extended precision registers 
> are supposed to be more accurate/precise overall, the accuracy/precision 
> is not as important to me than having a number print out the same 
> regardless of the platform it is running on, which really is my main goal.

Yes, getting the standard IEEE behavior for comparing results across
platforms is really useful.  On x86 systems it is possible to put the
processor into the standard IEEE double precision mode by setting the
floating point control word.

For GNU/Linux the header file /usr/include/fpu_control.h has macros
_FPU_GETCW and _FPU_SETCW for changing the settings.  These macros are
internal (I haven't seen a documented interface to them) but you can
see how they work there anyway -- it is one line of inline assembly.

If you look in the IEEE chapter of the GNU Scientific Library
Reference Manual (http://www.gnu.org/software/gsl/) there is some
discussion about this and a function which allows you to set all the
parameters of the fpu mode from an enviroment variable.

-- 
Brian Gough

Network Theory Ltd,
Publishing "An Introduction to GCC" --- http://www.network-theory.co.uk/


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