X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <002001c1a98f$d99f5580$19e0a0c8@rjo.virtua.com.br> From: "Pedro Izecksohn" To: Subject: Why does it is rounding the result ? Date: Wed, 30 Jan 2002 11:12:51 -0200 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_001D_01C1A97F.0EEC6A40" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 Disposition-Notification-To: "Pedro Izecksohn" X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Reply-To: djgpp AT delorie DOT com This is a multi-part message in MIME format. ------=_NextPart_000_001D_01C1A97F.0EEC6A40 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Why does the attached file when compiled rounds the result ? ------=_NextPart_000_001D_01C1A97F.0EEC6A40 Content-Type: application/octet-stream; name="pwr.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pwr.c" #include #include int pwr (const register float m, register int e) { register float temp=1; printf("%s","\nCalculating:"); for(;e;e--) { printf("%s","."); temp=temp*m; } printf("%s","\n"); printf("%f",temp); return temp; } int main (int argc,char *argv[]) { float Bn,Rn; int Pn; if (argc<3) { printf("%s","\nEnter the Double Base number: "); scanf("%f",&Bn); printf("%s","\nEnter the Unsigned Power number: "); scanf("%u",&Pn); } if (argc==3) { Bn=atof(argv[1]); Pn=atoi(argv[2]); } Rn=pwr(Bn,Pn); printf("%s","\n\nThe Result is: "); printf("%f",Rn); printf("%s","\n\a"); if ( (Bn!=0) && (Rn==0) ) { printf("%s","\nTHE RESULT IS WRONG !!!\n"); } return 0; } ------=_NextPart_000_001D_01C1A97F.0EEC6A40-- _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com