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

  1. Path: sparky!uunet!spool.mu.edu!agate!web-3c.berkeley.edu!c60b-3hu
  2. From: c60b-3hu@web-3c.berkeley.edu (Paul Hsu)
  3. Newsgroups: comp.lang.c
  4. Subject: speed?  double vs. float.  math.h??
  5. Date: 26 Dec 1992 09:17:53 GMT
  6. Organization: University of California, Berkeley
  7. Lines: 14
  8. Distribution: world
  9. Message-ID: <1hh801INNab1@agate.berkeley.edu>
  10. NNTP-Posting-Host: web-3c.berkeley.edu
  11. Originator: c60b-3hu@web-3c.berkeley.edu
  12.  
  13.  
  14.      I'm currently writing a C program where it needs to do lots and lots of
  15. trig calculations.  But I would like the program to run really really fast.
  16. So I'm concerned about the speed at which the calculations are carried out.
  17. Trying to make the program run fast, I would like to have only float 
  18. variables, instead of doubles, in my program.  But in the standard math 
  19. library, all the functions take in arguments and return values in the type 
  20. double.  So, what should I do?  First of all, should I even be concerned 
  21. about the speed difference between doing calculations in float and doing the
  22. calculations in doubles?  If yes, how should I go about in making the math 
  23. functions to accept and return floats?  Casting them won't help....  it'll 
  24. only take more time in the type conversion.  Any suggestion?
  25.  
  26. Paul.
  27.