home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource4 / 216_01 / calc87.doc < prev    next >
Encoding:
Text File  |  1979-12-31  |  2.3 KB  |  44 lines

  1.  
  2.     
  3.     
  4.     
  5.                       DOCUMENTATION FOR CALC87.C
  6. Dan Schechter
  7. Route 1 Box 19
  8. Amenia, North Dakota 58004
  9. (701) 967-8371
  10.  
  11.      This  is  just  a little nick-knack of a  program  that  I  threw 
  12. together  when I read in the Ecosoft documentation that their floating 
  13. point  math was implemented as a software emulation of the  8087  math 
  14. chip.  I  have  always wished that my CP/M Kaypro could be fitted  out 
  15. with  a  math chip.  Of course "software emulation"  lacks  the  speed 
  16. advantage  of a dedicated chip.  But nevertheless I was moved to write 
  17. this little "calculator" program.  It is not resident. It does not pop 
  18. up like the fancy commercial programs.  But it should give exactly the 
  19. same answers as the 8087 IF (and I stress IF) it is compiled with  the 
  20. Eco-C88,  or  some other compiler that emulates the 8087.  (Or if  you 
  21. actually have an 8087, of course!).
  22.      This program works more or less like a very cheap calculator.  It 
  23. has addition,  subtraction,  multiplication, and division. It has sin, 
  24. cos, tan, arcsin, arccos, arctan. It will do squares and square roots. 
  25. It  will  take reciprocals.  It will raise one number to the power  of 
  26. another. And it has ten memories.
  27.      It does not recognize parentheses.  You must do your calculations 
  28. one at a time.  However you can use the memories to hold  intermediate 
  29. results.
  30.      To  find  roots  (other  than  square  root,  which  is  directly 
  31. supported) use the reciprocal. Example:
  32.      To find the 35th root of 987, first take the reciprocal of 35 and 
  33. put  it  in  a  memory.  Then raise 987 to the power  of  that  stored 
  34. reciprocal. This works with fractional numbers as well.
  35.      It  should be simple to extend this program to  include  whatever 
  36. functions you find useful or interesting.
  37.      This  program  is  not  intended to be anything  but  a  toy.  Do 
  38. whatever you like with it.
  39.      Please note that it distinguishes between upper and lower case on 
  40. the inputs.
  41.      With  minor  changes it compiles and runs under Aztec  C  II  for 
  42. CP/M. (Though it then does not give the same accuracy.)
  43. oy.  Do 
  44. whatever you like with it.