[Insight-developers] Methods for comparing meta-data with tolerance
Bradley Lowekamp
blowekamp at mail.nih.gov
Wed Jun 22 14:53:51 EDT 2011
So perhaps these almost equal methods could be added to the itk::Math namespace. That still doesn't answer where to put almost equal vector, point, and matrix... perhaps in the classes themselves?
Brad K,
Is this an endorsement of using an assumption that we have IEEE floating point numbers, and can assume to be doing bit-wise comparisons?
There seems to be quite a few caveats this that low-level implementation. And I am too lazy to implement multiple optimized versions, depending on the compilers and system capabilities.
Brad
On Jun 21, 2011, at 5:24 PM, Brad King wrote:
> On 06/21/2011 05:03 PM, Bradley Lowekamp wrote:
>> I like the following methods for tolerant comparison:
>>
>> abs( f1-f2 ) > numeric_limits<double|float>::epsilon()*(1u<<BITS )*max( f1, 1.0)
>
> http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm
>
> -Brad K
========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20110622/223accb6/attachment.htm>
More information about the Insight-developers
mailing list