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

void | add (double num)
double | getCommon ()

## Static Public Member Functions

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

## 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.

## Member Function Documentation

## getBit()

int geos::precision::CommonBits::getBit | ( | int64_t | bits,
|  | int | i )

static

Extracts the i'th bit of a bitstring.

Parameters

  bits | the bitstring to extract from
  i | the bit to extract

Returns
  the value of the extracted bit

## numCommonMostSigMantissaBits()

int geos::precision::CommonBits::numCommonMostSigMantissaBits | ( | int64_t | num1,
|  | int64_t | 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

## signExpBits()

int64_t geos::precision::CommonBits::signExpBits | ( | int64_t | 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

## zeroLowerBits()

int64_t geos::precision::CommonBits::zeroLowerBits | ( | int64_t | bits,
|  | int | nBits )

static

Zeroes the lower n bits of a bitstring.

Parameters

  bits | the bitstring to alter
  nBits | the number of bits to zero

Returns
  the zeroed bitstring

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

- CommonBits.h