Bypassing Interger Div DIV, Integer, Float

Is it possible to bypass Integer Div(Other than >>2, etc.), for instance by converting to Float, which has a “Fast-math” Div? (Sorry, Can’t access Cuda now)

Sure, sometimes you can use floating point divides instead, but you have to careful that your integers are exactly representable in fp.

Sure, sometimes you can use floating point divides instead, but you have to careful that your integers are exactly representable in fp.

You also need to make sure to either compile with -prec-div=true or use __fdiv_rn in order to get correct rounding. Otherwise even divisions of simple numbers like 82/41 could yield wrong answers.

But I am unsure whether __fdiv_rn is really faster than an integer division on Compute 1.x devices…

You also need to make sure to either compile with -prec-div=true or use __fdiv_rn in order to get correct rounding. Otherwise even divisions of simple numbers like 82/41 could yield wrong answers.

But I am unsure whether __fdiv_rn is really faster than an integer division on Compute 1.x devices…