[Numpy-discussion] Problems testing the floating point flags

Charles R Harris charlesr.harris@gmail....
Mon Nov 15 14:06:17 CST 2010


On Sun, Nov 14, 2010 at 1:29 PM, Mark Wiebe <mwwiebe@gmail.com> wrote:

> On Sun, Nov 14, 2010 at 12:21 PM, Charles R Harris <
> charlesr.harris@gmail.com> wrote:
>
>> Good point. I was trying to keep the fpeclear in front of the code to be
>> tested.
>>
>>
> Yeah, I hadn't considered that possibility too seriously.  Hopefully as
> long as the compiler doesn't see a reason to reorder, it's fine.  Compiler
> optimizers are difficult to trick, they work quite well these days.  I
> believe the reason it reorders in the case of this bug is that it notices
> that by shifting the divide down to the bottom, the control flow path
> returning an error never needs to do the divide, and will thus run faster.
>
>
It looks like no one here has better ideas. Given that there is no way to
guarantee that the compiler behaves absent the pragma I think implementing
the simplest solution that works in practice is the way to go. It needs a
documentation blurb in the code to flag it, we should fix the other
locations where the error is checked, and we should have tests for all of
them so we can verify that the compiler doesn't develop new "features" in
the future. There aren't too many places to deal with, so I think that is
doable.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20101115/ec381943/attachment.html 


More information about the NumPy-Discussion mailing list