home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / programm / 2089 < prev    next >
Encoding:
Internet Message Format  |  1992-07-23  |  2.1 KB

  1. Path: sparky!uunet!gatech!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  2. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  3. Newsgroups: comp.programming
  4. Subject: Re: floating point routines with double precision
  5. Message-ID: <54944@mentor.cc.purdue.edu>
  6. Date: 23 Jul 92 22:38:16 GMT
  7. References: <2A65BFF1.14443@noiro.acs.uci.edu> <54561@mentor.cc.purdue.edu> <1992Jul22.120724.3466@druid.uucp>
  8. Sender: news@mentor.cc.purdue.edu
  9. Organization: Purdue University Statistics Department
  10. Lines: 33
  11.  
  12. In article <1992Jul22.120724.3466@druid.uucp> darcy@druid.uucp (D'Arcy J.M. Cain) writes:
  13. >hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  14. >>Use assembler for you particular machine if you want any speed.  Even 
  15. >>setting it up for the compiler will be a major headache, and you will
  16. >>have just as many problems with object size.
  17.  
  18. >Here is how I set up my compiler to generate machine code for a floating
  19. >point operation:
  20.  
  21. >    result = value/4.586;    /* Well it does   :-) */
  22.  
  23. >Seriously, there may be cases where the compiler doesn't give the fastest
  24. >code for a given operation but they are probably the rare exception.  With
  25. >modern compilers the chances are that hand coded assembly won't be as fast
  26. >and are certainly longer to program.  A much better method of speeding up
  27. >critical sections of code is inlining.  That's why the current Gnu compiler
  28. >internally inlines some of the more common string functions.  Function
  29. >call overhead is still relatively expensive on most popular CPUs.
  30.  
  31. It depends on what you call double precision.  The IEEE standard
  32. double precision probably should be called single precision, and
  33. what it calls single precision should be called half precision.
  34.  
  35. Now I was answering the question assuming that more than the designed
  36. precision is needed.  The routines are not difficult for a human to
  37. design, but almost hopeless for a compiler.  Anyone who writes such
  38. a procedure for a machine which has forced normalization will curse
  39. the designers.
  40. -- 
  41. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  42. Phone: (317)494-6054
  43. hrubin@pop.stat.purdue.edu (Internet, bitnet)  
  44. {purdue,pur-ee}!pop.stat!hrubin(UUCP)
  45.