inf and nan

In vector calculation, optix treats divided by zero with inf perfectly. It gives Inf and -Inf.
But when I divide by zero for a float, I got nan.
How can I take advantage of Optix to treat divided by zero?
I find

float t = x/y;

gives nan when y=0;
I tried

float t=(make_float3(x,0.f,0.f)/make_float3(y,0.f,0.f)).x;

But I still get nan. That makes confused how

float3 t0 = (boxmin - ray.origin)/ray.direction;

in SDK example sample2 gives inf and -inf correctly?


I got nan because x happens to be 0 too. 0/0 = nan.