X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Date: Thu, 30 Oct 2003 08:25:52 -0500 Message-Id: <200310301325.h9UDPqVF020025@envy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: (message from =?iso-8859-15?Q?Rafael_Garc=EDa?= on Thu, 30 Oct 2003 14:07:52 +0100) Subject: Re: double with only 13 digit precision? References: Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk In this case, the problem is that the two numbers you are subtracting only have a certain precision *after the decimal*. The result has the same number of digits after the decimal as the numbers you start with. Garbage in, garbage out - try printing them like this: printf("%25.18f\n%25.18f\n%25.18f\n",a,b,c); You'll see: 4777.909999999999854481 4782.979999999999563443 -5.069999999999708962 Note that the 9's all end in the same column.