Class: CommonBits

jsts.precision.CommonBits

new CommonBits()

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.
Version:
  • 1.7
Source:

Methods

(static) getBit(bits, i) → {number}

Extracts the i'th bit of a bitstring.
Parameters:
Name Type Description
bits number the bitstring to extract from
i number the bit to extract
Source:
Returns:
the value of the extracted bit
Type
number

(static) numCommonMostSigMantissaBits(num1, num2) → {number}

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:
Name Type Description
num1 number the first number
num2 number the second number
Source:
Returns:
the number of common most-significant mantissa bits
Type
number

(static) signExpBits(num) → {number}

Computes the bit pattern for the sign and exponent of a double-precision number.
Parameters:
Name Type Description
num number
Source:
Returns:
the bit pattern for the sign and exponent
Type
number

(static) zeroLowerBits(bits, nBits) → {number}

Zeroes the lower n bits of a bitstring.
Parameters:
Name Type Description
bits number the bitstring to alter
nBits number
Source:
Returns:
the zeroed bitstring
Type
number

add(num)

Parameters:
Name Type Description
num number
Source:

getCommon() → {number}

Source:
Returns:
Type
number

toString(bits) → {string}

A representation of the Double bits formatted for easy readability
Parameters:
Name Type Description
bits number
Source:
Returns:
Type
string