home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BDSC / BDSC-1 / FLTSUM.C < prev    next >
Text File  |  2000-06-30  |  768b  |  31 lines

  1.  
  2. /* 
  3.     This program is a simple example of how to use
  4.     Bob Mathias's floating point package.
  5.     After compiling this and the FLOAT.C library, link by saying:
  6.  
  7.     A>clink floatsum -f float <cr>
  8.  
  9.     Note: the "printf" function resulting from this linkage
  10.     will support the "e" and "f" floating point conversion
  11.     characters, but the regular "printf" would not. The reason:
  12.     the special version of "_spr" in the FLOAT.C source file
  13.     is loaded before the library version of "_spr", and
  14.     thus supports the extra features.
  15. */
  16.  
  17. main()
  18. {
  19.     char s1[5], s2[5];
  20.     char string[30];
  21.     char sb[30];
  22.     int i;
  23.     atof(s1,"0");
  24.     while (1) {
  25.         printf("sum = %10.6f\n",s1);
  26.         printf("\nEnter a floating number: ");
  27.         fpadd(s1,s1,atof(s2,gets(string)));
  28.     }
  29. }
  30.  
  31.