> I had included the <=0.0 in the comparison as i got "comparing floating point 
> with == or != is unsafe" error otherwise.
> Also, I think i misunderstood one of our earlier discussions due to which I 
> included the voxel array for all voxels. I will rectify that error too so 
> that only the
> information of a single ray is stored in memory at any time.

It is unsafe and generally unreliable to directly compare two floating point 
numbers with == or != but that doesn't mean you can't compare for 
equality/inequality.  You just syntactically shouldn't do it that way unless 
your working on a project that *requires* exact IEEE floating point compliance 
(which we don't, nor do most compilers by default -- that's why they warn).

When you logically need a "==0.0" test, you can use our ZERO() and NEAR_ZERO() 
macros defined in the vmath.h header.  Those macros account for floating point 
fuzz within a specified tolerance so that you will get robust behavior 
regardless of the floating point unit and compiler behavior.

Cheers!
Sean


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to