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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: getting same output as gfortran, long_float Date: Fri, 01 May 2015 13:55:51 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 1 May 2015 11:54:48 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="f798c1c424521447674c0bc7e623410b"; logging-data="11536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gP51kTOAfXSX6Xs7CzYNnsE521xmkn3E=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: Cancel-Lock: sha1:jYNaxrAu3RY144afD4s4G3blNKs= Xref: news.eternal-september.org comp.lang.ada:25686 Date: 2015-05-01T13:55:51+02:00 List-Id: On 30.04.15 23:17, Nasser M. Abbasi wrote: > > How to obtain the last result above in Ada? One option seems to be to use GNAT.SSE as a base, and then overload operators "*" and the like. This should be good for computations, not sure about I/O. The package SSE defines a type m128 providing for SSE operations. I don't know what the Fortran part of GCC does that the Ada part couldn't also do, but maybe it's a matter of supply and demand, supply following demand. As the work seems to have been done for the Fortran part of GCC, wishful thinking might conclude that adapting the work to the Ada part's requirements is a reasonably inexpensive proposition, who knows? Arbitrary precision might seem another option: http://web.am.qub.ac.uk/users/j.parker/miscellany/arbitrary/README.arbitrary The representations chosen by GNAT is seen when passing the switch -gnatRN to the compiler. For example: $ gnatmake -gnatwa -gnatR2 foof8.adb gcc -c -gnatwa -gnatR3 foof8.adb Representation information for unit Foof8 (body) ------------------------------------------------ for Real'Size use 64; for Real'Alignment use 8; for X'Size use 64; for X'Alignment use 8; gnatbind -x foof8.ali gnatlink foof8.ali Compilation finished at Fri May 1 13:50:13 Where procedure Foof8 is Byte : constant := 8; type Real is new Long_Float; for Real'Size use 8 * Byte; -- Dmitry hinted at this: -- "If -fdefault-real-8 is given, DOUBLE PRECISION would instead -- be promoted to 16 bytes if possible". -- type Double_Precision is digits Natural(112.0 * 0.3) -- with -- Size => 16 * Byte; X : Real; begin X := 0.0; if X /= X then X := 1.0; end if; end Foof8;