This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [fortran,patch] Patch for PR 14394 - Precision of real type.

On Wed, Mar 10, 2004 at 12:34:48PM +0800, Feng Wang wrote:
> Hi, all
>   This patch fix PR 14394. Reported by Bud. Test case:
> cat z.f
>         REAL AVS,BVS
>         BVS = 1.5747025767
>         AVS = TAN(BVS)
>         PRINT*,AVS
>         END
>   There is one problem converting the real type from mpf to gcc tree. With
> -fdump-parse-tree we can see fortran gets the input and parse correctly.
> gfc_conv_mpf_to_tree in trans-const.c use string as the intermediate of the
> conversion. As convert mpf to string, we specify the maximum digits number of
> the real value. In my patch, I loosen the limit. 
>   I tested real and real*8 type with the patch. The real type got the same
> result with Intel's compiler. But with real*8 type, gfortran gave the result:
> -255.998704134517, compared with Intel's -255.995833263172. The difference of
> them is above 0.002. With calculator I comfirmed the gfortran's result should
> be correct. But can anyone give more comparation with other compilers. What's
> your opinion?

NAG's F95 compiler gives



        REAL   AVS, BVS
        REAL*8 AVS8,BVS8
        BVS  = 1.5747025767
        BVS8 = 1.5747025767D0
        AVS  = TAN(BVS)
        AVS8 = TAN(BVS8)

Note: NAG's compiler uses gcc as its backend.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]