From: Radical NetSurfer Newsgroups: comp.os.msdos.djgpp Subject: modf BROKEN ?? Date: Mon, 31 Jul 2000 22:37:40 -0400 Message-ID: X-Newsreader: Forte Agent 1.8/32.548 X-No-Archive: yes MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.202.134.188 X-Original-NNTP-Posting-Host: 216.202.134.188 X-Trace: 31 Jul 2000 22:40:23 -0400, 216.202.134.188 Lines: 36 X-Original-NNTP-Posting-Host: 64.31.79.51 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Why does the following program INCORRECTLY display the fractional part? #include #include #include #include #include #include int main(int argc, char **argv) { double i, f; double v, y; printf("Observe the \"Rounded\" Value of Fint below:\n"); printf("Use ESC to exit.\n\n"); for(v=0.0; v< 10; v+=0.1) { f = modf(v, &i); // fractional = modf(argument, &integral); if ( f <0.5 ) y = floor(v); else y = ceil(v); printf("Value: %lf Fint: %lf Int: %lf Frac: %lf\n", v, y, i, f ); if ( getch() == 27 ) break; } return (0); } //main ------------------------------------------------------------------------------------------------------ well? Email always welcomed: radsmail AT juno DOT com http://members.tripod.com/~RadSurfer/