
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
Terje Mathisen <[EMAIL PROTECTED]> wrote:
: : The easiest method would seem to be a subtract, scale, add and compare:
: : double inexact_compare(double a, double b, int bits_to_skip)
: {
: // First the the regular difference:
: double diff = b - a;
: : // Shift this difference down by the number of bits to ignore:
: double scaled_diff = diff / ((double) (2 << bits_to_skip));
:
This does not work for floating point..... or am I missing something obvious?
-- - <[EMAIL PROTECTED]> "almost all programming can be viewed as an exercise in caching"
| <-- __Chronological__ --> | <-- __Thread__ --> |