MiscEl: Integer math

Back to MiscEl main page Write a message to author


This page is used to calculate some usefull integer stuff.


Input values

The use of the values depends on the selected function.
ValueA real number
DigitsNumber of binary digits (bits)
ValuesOne value for each field

Output values

Gretest common divisor (GRC)Lists the GRC and the result of dividing each value by GRC
Least common multiple (LCM)Lists the LCM and the result of dividing each value into LCM
Prime factorsList all primefactors for each number
Word sizeList number of steps, precision, range, and some other stuff
Gray codesList a gray code table (up to 9 digits), or the formula for calculating the gray codes (10+ digits)
Bit sizeList minimum number of bits required to represent each number
Real to Mult/DivFind a fraction to substitute for the real number, will also specify value limits in different word sizes
Real to Mult/Div with x/2^nFind a fraction to substitute for the real number, but limits the denominator to powers of 2, will also specify value limits in different word sizes
Real to Mult/Div with 2^n/xFind a fraction to substitute for the real number, but limits the numerator to powers of 2, will also specify value limits in different word sizes
Real to Mult/Div with x/2^wordsizeFind a fraction to substitute for the real number, but limits the denominator to wordsize. This function used the fact that most multiply instructions returnes a result with twice the wordsize, making a division with wordsize free (i.e. just use the lsb)

Config

Define preferences.
Use standard signed bitsInclude word sizes of 7,15,31 bits
Use standard unsigned bitsInclude word sizes of 8,16,32 bits
More bitsSpecify other word sizes (multiple specifications of the same wordsize are ignored)
Add spacesShow all integer numbers with a space for every 3 digits, to improve readability

Notes


Other pages