From: "Mr. Veli Suorsa" Sender: vjsuorsa AT Surfeu DOT Fi To: Djgpp AT delorie DOT com Cc: VJSuorsa AT Surfeu DOT Fi Date: Thu, 1 Mar 2001 05:44:17 +0200 Subject: Fortran / C compiler precision and code pack X-Mailer: CWMail Web to Mail Gateway 2.6k, http://netwinsite.com/top_mail.htm Message-id: <3a9dc591.6468.0@surfeu.fi> X-User-Info: 193.167.106.194 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id WAA11695 Reply-To: djgpp AT delorie DOT com HI! I test Gnu Fortran compiler, g77 (g772952b : gcc-2.95.2) with a little program like this: --- PROGRAM PAY C C A program to calculate the nett pay of a British worker C (pay3_4.for) C REAL GROSS, SUPER, TAXABL, TAX, NETTPAY C Read gross pay PRINT *, 'Type gross pay before deductions :' READ *, GROSS C Superannuation is 6 % of gross pay SUPER = 0.06 * GROSS C Tax is 25 % of pay, excluding superannuation contributions TAXABL = GROSS - SUPER TAX = 0.25 * TAXABL C Fixed weekly deductions of £14.40 NETTPAY = TAXABL - TAX - 14.4 C Print details 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? Or is there a bug in Fortran / C compiler precision. Another thing, that bothers me is size of exe- code (about 150 KB and when pkzipped about 50 KB). Is there any way or switch to pack/ optimise code? P.S. Does Gnu Pascal compiler exist and is there any user online for a little sort test? Thanks in advance! Veli Suorsa --- Oulu, FINLAND Mailto:VJSuorsa AT Surfeu DOT Fi http://members.surfeu.fi/veli.suorsa/ http://www.surfeu.fi