[PATCH][4.3] Expand lround inline for x86_64/i?86 SSE math

Brooks Moses bmoses@stanford.edu
Fri Oct 20 03:31:00 GMT 2006


Richard E Maine wrote:
> On Oct 19, 2006, at 4:23 PM, Brooks Moses wrote:
>>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.)

Good call -- the second F95 corrigendum does indeed have the following 
note, referring to the definition of the NINT() intrinsic:

> In subclause 13.14.77, replace the Result Value paragraph by:
> 
>    Result Value. The result is the integer nearest A, or if there
>    are two integers equally near A, the result is whichever such
>    integer has the greater magnitude.

(A similar change is, of course, made for the ANINT() intrinsic.)

- Brooks



More information about the Fortran mailing list