From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,47fc49812a5e8e38 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: small example, using complex variables in Ada Date: Thu, 10 Jun 2010 11:12:10 +0200 Organization: Adalog Message-ID: References: <82ljannyeq.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 10 Jun 2010 09:12:17 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="Dn22F68J9CHYFQQlT81DGA"; logging-data="2278"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+PE1bQu0k21GEAFL3YFs6k" User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) In-Reply-To: <82ljannyeq.fsf@stephe-leake.org> Cancel-Lock: sha1:8G3KOqZ1aBCNPV+1L1FNRRMdIRM= Xref: g2news2.google.com comp.lang.ada:12539 Date: 2010-06-10T11:12:10+02:00 List-Id: Stephen Leake a �crit : >> -- gnatmake dft.adb >> -- >> -- ./dft.exe >> -- ( 6.00000E+00, 0.00000E+00) >> -- (-1.50000E+00, 8.66026E-01) >> -- (-1.50000E+00,-8.66025E-01) >> -- $ >> >> ======= FORTRAN code =========== >> ! dtf.f90, compiled with GCC 4.3.4 >> ! under CYGWIN 1.7.5 >> ! gfortran -Wall dft.f90 >> ! ./a.exe >> ! ( 6.0000000 , 0.0000000 ) >> ! ( -1.4999999 , 0.86602557 ) >> ! ( -1.5000005 ,-0.86602497 ) >> ! > > It would be good to explain the small differences here; something about > how the floating point options are set, I suspect. In Ada, the value is rounded to the requested accuracy (A.10.9(25)). In Fortran, the machine value is printed. > It would be good to state the theoretically correct answer; I hope it's > 1.5, not 1.499... :). Note that they are mathematically equal (with an inifinite number of 9s) -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr