home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / bsd / 11084 < prev    next >
Encoding:
Text File  |  1993-01-09  |  1.6 KB  |  57 lines

  1. Xref: sparky comp.unix.bsd:11084 fj.os.386bsd:248
  2. Path: sparky!uunet!ccut!news.u-tokyo.ac.jp!yayoi!tansei1!mhiroshi
  3. From: mhiroshi@tansei.cc.u-tokyo.ac.jp (H. Murakami)
  4. Newsgroups: comp.unix.bsd,fj.os.386bsd
  5. Subject: A potential danger bug with vfprintf in 386bsd.
  6. Message-ID: <3860@tansei1.tansei.cc.u-tokyo.ac.jp>
  7. Date: 10 Jan 93 01:28:28 GMT
  8. Sender: news@tansei.cc.u-tokyo.ac.jp
  9. Followup-To: comp.unix.bsd
  10. Organization: Hokkaido Univ. However I am subject to tansei for JUNET.
  11. Lines: 44
  12.  
  13. To: comp.unix.bsd
  14. Subject: A potential danger bug with vfprintf in 386bsd.
  15.  
  16.  
  17. % cat a.c
  18. /*
  19.  *  There is potential danger of vfprintf rountine
  20.  *  used in 386bsd.
  21.  *
  22.  *  This is somewhat extraordinal code, since
  23.  *  the format  %50.40le  or like are rather cray 
  24.  *  man's request. However the system  shouldn't 
  25.  *  put the wrong result without error, 
  26.  *  since most computation is carried out 
  27.  *  in the black box manner.
  28.  *  PS. How this could be fixed gracefully?
  29.  */
  30.  
  31. main()
  32. {
  33.     double x = 1e10;
  34.  
  35.     printf("%50.37le\n", x);
  36.     printf("%50.38le\n", x);
  37.     printf("%50.39le\n", x);
  38.     printf("%50.40le\n", x);
  39.     printf("%50.41le\n", x);
  40.     printf("%50.42le\n", x);
  41.     printf("%50.43le\n", x);
  42.  
  43. }
  44.  
  45.  
  46. % gcc a.c
  47. % a.out
  48.        1.0000000000000000000000000000000000000e+10
  49.       1.00000000000000000000000000000000000000e+10
  50.      1.000000000000000000000000000000000000000e+10
  51.     1.000000000000000000000000000000000000000e+100   <<< LOOK  !
  52.    1.000000000000000000000000000000000000000e+1000   <<< LOOK  !
  53.   1.000000000000000000000000000000000000000e+10000   <<< LOOK  !
  54.  1.000000000000000000000000000000000000000e+100000   <<< LOOK  !
  55. %
  56. %
  57.