math/gfreduce.[ch]: Fix out-of-bounds memory access.
[u/mdw/catacomb] / math / t / gfreduce
1 # Test efficient polynomial reduction
2
3 reduce {
4 0x10000000
5 0x4509823098098435
6 0x8098435;
7 0x100000000000000050002
8 0x4509823098098435
9 0x4509823098098435;
10 0x100000000000000050002
11 0x450982309809843545609843098560803495
12 0x144f98a2f5cbc4773cfd;
13 0xb2ca471b0867d5fae2e4f27a2d2706da
14 0xf254423fef93d5d7a76ecf22c656c1352c53257875945d33
15 0x582f783fc210f72814780e69b0bd29ff;
16
17 # --- Bugs discovered ---
18
19 0x20000000000000000000000000000000000000004000000000000000001
20 0x110414154054140445011511541540514401111414505115044104145451505001151441450000541004550554154040500000411050400055041
21 0x1bf878a39fbee9cf20a2f6f41eadda756518f1669b2c7d8f9234965b6b3;
22
23 # --- Some randomized tests ---
24
25 0x8000000000000000 0x1053e80c002df41fe6b0362 0x4002df41fe6b0362;
26 0x8000000000000000 0x8988a38f375ecdf7dc69fb79 0x375ecdf7dc69fb79;
27 0x8000000000000000 0x9c2c4431aa69d5b2fc67a432 0x2a69d5b2fc67a432;
28 0x8000000000000000 0x5cd61819c2ce11ff5edf5010 0x42ce11ff5edf5010;
29 0x8000000000000000 0xc3b542762081f9ad85ef454c 0x2081f9ad85ef454c;
30 0x8000000000000000 0x4b7afa54a524a75e619c7d75 0x2524a75e619c7d75;
31 0x8000000000000000 0x2aa3ec8bbd8d3c54d9d8743c 0x3d8d3c54d9d8743c;
32 0x8000000000000000 0xc43d78723951e2e3bb2320f8 0x3951e2e3bb2320f8;
33
34 0x8000000000000001 0xf2b637dd4b236c3c82c307cd 0x4b236c3d67af6877;
35 0x8000000000000001 0xb6b4472822f7938380ef4ae7 0x22f79382ed87c4b7;
36 0x8000000000000001 0x8325aacc0aa94e489805a261 0xaa94e499e4ef7f9;
37 0x8000000000000001 0xa9a1e52b51d3bdfe17121e97 0x51d3bdff4451d4c1;
38 0x8000000000000001 0x23f79afedb882fe867fe217a 0x5b882fe820111487;
39 0x8000000000000001 0xb14c1917425430945b851a07 0x42543095391d2829;
40 0x8000000000000001 0xcd66f07ce64acb56b8a5e6d9 0x664acb5722680620;
41 0x8000000000000001 0x3aff3bbc3a68db8eb78ccd2c 0x3a68db8ec272ba54;
42
43 0x788bb9913c202db 0xdae682a9d44ccaf8961e6d70 0xb4f429af6b42d9;
44 0xdb31e7bcb59249e 0xc721aacf0c8c0924d0c71c1f 0x4c098e94efcdff3;
45 0x64849830bf2edc64 0x4e53a42e9a5db6f4589222c3 0x21746a64956f27d3;
46 0x3d0c6311af50234 0x28060553212fb75c63bd1b37 0x1c180e845f9eeb;
47 0x3fa21cc125ba9dc3 0x4a1f7351962c7ea1e13913bd 0x1d0b916b8653e959;
48 0xb8ed0bc2a356bb2a 0x82f8a7aa2d5d627808ccd318 0x4f860208c89b6810;
49 0x874421067d7e18ce 0x12a96980346a4ec9d63a6ed6 0xbd6ab5dedb4f198;
50 0x112351ba108debb4 0xb16dd89e0be5854390bca556 0xeb7f9a731006a12;
51 0xdc377451028c0b36 0xbc10689c07a0a58889311e64 0x9c9a4f6d04d469a;
52 0xc5a35ba806bbd020 0x55d4006788dcea573bd68917 0x41833c4fda163bb7;
53 0x155496cfddfc17a 0x5192caf13d7bc577a2a99a85 0x1907b684ea1887;
54 0x1f219e5fc63e4b3 0xb2cd7b1451e88b1cd00178fa 0x80aff284f49f01;
55 0x379065bfb08efca5 0x27b6c5bbfc67dcf9ad7a11b7 0xe93af61c7b85801;
56 0x819e1387819a26b 0x70f45f72bdbaa8e1506f18e3 0x67f64ac9afeae07;
57 0xfa1cd3ca5f9c522b 0x8ff38bb5a723bcfb47cd95b7 0x465b9a116273658;
58 0x355eaf2dc02cad7c 0xa1b872689bf1a4be64943fb0 0xa2b4230ace983b8;
59 0x1cab10c75272d1cb 0x4d136f699bfd2a522aea313f 0xe55a379963cad23;
60 0xafa255df350035f3 0x5be0694600777ed13e451fb2 0x5d88a4df4e905304;
61 0xe19e06e81ebdd297 0x6cc418e1ff14727eeee081c6 0x5210e67e1ad0991;
62 0xb7425b2c5d818f53 0x3c8961ad01d592f12c2ce614 0x4fa4779ada95654a;
63 0xe62d043eaef81ee7 0x18a4dca5f6400fb1449fd9ff 0x1aca3d5de57cde99;
64 0xd2c2d1e2c0c7a792 0x31004ca4536e34b6ebf6f57c 0x59bb10d3427ce3e;
65 0x8aba5ba8e2a698ae 0x956450deee45f8d1d98671fc 0x1b2a841625705e1e;
66 0x66148a4fedc06808 0x21891c1e1b8c5a7c7d28ba4d 0x33ccd0ee20a4e525;
67 0xcef2153f6e0c6024 0xd88db076e6eaf444dee7832a 0x7d8ef4fedae03a2a;
68 0xd8c542c228374b1b 0x6b6ee7f636f6854e2b9cd961 0xaeeff6053c02317;
69 0x4e64f6a86b57044f 0x7250da4089e2fec345bc6d5f 0x6a194ad03c08c31;
70 0xc0e088778e03e46 0xb870e803a983c4b89e878cb2 0x3b089eeb4d989f8;
71 0xc64c07833520a47b 0x8e2ad857329dab69faa94aa0 0x5e1dbf6d86801a8b;
72 0x89c585e342019d99 0x1ea855935fd5e6ead876af4e 0x720b1de7af48d59e;
73 0x6e76875b22338dd5 0xfe211090944db98481ee5cfc 0x3a19861807cefb5b;
74 0x44478351598d8ff8 0x878f198f78e130a6807a3af1 0x3850ab7a8e9c67b1;
75 }
76
77 modexp {
78 0x20000000000000000000000000000000000000000000000000000000000001001
79 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
80 0
81 1;
82 0x20000000000000000000000000000000000000000000000000000000000001001
83 0x02
84 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
85 1;
86 0x20000000000000000000000000000000000000000000000000000000000001001
87 0x435932098459080438094509845
88 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
89 1;
90 0x10000000000000000000000000000000000000000003
91 0x02
92 0x0fffffffffffffffffffffffffffffffffffffffffff
93 1;
94 0x10000000000000000000000000000000000000000003
95 0x34235950984598345900983409845690805680985
96 0x0fffffffffffffffffffffffffffffffffffffffffff
97 1;
98
99 0x800000000000000000000000000000000000000c9
100 0x3f0eba16286a2d57ea0991168d4994637e8343e36
101 -1
102 0x3c8c172e24598e90b9542e6b8f6571f54be572b50;
103 0x800000000000000000000000000000000000000c9
104 0x3c8c172e24598e90b9542e6b8f6571f54be572b50
105 342345
106 0x3521fe2666efe92ca4eb160a286e0fd9427b84a62;
107 0x800000000000000000000000000000000000000c9
108 0x3f0eba16286a2d57ea0991168d4994637e8343e36
109 -342345
110 0x3521fe2666efe92ca4eb160a286e0fd9427b84a62;
111 }
112
113 sqrt {
114 0x20000000000000000000000000000000000000000000000000000000000001001
115 0x1f081e69f45d3254530766ab98d55fa612c7bb27ea31bc2621d894be9c0b196b3
116 0x7fb838a8a0a95046b9d9d9fb4440f7bbc1a7bd3b4e853fc92d4e1588719986aa;
117 0x10000000000000000000000000000000000000000003
118 0x4594094509835690805698083560980459903450984
119 0x820291881a244a02840a2f8ece3f23f88f38bf0b3a;
120 }
121
122 halftrace {
123 0x20000000000000000000000000000000000000000000000000000000000001001
124 0x174e65c7d14a8ec286df8c7df17662f13f1d3563f13c8c63f23f5d0bd5d1b45cd
125 0x8d68905434b020ccb849e17a03a5c441d2a104aaf523699c1cc7a93174d21d9d;
126 }
127
128 quadsolve {
129 0x20000000000000000000000000000000000000000000000000000000000001001
130 0x174e65c7d14a8ec286df8c7df17662f13f1d3563f13c8c63f23f5d0bd5d1b45cd
131 0x8d68905434b020ccb849e17a03a5c441d2a104aaf523699c1cc7a93174d21d9c;
132 0x10000000000000000000000000000000000000000003
133 0x3b818b447e90713da04f13c3b07cb5e2681d08e4700
134 0x27aa17c97dfa80bbdef9f91b243c6e6ddba1a223cac;
135 0x800000000000000000000000000000000000000c9
136 0x158fe327cc763a2fd7371ee80641ed1871a32aaa8
137 0x29ab0d7da05ffc3f1b3f97ac10e2092694aadbb7c;
138 }