Print

Print


>I hesitate to simultaneously disagree with both Bill and Craig, but I
>think you should file a bug report.  The purpose of the IEEE modules
>is to allow people to do useful work on machines that have a variety
>of floating point interrupt models.  The "imprecise" statement was
>designed to cover cases like
>        DO I = 1,1000000000000
>           a(i) = b(i)/c(i)
>        ENDDO
>where, on some machines, providing precise interrupts would require
>draining the pipeline on every iteration.

I agree.  The argument that "imprecise" means you never trap (an infinite 
delay!) is not convincing.  It is certainly not what we meant.

We could have made the "imprecise" statement more, well, precise -- but that 
would have been a lot of words to cover an obviously-pathological interpretation 
when it is clear that we meant "as soon as you can without causing an undue 
performance penalty when no exception is being raised".

BTW, this is not helped by the variation in hardware support; on some machines 
the instructions that set the flags cause an interrupt if halting is enabled, on 
others setting the flags does not cause an interrupt ever.  I could be wrong, 
but I think that on x86 setting the flags in the x87 status register causes an 
interrupt but setting them in the SSE status register does not, so on one 
machine both behaviours.  Ugh.

IMO it is the responsibility of the Fortran processor to cover up these 
low-level hardware un-niceties.  It is not so difficult - e.g. instead of 
setting INVALID using the instruction, do something like adding +INF to -INF. 
This probably causes a microscopic slowdown in code that calls IEEE_SET_FLAG in 
an inner loop, but it's better than not giving the user the right semantics. 
Otherwise we have to tell the users "don't use IEEE_SET_FLAG, add +INF and -INF 
yourself if you want to set INVALID" - i.e. there would have been no point in 
providing IEEE_SET_FLAG if it didn't work properly.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo.