Table of Contents

Class CommonBits

Namespace
NetTopologySuite.Precision
Assembly
NetTopologySuite.dll

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.

public class CommonBits
Inheritance
CommonBits
Inherited Members

Constructors

CommonBits()

public CommonBits()

Properties

Common

public double Common { get; }

Property Value

double

Methods

Add(double)

public void Add(double num)

Parameters

num double

GetBit(long, int)

Extracts the i'th bit of a bitstring.

public static int GetBit(long bits, int i)

Parameters

bits long

The bitstring to extract from.

i int

The bit to extract.

Returns

int

The value of the extracted bit.

NumCommonMostSigMantissaBits(long, long)

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.

public static int NumCommonMostSigMantissaBits(long num1, long num2)

Parameters

num1 long
num2 long

Returns

int

The number of common most-significant mantissa bits.

SignExpBits(long)

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

public static long SignExpBits(long num)

Parameters

num long

Returns

long

The bit pattern for the sign and exponent.

ToString(long)

A representation of the Double bits formatted for easy readability

public string ToString(long bits)

Parameters

bits long

Returns

string

ZeroLowerBits(long, int)

Zeroes the lower n bits of a bitstring.

public static long ZeroLowerBits(long bits, int nBits)

Parameters

bits long

The bitstring to alter.

nBits int

the number of bits to zero.

Returns

long

The zeroed bitstring.