Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

geos::index::quadtree::DoubleBits Class Reference

DoubleBits manipulates Double numbers by using bit manipulation and bit-field extraction. More...

#include <DoubleBits.h>

List of all members.

Public Member Functions

 DoubleBits (double nx)
double getDouble () const
int64 biasedExponent () const
 Determines the exponent for the number.
int getExponent () const
 Determines the exponent for the number.
void zeroLowerBits (int nBits)
int getBit (int i) const
int numCommonMantissaBits (const DoubleBits &db) const
 This computes the number of common most-significant bits in the mantissa.
std::string toString () const
 A representation of the Double bits formatted for easy readability.

Static Public Member Functions

double powerOf2 (int exp)
int exponent (double d)
double truncateToPowerOfTwo (double d)
std::string toBinaryString (double d)
double maximumCommonMantissa (double d1, double d2)

Static Public Attributes

const int EXPONENT_BIAS = 1023


Detailed Description

DoubleBits manipulates Double numbers by using bit manipulation and bit-field extraction.

For some operations (such as determining the exponent) this is more accurate than using mathematical operations (which suffer from round-off error).

The algorithms and constants in this class apply only to IEEE-754 double-precision floating point format.


Member Function Documentation

int geos::index::quadtree::DoubleBits::numCommonMantissaBits const DoubleBits db  )  const
 

This computes the number of common most-significant bits in the mantissa.

It does not count the hidden bit, which is always 1. It does not determine whether the numbers have the same exponent; if they do not, the value computed by this function is meaningless.

Parameters:
db 
Returns:
the number of common most-significant mantissa bits


The documentation for this class was generated from the following file:
Generated on Tue Jun 5 14:58:44 2012 for GEOS by  doxygen 1.3.9.1