Skip to content

Instantly share code, notes, and snippets.

@majiang
Created August 28, 2012 19:11
Show Gist options
  • Select an option

  • Save majiang/3502675 to your computer and use it in GitHub Desktop.

Select an option

Save majiang/3502675 to your computer and use it in GitHub Desktop.
Polynomial test:
x^4 + x^3 + x^2 + x^1 + x^0 = 11111
x^4 + x^3 + x^2 + x^1 = 11110
x^2 + x^1 + x^0 = 111
0x^2 + x^1 + x^0 = 11
11 + 101 = 110
11 + 10010 = 10001
101 + 10010 = 10111
11 * 101 = 1111
11 * 10010 = 110110
101 * 10010 = 1011010
Laurent test:
x^-4 + x^-3 + x^-2 + x^-1 + x^-0 = 1.1111
x^-4 + x^-3 + x^-2 + x^-1 = 1.111e-1
x^-2 + x^-1 + x^-0 = 1.11
0x^-2 + x^-1 + x^-0 = 1.10
1.1 + 1.01 = 1.1e-1
1.1 + 1.001e-1 = 1.0001
1.01 + 1.001e-1 = 1.1101
1.1 * 1.01 = 1.111
1.1 * 1.001e-1 = 1.1011e-1
1.01 * 1.001e-1 = 1.01101e-1
Multiplication test:
1.1 * 11 = 1.e-1
1.1 * 101 = 1.1
1.1 * 10010 = 1.0
1.01 * 11 = 1.11
1.01 * 101 = 1.e-2
1.01 * 10010 = 1.0e-1
1.001e-1 * 11 = 1.1011
1.001e-1 * 101 = 1.101e-1
1.001e-1 * 10010 = 1.0e-3
Division test:
1.00000 / 1.10000 = 1 ... 1.0000e-1
1.00000 / 1.1000e-1 = 11 ... 1.000e-2
1.00000 / 1.010e-2 = 101 ... 1.0e-4
BMA test
1.0 / 1.e-1 = 10 ... 0
matrix(
10 1
1 0
)
N < b[n+1].degree
input: 1
output: [1, 0]
1.00000000 / 1.1111111e-1 = 11 ... 1.e-8
matrix(
11 1
1 0
)
1.1111111e-1 / 1.e-8 = 11111111 ... 0
matrix(
100000000 11111111
11 1
)
N < b[n+1].degree
input: 11111111
output: [11, 1]
1.00000000 / 1.0101010e-1 = 10 ... 1.010100e-2
matrix(
10 1
1 0
)
1.0101010e-1 / 1.010100e-2 = 10 ... 1.0e-7
matrix(
101 10
10 1
)
1.010100e-2 / 1.0e-7 = 101010 ... 0
matrix(
10000000 1010101
101 10
)
N < b[n+1].degree
input: 10101010
output: [101, 10]
1.00000000 / 1.1011011e-1 = 11 ... 1.101101e-2
matrix(
11 1
1 0
)
1.1011011e-1 / 1.101101e-2 = 10 ... 1.e-8
matrix(
111 10
11 1
)
1.101101e-2 / 1.e-8 = 1101101 ... 0
matrix(
100000000 11011011
111 10
)
N < b[n+1].degree
input: 11011011
output: [111, 10]
1.0000000000000000000000000000000000000000000000000000000000000000 / 1.111010110010001111010110010001111010110010001111010110010001111e-1 = 11 ... 1.111010110010001111010110010001111010110010001111010110010001e-4
matrix(
11 1
1 0
)
1.111010110010001111010110010001111010110010001111010110010001111e-1 / 1.111010110010001111010110010001111010110010001111010110010001e-4 = 1000 ... 1.11e-62
matrix(
11001 1000
11 1
)
1.111010110010001111010110010001111010110010001111010110010001e-4 / 1.11e-62 = 10011100110000010011100110000010011100110000010011100110000 ... 1.e-64
matrix(
110110110110110110110110110110110110110110110110110110110110011 10011100110000010011100110000010011100110000010011100110000001
11001 1000
)
N < b[n+1].degree
input: 1111010110010001111010110010001111010110010001111010110010001111
output: [11001, 1000]
1.0000000000000000000000000000000000000000000000000000000000000000 / 1.101011001000111101011001000111101011001000111101011001000111101e-1 = 11 ... 1.11101011001000111101011001000111101011001000111101011001000111e-2
matrix(
11 1
1 0
)
1.101011001000111101011001000111101011001000111101011001000111101e-1 / 1.11101011001000111101011001000111101011001000111101011001000111e-2 = 10 ... 1.0001111010110010001111010110010001111010110010001111010110011e-3
matrix(
111 10
11 1
)
1.11101011001000111101011001000111101011001000111101011001000111e-2 / 1.0001111010110010001111010110010001111010110010001111010110011e-3 = 11 ... 1.111010110010001111010110010001111010110010001111010110010010e-4
matrix(
1010 111
111 10
)
1.0001111010110010001111010110010001111010110010001111010110011e-3 / 1.111010110010001111010110010001111010110010001111010110010010e-4 = 11 ... 1.01e-62
matrix(
11001 1011
1010 111
)
1.111010110010001111010110010001111010110010001111010110010010e-4 / 1.01e-62 = 11000100101111100111011010000011000100101111100111011010000 ... 1.0e-63
matrix(
101010101010101010101010101010101010101010101010101010101011010 11101101000001100010010111110011101101000001100010010111110111
11001 1011
)
N < b[n+1].degree
input: 1101011001000111101011001000111101011001000111101011001000111101
output: [11001, 1011]
1.0000000000000000000000000000000000000000000000000000000000000000 / 1.0001111010110010001111010110010001111010110010001111010110010e-3 = 1000 ... 1.111010110010001111010110010001111010110010001111010110010000e-4
matrix(
1000 1
1 0
)
1.0001111010110010001111010110010001111010110010001111010110010e-3 / 1.111010110010001111010110010001111010110010001111010110010000e-4 = 11 ... 1.0e-63
matrix(
11001 11
1000 1
)
1.111010110010001111010110010001111010110010001111010110010000e-4 / 1.0e-63 = 111101011001000111101011001000111101011001000111101011001000 ... 0
matrix(
1000000000000000000000000000000000000000000000000000000000000000 1000111101011001000111101011001000111101011001000111101011001
11001 11
)
N < b[n+1].degree
input: 0010001111010110010001111010110010001111010110010001111010110010
output: [11001, 11]
1.0000000000000000000000000000000000000000000000000000000000000000 / 1.111111101011001000111101011001000111101011001000111101011001000e-1 = 11 ... 1.11101011001000111101011001000111101011001000111101011000e-8
matrix(
11 1
1 0
)
1.111111101011001000111101011001000111101011001000111101011001000e-1 / 1.11101011001000111101011001000111101011001000111101011000e-8 = 10001111 ... 1.0000000e-57
matrix(
110010000 10001111
11 1
)
1.11101011001000111101011001000111101011001000111101011000e-8 / 1.0000000e-57 = 11110101100100011110101100100011110101100100011110 ... 1.011000e-58
matrix(
1000000000000000000000000000000000000000000000000011100011 111111110101100100011110101100100011110101100100010101011
110010000 10001111
)
N < b[n+1].degree
input: 1111111101011001000111101011001000111101011001000111101011001000
output: [110010000, 10001111]
1.0000000000000000000000000000000000000000000000000000000000000000 / 1.101101101101101101101101101101101101101101101101101e-13 = 11100000000000 ... 1.100000000000e-52
matrix(
11100000000000 1
1 0
)
1.101101101101101101101101101101101101101101101101101e-13 / 1.100000000000e-52 = 1001001001001001001001001001001001001001 ... 1.101101101e-55
matrix(
11111111111111111111111111111111111111111100000000001 1001001001001001001001001001001001001001
11100000000000 1
)
N < b[n+1].degree
input: 0000000000001101101101101101101101101101101101101101101101101101
output: [11100000000000, 1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment