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: a07f3367d7,47fc49812a5e8e38 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: small example, using complex variables in Ada Date: Thu, 10 Jun 2010 21:12:23 +0100 Organization: A noiseless patient Spider Message-ID: References: <82ljannyeq.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Thu, 10 Jun 2010 20:12:24 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="KCXegvZb5vh43D+f3BR6Ew"; logging-data="14214"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ScVkxu6fDC2CGg27MJw4qCSYghxX98wM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (darwin) Cancel-Lock: sha1:qQeToyiWIchmBe1qrsuJ+8gHfNs= sha1:cdG2vfAYFhjmNE5fgwq44q978+k= Xref: g2news1.google.com comp.lang.ada:11613 Date: 2010-06-10T21:12:23+01:00 List-Id: "Nasser M. Abbasi" writes: > On 6/10/2010 12:23 AM, Stephen Leake wrote: > >> >>> -- 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. >> > > Yes, I noticed that too. Need to look more into. It could be just a > formating thing. I just used Print*, in Fortran becuase at the time > was too lazy to lookin up the other formating functions in Fortran. In > Ada, I used the predefined Put on Complex of float types. I tried with put(X(k), Aft => 8, Exp => 0); new_line; (to match the number of digits output by the Fortran) and got ( 6.00000000, 0.00000000) (-1.49999988, 0.86602557) (-1.50000024,-0.86602497) so I think it's just a formatting thing (though that -1.50000024 looks a little off; but Float is digits 6 on this hardware - Macbook Pro, so those last 3 digits are spurious).