Review and update preprocessor macro calls, NEAR_ZERO() and NEAR_EQUAL()BRL-CAD
Status: ClosedTime to complete: 72 hrs Mentors: SeanTags: C, preprocessor, text editing, code cleanup

BRL-CAD's math library provides two macros, NEAR_ZERO() and NEAR_EQUAL() that test whether a number is approximately "0" or whether two numbers are approximately equal to each other.  The numbers are "approximately" zero or equal based on a specified tolerance value.  We recently added two new macros that simplify caller use, but they need to be propagated throughout the code.

This task involves going through and reviewing all calls to NEAR_ZERO and NEAR_EQUAL where the specified tolerance is SMALL_FASTF.  The only caveat is that IF there is a comment nearby that mentions the tolerance, you're going to leave the call alone.  You should only updated the ones that are not documented in some fashion.

Update all undocumented calls to our NEAR_ZERO(..., SMALL_FASTF) with calls to ZERO().

Update all undocumented calls to our NEAR_EQUAL(..., SMALL_FASTF) with calls to EQUAL().

You'll submit a single patch file containing all of your changes.  See if you need help with that.
Uploaded Work
File name/URLFile sizeDate submitted
macro.patch8.3 KBDecember 19 2012 00:13 UTC
javamonnon December 17 2012 17:34 UTCTask Claimed

I would like to work on this task.

Sean on December 17 2012 17:38 UTCTask Assigned

This task has been assigned to javamonn. You have 72 hours to complete this task, good luck!

javamonnon December 19 2012 00:13 UTCReady for review

The work on this task is ready to be reviewed.

javamonnon December 19 2012 00:17 UTCSome notes:

I worked off a fresh checkout, and ignored calls to NEAR_ZERO that involved subtraction since these were fixed with my other task. Let me know if you want me change calls that have have SQRT_SMALL_FASTF as their tolerance, I figured not since it's technically a tighter tolerance than SMALL_FASTF. I would have no issue with going back and changing these though. Also, noticed some calls to VNEAR_ZERO( ). Again, if this is stuff I should edit, just let me know.



Sean on December 19 2012 03:50 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 19 2012 03:51 UTCnope

What you did looks good.  I didn't try to apply it as there are other patches pending, but it reads fine and is what was expected.