[PATCH] fortran/PR58113

Bernd Edlinger bernd.edlinger@hotmail.de
Thu Sep 26 11:17:00 GMT 2013


On Wed, 25 Sep 2013 21:00:33, Tobias Burnus wrote:
>
> Bernd Edlinger wrote:
>> this test case fails very often, and the reason is not in GCC but
>> in a missing glibc rounding support for strtod.
>>
>> This patch fixes the test case, to first determine if the
>> rounding support is available. This is often the case for real(16)
>> thru the libquadmath. So even in cases where the test case usually
>> fails it still tests something with this patch.
>>
>> Ok for trunk?
>
>
> First, for Fortran patches, it helps if you CC fortran@ as otherwise the
> email might be missed.
>
> Your change doesn't really directly check whether strtod handles
> rounding but whether libgfortran (invoking strtod) supports up/down
> rounding.
>
> Hence, after your patch, one effectively checks - given that up/down
> rounding works (or at least produces different values) - that the
> nearest/zero/up/down give the correct result.
>
> As only few strtod implementations currently support rounding, it is
> probably the best approach. However, I think it merits a comment making
> clear what it now checked (and what isn't). Maybe something along my
> paragraph (but polished) - and removing the then obsoleted parts of the
> existing comment.
>
> Except for the comment update, the patch looks fine to me.
>

OK, I used some of your wordings to update the comment.

I assume it's OK now.

> Tobias
>
> PS: I wonder whether there is a good way to do rounded strtod without
> relying on the system's libc to handle it.
>

Apparently the real(16) aka libquadmath has an own implementation
for strtod, that handles all rounding stuff the right way.

Probably it should be possible to locate that code and rework it for the
other possible real precisions, that currently rely on glibc's strtod.

However I will likely not have time for that :(

Bernd. 		 	   		  
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: changelog-round4.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130926/0e523eee/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-round4.diff
Type: application/octet-stream
Size: 4663 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130926/0e523eee/attachment.obj>


More information about the Gcc-patches mailing list