------- 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