home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / sci / math / 11353 < prev    next >
Encoding:
Internet Message Format  |  1992-09-13  |  2.1 KB

  1. Xref: sparky sci.math:11353 comp.lang.misc:3056 comp.lang.fortran:3541 comp.std.c:2619 comp.lang.c:13611
  2. Path: sparky!uunet!gatech!purdue!mentor.cc.purdue.edu!pop.stat.purdue.edu!hrubin
  3. From: hrubin@pop.stat.purdue.edu (Herman Rubin)
  4. Newsgroups: sci.math,comp.lang.misc,comp.lang.fortran,comp.std.c,comp.lang.c
  5. Subject: Re: Scientists as Programmers (was Re: Small Language Wanted)
  6. Message-ID: <BuJ4Es.49w@mentor.cc.purdue.edu>
  7. Date: 13 Sep 92 18:23:16 GMT
  8. References: <id.I12T.GP4@ferranti.com> <a_rubin.716152347@dn66> <MEISSNER.92Sep11164441@curley.osf.org>
  9. Sender: news@mentor.cc.purdue.edu (USENET News)
  10. Organization: Purdue University Statistics Department
  11. Lines: 41
  12.  
  13. In article <MEISSNER.92Sep11164441@curley.osf.org> meissner@osf.org (Michael Meissner) writes:
  14. >In article <a_rubin.716152347@dn66> a_rubin@dsg4.dse.beckman.com
  15. >(Arthur Rubin) writes:
  16.  
  17. >| Using, instead, 
  18.  
  19. >|     c = (long)a * b;
  20.  
  21. >| it becomes a "quality of implementation" issue; and using the 4/2->2,2
  22. >| divide instruction would incorrect on 80x86 machines, as the divide
  23. >| instruction would overflow in cases where the C operations would be legal.
  24.  
  25. >With most optimizing compilers, this is pretty simple to put in, since
  26. >most optimizations are essentially pattern matching (you match the two
  27. >converts, and long multiply).  Some time ago, I put long long multiply
  28. >code into the MIPS port of GCC for instance in about 2 minutes of
  29. >time.  The code:
  30.  
  31. >    long long mul (long a, long b) { return (long long)a * b; }
  32.  
  33. >produces the following code:
  34.  
  35. >    mul:
  36. >        mult    $4,$5
  37. >        mfhi    $3
  38. >        mflo    $2
  39. >        j       $31
  40.  
  41. >You are in a twisty little passage of standards, all conflicting.
  42.  
  43. This may or may not depend on the compiler, however.  And it still is
  44. not quite adequate.  One should be able to have the option of overloading
  45. the * operator so that if c is long long, and a and b are long, this can
  46. be written as c = a * b.  
  47.  
  48. The point is that C is not the great answer, as many posters claim it is.
  49. -- 
  50. Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
  51. Phone: (317)494-6054
  52. hrubin@pop.stat.purdue.edu (Internet, bitnet)  
  53. {purdue,pur-ee}!pop.stat!hrubin(UUCP)
  54.