home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / programm / 2061 < prev    next >
Encoding:
Text File  |  1992-07-22  |  1.5 KB  |  34 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uunet.ca!canrem!telly!druid!darcy
  3. From: darcy@druid.uucp (D'Arcy J.M. Cain)
  4. Subject: Re: floating point routines with double precision
  5. Message-ID: <1992Jul22.120724.3466@druid.uucp>
  6. Date: Wed, 22 Jul 1992 12:07:24 GMT
  7. References: <2A65BFF1.14443@noiro.acs.uci.edu> <54561@mentor.cc.purdue.edu>
  8. Organization: D'Arcy Cain Consulting
  9. Lines: 23
  10.  
  11. hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  12. >Use assembler for you particular machine if you want any speed.  Even 
  13. >setting it up for the compiler will be a major headache, and you will
  14. >have just as many problems with object size.
  15.  
  16. Here is how I set up my compiler to generate machine code for a floating
  17. point operation:
  18.  
  19.     result = value/4.586;    /* Well it does   :-) */
  20.  
  21. Seriously, there may be cases where the compiler doesn't give the fastest
  22. code for a given operation but they are probably the rare exception.  With
  23. modern compilers the chances are that hand coded assembly won't be as fast
  24. and are certainly longer to program.  A much better method of speeding up
  25. critical sections of code is inlining.  That's why the current Gnu compiler
  26. internally inlines some of the more common string functions.  Function
  27. call overhead is still relatively expensive on most popular CPUs.
  28.  
  29. -- 
  30. D'Arcy J.M. Cain (darcy@druid)     |
  31. D'Arcy Cain Consulting             |   There's no government
  32. Toronto, Ontario, Canada           |   like no government!
  33. +1 416 424 2871          DoD#0082  |
  34.