This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: double precision problem
- To: Philippe Després <p0663835 at magellan dot umontreal dot ca>, gcc-help at gcc dot gnu dot org
- Subject: Re: double precision problem
- From: Curtis R Anderson <gleepy at intelligencia dot com>
- Date: Tue, 08 May 2001 00:22:22 -0400
- Organization: Gleepy's Chaotic Henhouse
- References: <3AF72316.933EC66F@magellan.umontreal.ca>
Philippe Després wrote:
>
> Hello,
>
> I am working on a nonlinear dynamics project and I recently pass from
> visual C++ on Windows to gcc on linux (x86). I need finite precision on
> double representation, and I can't have it with gcc . Example:
>
> double x=cos(0.2); (16 digits)
> printf("%20.20f",x) on windows gives
> x=0.98006657784124163000;
> while on linux, the last 3 digits are non-zero. How do I tell the
> compiler to force those 3 digits to be 0?? I have tried --ffloat-store
> option without positive results.
I think, at 17 digits, you reached the limit of the precision of the
double type with x86.
The long double type may be more helpful if you need more digits. Also,
careful considerations to arithmetic calculations need to be made.
--
Curtis R. Anderson, Co-creator of "Gleepy the Hen", SP 2.5?, KoX
Vacuum a cat today! (The rest of this space is reserved.)
http://www.madbbs.com/~gleepy/ ICQ: 50137888
mailto:gleepy@intelligencia.com UTM: PS 7036 7315, zone 17