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

> On Sun, Nov 14, 2010 at 12:21 PM, Charles R Harris <
> charlesr.har...@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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to