home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!srhqla!quest!kdq
- From: kdq@quest.UUCP (Kevin D. Quitt)
- Newsgroups: comp.lang.c
- Subject: Re: WHAT WENT WRONG?
- Message-ID: <D9NyVB1w165w@quest.UUCP>
- Date: Thu, 17 Dec 92 20:41:48 PST
- References: <1992Dec17.113200.4561@email.tuwien.ac.at>
- Reply-To: srhqla!quest!kdq
- Organization: Job quest (805) 251-8210, So Cal: (800) 400-8210
- Lines: 27
-
- alex@mips.complang.tuwien.ac.at (Alexander Forst) writes:
-
- >In article <10441.107.uupcb@cutting.hou.tx.us>, david.brooks@cutting.hou.tx.u
- >main()
- >{
- >double x, y;
- >
- > printf("\nEnter number to factorialize:");
- > scanf("%lf", &x);
- > ^^------------------------ you want to input a double value
- >
- > for(y=x-1;y>1;y--) x*=y;
- >
- > printf("\nFactorial= %lf\n", x);
- > ^^---------- and printf a double value
-
- ^----- Completely unnecessary (the 'l').
-
- All floating point values passed to any variadic function are
- passed as doubles (via promotion as necessary); therefore printf always
- has and always will "automatically recognize" the double. In fact, all
- the libraries I've seen that use IEEE floating-point also automatically
- recognize the long double.
-
-
- _
- Kevin D. Quitt 96.37% of all statistics are made up. srhqla!quest!kdq
-