|
//////////////////////////////////////////////////////////////////////////
/// The Reed Library
/// Copyright (c) 2006 Yevgeniy Shatokhin
/// File: util.h
/// Contains some utility stuff.
///
///
/// Last update: August 29, 2006
#ifndef __UTIL_H__EC89223A_854F_4995_AFE7_974D7057922B_INCLUDED_
#define __UTIL_H__EC89223A_854F_4995_AFE7_974D7057922B_INCLUDED_
#include <cmath>
namespace reed
{
/// Return the accuracy the argument is stored with. \n
/// It equals the absolute difference between 'arg' and the representable
/// value closest to it but different. (In fact, they differ only in the lower
/// bit of their mantissas.)\n
/// It's assumed that arg is an IEEE-compliant normalized double precision number.
double derr(double arg);
/// Compare x and y to see if these numbers are 'approximately' equal (have small
/// absolute difference.\n
/// x is assumed to be 'approximately' equal to y if
/// |x - y| < 2.0 * derr(max(|x|, |y|)). (I chose the 2.0 coefficient quite
/// arbitrarily. Perhaps it makes some sense.)
int dequal(double x, double y);
} // namespace reed
#endif //__UTIL_H__EC89223A_854F_4995_AFE7_974D7057922B_INCLUDED_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.