Convert NEAR_ZERO() macro calls to NEAR_EQUAL() and 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 new macros that simplify caller use, but they need to be propagated throughout the code.  NEAR_ZERO() has existed for a LOT longer than NEAR_EQUAL() and EQUAL() so code needs to be updated.

This task involves going through and reviewing all calls to NEAR_ZERO() and for cases where there's a subtraction of two numbers occurring, the call gets converted to a NEAR_EQUAL() or EQUAL() comparison.  It's only the latter if the tolerance is SMALL_FASTF and is undocumented.  IF there is a comment nearby that mentions the tolerance, you're going to only convert it to NEAR_EQUAL() and retain the tolerance.

Submit your work as a single patch file against our latest SVN sources with all changes included.  See http://brlcad.org/wiki/Deuces to get started and help making patches.

Uploaded Work
File name/URLFile sizeDate submitted
macro.patch4.6 KBDecember 16 2012 02:07 UTC
macro2.patch56.3 KBDecember 16 2012 20:49 UTC
Comments
Tony Jojanon December 11 2012 00:29 UTCTask Claimed

I would like to work on this task.

Sean on December 11 2012 01:13 UTCTask Assigned

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

Tony Jojanon December 12 2012 20:45 UTCClaim Removed

The claim on this task has been removed, someone else can claim it now.

javamonnon December 15 2012 20:13 UTCTask Claimed

I would like to work on this task.

javamonnon December 15 2012 20:56 UTCthe ZERO() macro?

I've come across some files where a ZERO() macro is defined, where the tolerance is set to be SMALL_FASTF for all calls. If this macro is called with a subtraction of arguements, should I change it to EQUAL(), or should I leave calls to ZERO() alone? 

Sean on December 16 2012 00:34 UTCTask Assigned

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

javamonnon December 16 2012 02:08 UTCReady for review

The work on this task is ready to be reviewed.

javamonnon December 16 2012 02:09 UTCNote

The patch right now doesn't change calls to ZERO(). Let me know if you want me to add that in.


Thanks,


Daniel 

Sean on December 16 2012 05:09 UTCdepends

Yes, please also update the (relatively new) ZERO() calls as well just like the NEAR_ZERO() ones. 

Sean on December 16 2012 05:10 UTCnote the related

Note the highly related other macro task:


http://www.google-melange.com/gci/task/view/google/gci2012/8007240


You may be interested in claiming that one as well after completing this one.

javamonnon December 16 2012 20:51 UTCReady for review

Alright, I edited the appropiate calls to ZERO() and replaced them with EQUAL(). This is ready for review now. And thanks for the heads up, I'll pick that one up as soon as this is marked as complete.


Thanks,


Daniel

Sean on December 17 2012 05:42 UTClooks great

A quick review and test application of the patch and everything looks perfect.  Nicely done!


If you provide your full name (if you haven't already), I'll be sure you're properly credited in our authorship documentation.

Sean on December 17 2012 05:42 UTCTask Closed

Congratulations, this task has been completed successfully.

javamonnon December 19 2012 00:18 UTCName

Full name: Daniel Ramirez


Thanks!