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: buffer1.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: getting same output as gfortran, long_float Date: Thu, 30 Apr 2015 17:37:13 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <1kxou0nloqg9c$.1x0itzgdrlosm$.dlg@40tude.net> Reply-To: nma@12000.org NNTP-Posting-Host: CV72NQ0GT7rQd8cP1ZYi/A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.giganews.com comp.lang.ada:192977 Date: 2015-04-30T17:37:13-05:00 List-Id: On 4/30/2015 5:08 PM, Dmitry A. Kazakov wrote: > > I don't know what FORTRAN does, but assuming, you are using Intel, the > longest floating-point available there is not, as you seem assume, of 16 > bytes (quadruple-precision), but so-called extended precision, which is not > that long (10 bytes, namely). > Yes, I do not know either how gfortran does it. I am on intel, using >gfortran --version GNU Fortran (Ubuntu 4.8.2-19ubuntu1) 4.8.2 It might be linked to libquadmath? I see article on this http://glennklockwood.blogspot.com/2014/02/linux-perf-libquadmath-and-gfortrans.html "Executive Summary: libquadmath was introduced in GFortran 4.6 which fundamentally changed what the -fdefault-real-8 switch does" thanks for your input below, will look at it: > AFAIK, GNAT on x86 maps: > > Float to single precision float (4 bytes) > Long_Float to double precision float (8 bytes) > Long_Long_Float to extended precision float (10 bytes, effectively) > > You can try this program to see how many binary mantissa bits are available > for each type: > ----------------------------- > with Text_IO; use Text_IO; > procedure Test is > begin > Put_Line ("Float mantissa:" & Integer'Image (Float'Machine_Mantissa)); > Put_Line ("Long Float mantissa:" & Integer'Image > (Long_Float'Machine_Mantissa)); > Put_Line ("Long Long Float mantissa:" & Integer'Image > (Long_Long_Float'Machine_Mantissa)); > end Test; > -------------------------- > On an Intel machine it will print: > > Float mantissa: 24 > Long_Float mantissa: 53 > Long_Long_Float mantissa: 64 > > If FORTRAN supports longer floating point numbers (e.g. > quadruple-precision) then it must emulate them since Intel hardware does > not have them. That would make computations quite slow and you should > consider if you really need that many significant digits. > > If GNAT allowed floating-point emulation, you could declare a custom type > of required precision: > > type My_Float is digits 34; -- 112 * lg(2) > > Which is advisable anyway in order to make your program portable. Using > built-in types is a bad idea and poor taste in most cases. > > Since GNAT does support emulation, at least not with the standard compiler > switches, you need a library for doing this. >