From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11186 invoked by alias); 11 Sep 2006 19:19:48 -0000 Received: (qmail 11103 invoked by alias); 11 Sep 2006 19:19:41 -0000 Date: Mon, 11 Sep 2006 19:19:00 -0000 Message-ID: <20060911191941.11102.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/28276] EXPONENT() broken for real constants In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sgk at troutmask dot apl dot washington dot edu" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg00909.txt.bz2 List-Id: ------- Comment #6 from sgk at troutmask dot apl dot washington dot edu 2006-09-11 19:19 ------- Subject: Re: EXPONENT() broken for real constants On Sun, Sep 10, 2006 at 10:43:21PM -0000, tobias dot burnus at physik dot fu-berlin dot de wrote: > > Comment #5 from tobias dot burnus at physik dot fu-berlin dot de 2006-09-10 22:43 ------- > > Can you try this patch? It required MPFR 2.2.0. > Tested on openSUSE/AMD64 with current gfortran trunk + patch and mpfr-2.2.0-9. > > It works ok with kind = 4 and kind = 8. However, with kind = 10 I get a > NaN for > print *, scale (fraction (a), exponent (a)) / a > > My test case: > ---------------- > integer, parameter :: k = 10 > real(k), parameter :: one = 1.0_k > real(k) :: a > a = one > print *, "This ratio should be 1:" > print *, scale (fraction (a), exponent (a)) / a > end > > gfortran is calling the wrong libm function. -fdump-tree-original on FreeBSD shows { real10 D.1254; D.1254 = scalbn(_gfortran_fraction_r10(a10),_gfortran_exponent_r10(a10))/a10; _gfortran_transfer_real (&dt_parm.2, &D.1254, 10); } That should be scalbnl(). I'll see if I can track down the bug. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28276