Re: calculation accuracy



glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx> wrote:

DOUBLE PRECISION PI_D
PI_D = 3.1415927D0

You would get A
a lot closer to zero if P_D was closer to pi.

Yes. It seems sort of pointless to declare pi_d as double precision and
also properly specify the literal as double precision, but then give
only 8 digits of it. It isn't as though the compiler is going to be able
to guess "oh, that's close to pi, and the variable name has pi in it, so
maybe I should use a more accurate value of pi instead of the one
specified).

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: Why is OO Popular?
    ... >>Logic programming is closer to the way humans ought to think than OO. ... every time a new app. ... I don't know how to write words to declare ...
    (comp.object)
  • Re: Problem in Float Arithmetic
    ... and the meaning of "precision". ... It won't merely have more digits (precision), ... result will be closer to the mathematical result. ...
    (microsoft.public.vc.mfc)
  • Re: CMap of CString to CString
    ... I declare the object of 'CMap' so it is as closer to ... You can use the pre-made class CMapStringToString instead of creating your ...
    (microsoft.public.vc.mfc)
  • Re: calculation accuracy
    ... in fortran is quite a bit different than what I get in excel. ... DOUBLE PRECISION PI_D ... and is padded with zeros on conversion ... a lot closer to zero if P_D was closer to pi. ...
    (comp.lang.fortran)
  • Re: Pascal to Java questions
    ... You can get more precision in the offset from 1 than ... According to the API documentation, "log1pis much closer to the true ...
    (comp.lang.java.programmer)