Re: [PATCH, fortran] PR93727 Implement new EX format specifier

Harald Anlauf <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Hi Jerry,

Am 11.05.26 um 8:24 PM schrieb Jerry D:
> Hi all,
> 
> This took me a lot longer than I wanted, but finally got it done.
> 
> See the attached patch. Since my last submittal here I started over on 
> using the example demo Harald gave in Comment 18 of the PR using 
> available higher level C functions, fabs, signbit, scalbn, isnan frexp, 
> etc to extract the needed components. Then, using the %H specifier to 
> build the hexadecimal float string in get_float_hex_string(). I added 
> checks for zero, inf, nan, and the sign.
> 
> Once I had this working for kind=8, I repeated the pattern for kind=8, 
> 10, and 16. I used defines around the kind=10 and 16 to avoid where not 
> supported.
> 
> I also created defines for the C functions needed following the examples 
> later in the file. I dont have some of those platforms readily available 
> here so a web searched for those various function, ie not tested yet. I 
> will call it an EWAG. Engineering Wild Assumption and Guess.
> 
> I apologize for the whitespace cleanups. I had them in my worktree from 
> earlier attempts.
> 
> I updated the two test cases added. I probably need to specify targets 
> on those. We can add additional testcases as deemed appropriate.
> 
> Regression tested here on X86_64. Testing by others encouraged.
> 
> OK for mainline. I do not plan any backport and less others think its 
> worth it.

this is already in a quite good shape.  However, I have two
preliminary comments:

- rounding is not yet correct.  Example:

   real(4) :: r4
   r4 = 128.
   write(*,"(*(4x,EX0.2))") r4, abs (nearest(r4,-1.0))

prints

     0X8.00P+4    0XF.FFP+3

but should print

     0X8.00P+4    0X8.00P+4

- real(10) and real(16) are not available everywhere.
   Please have a look at gfortran.dg/ieee/ieee_11.F90
   for one way to solve this.

Best,
Harald

> Best regards,
> 
> Jerry
> 
> PS I will be on travel the next 7 day however I can monitor email.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.