home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / c / 18589 < prev    next >
Encoding:
Internet Message Format  |  1992-12-20  |  1.2 KB

  1. Path: sparky!uunet!usc!srhqla!quest!kdq
  2. From: kdq@quest.UUCP (Kevin D. Quitt)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: WHAT WENT WRONG?
  5. Message-ID: <D9NyVB1w165w@quest.UUCP>
  6. Date: Thu, 17 Dec 92 20:41:48 PST
  7. References: <1992Dec17.113200.4561@email.tuwien.ac.at>
  8. Reply-To: srhqla!quest!kdq
  9. Organization: Job quest  (805) 251-8210,  So Cal: (800) 400-8210
  10. Lines: 27
  11.  
  12. alex@mips.complang.tuwien.ac.at (Alexander Forst) writes:
  13.  
  14. >In article <10441.107.uupcb@cutting.hou.tx.us>, david.brooks@cutting.hou.tx.u
  15. >main()
  16. >{
  17. >double x, y;
  18. >     printf("\nEnter number to factorialize:");
  19. >     scanf("%lf", &x);
  20. >             ^^------------------------ you want to input a double value
  21. >     for(y=x-1;y>1;y--) x*=y;
  22. >     printf("\nFactorial= %lf\n", x);
  23. >                           ^^---------- and printf a double value
  24.  
  25.                 ^----- Completely unnecessary (the 'l').
  26.  
  27.     All floating point values passed to any variadic function are
  28. passed as doubles (via promotion as necessary); therefore printf always
  29. has and always will "automatically recognize" the double.  In fact, all
  30. the libraries I've seen that use IEEE floating-point also automatically
  31. recognize the long double.
  32.  
  33.  
  34.  _
  35. Kevin D. Quitt      96.37% of all statistics are made up.     srhqla!quest!kdq
  36.