This is the mail archive of the gcc-patches@gcc.gnu.org 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: [PATCH][4.3] Expand lround inline for x86_64/i?86 SSE math



On Oct 19, 2006, at 4:23 PM, Brooks Moses wrote:


Steve Kargl wrote:
Upon further review, the standard says NINT(X) = INT(X+0.5)
for X > 0.  So, if and when someone makes a change to the
inlining of NINT(X), its result needs to agree with
INT(X+0.5).

Note, though, the complete change of language in the definition of NINT in the Fortran 2003 standard. In the pathological cases where they might arguably be held to require different things, I think we should be following the later language.


Beyond that, I am also somewhat dubious about the idea that the language you cite was really meant to mean that NINT(X) must be subject to exactly the same rounding errors as INT(X+0.5). I think that's the same sort of splitting too fine a hair that Richard Maine told me I was doing when I claimed a few months ago that DATA I/.../ and I=... were required to treat the largest negative integer differently. :)

I'm pretty sure someone even asked about this NINT formula in a formal interp once. I'm too lazy to go look up the interp. It is even possible that they were convinced to withdraw it in order to avoid the waste of time involved in the formal interp processing (the formal process is pretty slow and laborious). In any case, I'm quite sure that the essence of the answer, whether it was a formal or informal one, was that of course this was just a mathematical description and that the vendor can use a different algorithm. In particular, one can use an algorithm that does a better job at the ends of the range (I think that might have been where the question arose).


That interp is probably why the wording changed. Might even be that the wording changes are officially part of f95. Did you look at the corrigenda? (I didn't, and I've already stayed 50 minutes late at work here today, so I'm not planning to stay longer to look it up and see.)

--
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                            |        -- Mark Twain


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