Date: Thu, 1 Mar 2001 10:54:14 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: "Mr. Veli Suorsa" cc: Djgpp AT delorie DOT com Subject: Re: Fortran / C compiler precision and code pack In-Reply-To: <3a9dc591.6468.0@surfeu.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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 On Thu, 1 Mar 2001, Mr. Veli Suorsa wrote: > PRINT *, 'Gross pay : ', GROSS > PRINT *, 'Superannuation : ', SUPER > PRINT *, 'Tax : ', TAX > PRINT *, 'Insurance : ', 14.4 > PRINT *, ' ' > PRINT *, 'Nett pay : ', NETTPAY > STOP > END > --- > > Compiler seems to work correctly, but... > > When you give 1600 > to gross pay, print is: > > Gross pay : 1600 > Superannuation : 96. > Tax : 376. > Insurance : 14.3999996 > > Nett pay : 1113.59998 > > Did I everything right, because insurance (real) was different from 14.4? If your problem is with 14.399996 being printed instead of 14.4, that's normal: REAL variables only have about 6.5 digits of precision. Try using DOUBLE PRECISION instead. > P.S. Does Gnu Pascal compiler exist and is there any user online for a little > sort test? There's a GNU Pascal compiler on the usual DJGPP sites; look for v2gnu/gpc20bb.zip.