GEOS  3.9.1dev
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
geos::precision::CommonBits Class Reference

Determines the maximum number of common most-significant bits in the mantissa of one or numbers. More...

#include <CommonBits.h>

Public Member Functions

 CommonBits ()
 
void add (double num)
 
double getCommon ()
 

Static Public Member Functions

static int64 signExpBits (int64 num)
 Computes the bit pattern for the sign and exponent of a double-precision number. More...
 
static int numCommonMostSigMantissaBits (int64 num1, int64 num2)
 This computes the number of common most-significant bits in the mantissas of two double-precision numbers. More...
 
static int64 zeroLowerBits (int64 bits, int nBits)
 Zeroes the lower n bits of a bitstring. More...
 
static int getBit (int64 bits, int i)
 Extracts the i'th bit of a bitstring. More...
 

Private Attributes

bool isFirst
 
int commonMantissaBitsCount
 
int64 commonBits
 
int64 commonSignExp
 

Detailed Description

Determines the maximum number of common most-significant bits in the mantissa of one or numbers.

Can be used to compute the double-precision number which is represented by the common bits. If there are no common bits, the number computed is 0.0.

Definition at line 33 of file CommonBits.h.

Constructor & Destructor Documentation

geos::precision::CommonBits::CommonBits ( )

Member Function Documentation

void geos::precision::CommonBits::add ( double  num)
static int geos::precision::CommonBits::getBit ( int64  bits,
int  i 
)
static

Extracts the i'th bit of a bitstring.

Parameters
bitsthe bitstring to extract from
ithe bit to extract
Returns
the value of the extracted bit
double geos::precision::CommonBits::getCommon ( )
static int geos::precision::CommonBits::numCommonMostSigMantissaBits ( int64  num1,
int64  num2 
)
static

This computes the number of common most-significant bits in the mantissas of two double-precision numbers.

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
num1
num2
Returns
the number of common most-significant mantissa bits
static int64 geos::precision::CommonBits::signExpBits ( int64  num)
static

Computes the bit pattern for the sign and exponent of a double-precision number.

Parameters
num
Returns
the bit pattern for the sign and exponent
static int64 geos::precision::CommonBits::zeroLowerBits ( int64  bits,
int  nBits 
)
static

Zeroes the lower n bits of a bitstring.

Parameters
bitsthe bitstring to alter
nBitsthe number of bits to zero
Returns
the zeroed bitstring

Member Data Documentation

int64 geos::precision::CommonBits::commonBits
private

Definition at line 41 of file CommonBits.h.

int geos::precision::CommonBits::commonMantissaBitsCount
private

Definition at line 39 of file CommonBits.h.

int64 geos::precision::CommonBits::commonSignExp
private

Definition at line 43 of file CommonBits.h.

bool geos::precision::CommonBits::isFirst
private

Definition at line 37 of file CommonBits.h.


The documentation for this class was generated from the following file: