On Thursday, 15 May 2014 at 13:01:34 UTC, Ola Fosheim Grøstad wrote:
On Thursday, 15 May 2014 at 12:34:49 UTC, Dicebot wrote:
I think it is your turn to make a counter-example ;)

I've given 2 examples that no compiler can get at… because they lack contextual knowledge. ;)

If compiler lacks contextual knowledge, than only means that range is not actually semantically equivalent to a loop. Which is quite possible if you start considering something like SIMD, this is true.

What is wrong is assumption that such kinds of loops are anything but tiny minority and this warrants generic "ranges can never be as fast as loops" statement.

Btw,

Floating point math is inaccurate, that means the compiler will have to guess what kind of accuracy you are happy with…

AFAIK it is actually not true. Floating point standard defines basic precision guarantees and compilers are free to make any adjustments outside of those basics. In your example you need to verify generated assembly anyway, loop or range.

Reply via email to