[Patch, Fortran] Use -huge()-1 as most negative integer for maxval/maxloc (PR30512)
Brooks Moses
brooks.moses@codesourcery.com
Fri Feb 2 10:02:00 GMT 2007
Tobias Burnus wrote:
> Thomas Koenig wrote:
>> This is OK, with a few minor nits:
>>
> I'm not sure I understand the nits correctly.
[...]
>> This should read
>>
>>> - /* Most negative(-HUGE) for maxval, most positive (-HUGE) for minval. */
>>> + /* Most negative(-HUGE) for maxval, most positive (+HUGE) for minval. */
>
> I think the way it is in my patch is commentwise correct. In my tree it
> currently (with patch) reads as:
[...]
This is why it's helpful for people to actually explain the differences
they're suggesting!
In this case, the difference Thomas is suggesting is that "positive"
should be spelled correctly -- you've left off the final "e" in your
version of the comment.
> While I agree that one could improve the wording, I think using
> "(-HUGE-1)" is confusing for BT_REAL.
> How about something like the following?
>
> /* Most negative for maxloc, most positiv (+HUGE) for minloc.
> Most negative is -HUGE for BT_REAL and -HUGE-1 for BT_INTEGER. */
That seems reasonably clear, on that part. Though I think the comment
as a whole could use some more clarifying -- it doesn't say what it's
referring _to_ (and didn't in the original; this isn't your fault).
I'll suggest (rewrap, indent as needed):
/* We start with the most negative possible value for MAXLOC, and the
most positive possible value for MINLOC. The most negative possible
value is -HUGE for BT_REAL and (-HUGE - 1) for BT_INTEGER; the most
positive possible value is HUGE in both cases. */
Also, I just noticed -- in your libgfortran patches, you end up using
-HUGE-1 for both integers and reals. I presume on reals that just ends
up being the same as -HUGE?
- Brooks
More information about the Gcc-patches
mailing list