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

  1. Path: sparky!uunet!mcsun!sun4nl!cwi.nl!dik
  2. From: dik@cwi.nl (Dik T. Winter)
  3. Newsgroups: comp.programming
  4. Subject: Re: floating point routines with double precision
  5. Message-ID: <6778@charon.cwi.nl>
  6. Date: 25 Jul 92 01:55:32 GMT
  7. References: <54944@mentor.cc.purdue.edu> <6760@charon.cwi.nl> <55036@mentor.cc.purdue.edu>
  8. Sender: news@cwi.nl
  9. Organization: CWI, Amsterdam
  10. Lines: 59
  11.  
  12. In article <55036@mentor.cc.purdue.edu> hrubin@pop.stat.purdue.edu (Herman Rubin) writes:
  13.  > In article <6760@charon.cwi.nl> dik@cwi.nl (Dik T. Winter) writes:
  14.  > >                                                       He may have done
  15.  > >a poor job of course (as some code sequences for the 205 show, but that one
  16.  > >had an extremely bad Fortran compiler; past tense because the one I used
  17.  > >has been decommissioned more than a year ago).
  18.  > 
  19.  > The 205 is much easier for the purpose of increasing precision because
  20.  > the floating-point arithmetic is not forced to be normalized.
  21. True to a point.  First: single precision is inexact.  I.e. if you have two
  22. machine numbers a and b and an operation o, such that 'a o b' is a machine
  23. number, the 205 does not always deliver that machine number.  The reason
  24. is that when the machine delivers a normalized number, the number is first
  25. truncated and normalized afterwards; shades of the 6600.
  26. And why is it that when a is a double precision number it is not guaranteed
  27. that '(a * 2.0) * 0.5 = a' even if there is no intermediate overflow?
  28. The forcing or not forcing of normalization has nothing to do with the ease
  29. of extending precision.  The basic requirement is that intermediate operations
  30. give an exact result if possible.  Of course, the unnormalized arithmetic
  31. of the 205 gives exact results, but that means that you can go to higher
  32. precision only through those unnormalized arithmetic operations.  If the
  33. normalized arithmetic operations would be exact you could go through them
  34. as well.
  35.  >                                                                The Crays
  36.  > are much worse here, although they are not forced normalized for 
  37.  > multiplication, but because only the most significant part of the
  38.  > product can be obtained.
  39. True, but forced normalization has nothing to do with it.  Consider the
  40. following routine in some pseudo language (Algol-60):
  41.         "procedure" addexact(a, b, c, cc); "value" a, b;
  42.         "real" a, b, c, cc;
  43.         "begin"
  44.             c:= a + b;
  45.             cc:= "if" a >= b" "then" c - a - b "else" c - b - a
  46.         "end" addexact;
  47. This will give you in the pair (c,cc) under some conditions the exact sum
  48. of a and b.  This can again be used to create double precision addition
  49. and subtraction.  IEEE and Cray fall under the conditions, 205 does not.
  50. (BTW, the example comes from an article by T.J.Dekker from an issue of CACM
  51. of 1966 or thereabouts, where he shows Algol-60 routines that will do
  52. double precision operations.)
  53.  > 
  54.  > If we want everything to be in the compiler, the compiler will be very
  55.  > large indeed.  One of the points I wish to stress is that, no matter
  56.  > how much is put in the compiler, much more, even from the standpoint
  57.  > of practicality, will be omitted.  And as knowledge progresses, the
  58.  > variety of things to consider increases.
  59.  > 
  60.  > With the present languages, it is already necessary to consider 
  61.  > alternate codings to achieve the same purpose for such simple
  62.  > things as adding two vectors.
  63. But, if I understand you right you want to make the languages larger, which
  64. in turn makes the compilers larger to which you object in the paragraph
  65. above.  What is it.  Larger languages with larger compilers?  Or smaller
  66. languages with smaller compilers?
  67. -- 
  68. dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
  69. home: bovenover 215, 1025 jn  amsterdam, nederland
  70. dik@cwi.nl
  71.