The following code can be found in cutil_math.h in the SDK:
inline __host__ __device__ float2 operator/(float s, float2 a)
{
float inv = 1.0f / s;
return a * inv;
}
which means that
float2 foo = 1.0f / make_float2(2.0f, 3.0f);
will result in (2.0f, 3.0f), whereas I would expect (1.0f / 2.0f, 1.0f / 3.0f).
I think that the code in cutil_math.h should be replaced by:
inline __host__ __device__ float2 operator/(float s, float2 a)
{
return make_float2(s / a.x, s / a.y);
}
The same is true for float3 and float4 divisions.
Any thoughts?