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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail From: Waldek Hebisch Newsgroups: comp.lang.ada Subject: Re: getting same output as gfortran, long_float Date: Fri, 1 May 2015 15:39:27 +0000 (UTC) Organization: Politechnika Wroclawska Message-ID: References: NNTP-Posting-Host: hera.math.uni.wroc.pl X-Trace: z-news2.pwr.wroc.pl 1430494767 10833 156.17.86.1 (1 May 2015 15:39:27 GMT) X-Complaints-To: abuse@news.pwr.wroc.pl NNTP-Posting-Date: Fri, 1 May 2015 15:39:27 +0000 (UTC) Cancel-Lock: sha1:pfLwEJhbYsBdpGkL3I6Fs2IdDaM= User-Agent: tin/2.1.1-20120623 ("Mulindry") (UNIX) (Linux/3.10.61 (x86_64)) Xref: number.nntp.giganews.com comp.lang.ada:192994 Date: 2015-05-01T15:39:27+00:00 List-Id: Nasser M. Abbasi wrote: > > Thanks, this is very useful. I noticed small difference in output: > side-by-side: > > Ada: 0.00182898948331047096479195244627343392775491540.. > Mathematica*: 0.00182898948331047096479195244627343392775491540.. > gfortran: 0.00182898948331047112025871115292829927 > > at digit 18, gfortran result is different. But your Ada rational > package gives same result as Mathematica. This tells me your > result is the accurate one ! Your previous gfortran result was: 1.82898948331047096479195244627343369E-3 which agrees with others... > humm....I do not know why these are different. I would have expected > gfortran to be accurate for at least 34 digits, not just 18. May be > I am doing something wrong in gfortran. Here is the gfortran again > for reference: > > ------------------- > PROGRAM foo > IMPLICIT NONE > REAL(KIND = 16) :: x !-- kind=16 tells it is double quad > x = 12.0D0 * 0.0001D0/(1.0D0 * (1.0D0 - 0.1D0)**4 ) > PRINT *, x > END PROGRAM AFAICS you have 34 digit x, but 17 digit constants. So it seems that you assign 17 digit number to x, no wonder there is no gain in accuracy. -- Waldek Hebisch hebisch@antispam.math.uni.wroc.pl