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!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: getting same output as gfortran, long_float Date: Fri, 01 May 2015 13:03:45 -0500 Organization: Aioe.org NNTP Server Message-ID: References: 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: news.eternal-september.org comp.lang.ada:25690 Date: 2015-05-01T13:03:45-05:00 List-Id: On 5/1/2015 12:27 PM, Nasser M. Abbasi wrote: > > Thanks. My mistake. So the command line flag was needed after all!! > >> gfortran -Wall -fdefault-real-8 foo2.f90 >> ./a.out > 1.82898948331047096479195244627343369E-0003 > > Without the flag, the digit is different > >> gfortran -Wall foo2.f90 >> ./a.out > 1.82898948331047112025871115292829927E-0003 > ... > I thought with -Wall it will catch all these things, but I think > I need more flags to detect this user error > Just for completion, there is a flag that checks for this user error: ---------------------------- >gfortran -Wall -Wconversion -Wconversion-extra foo2.f90 foo2.f90:6.4: x = 12.0D0 * 0.0001D0/(1.0D0 * (1.0D0 - 0.1D0)**4 ) 1 Warning: Conversion from REAL(8) to REAL(16) at (1) ------------------------------- While this gives clean compile: gfortran -Wall -Wconversion -Wconversion-extra -fdefault-real-8 foo2.f90 So, Fortran can be made to be "stroger typed", but it I think it takes more effort than with Ada, which would have detected such implicit conversions at the language semantics level without the need of a compiler switches. --Nasser