The contributed BigNumberLib package, documented at docs/Reference/Contributed/BigNumberLib/,
its test project at test/package-tests/BigNumberLib/. This file holds what is known about the
package and is not on its pages yet, with the reason.
Seen by one agent only, while it confirmed the hang of AssignModulus and AssignAdditionModulus
(the 1.0.4.0 WARNING on the BigNumber page). The owner's rule is that a defect goes on a page only
once a second, independent agent has reproduced it, so this stays here until one has.
- Corrupt quotient, no error. In a 32-bit program
AssignDivisionof a dividend of 4300 bits gave a quotient of 2173 bits (about 4280 expected); 4288 bits was right. In a 64-bit program a dividend of 4544 bits gave 2305 bits (about 4524 expected); 4300 bits was right. The edge is a dividend of FP_SIZE - 1 digits or more: over about 4288 bits (32-bit), 4480 bits (64-bit). - Cause, from the source. TomsFastMath 0.13.1
fp_divsetsq.used = a.used + 2; when that exceeds FP_SIZE (136 digits of 32 bits, 72 of 64),fp_clampstops at a stray digit and the quotient'susedis wrong. BigNumber.twin'sAssignDivisioncallsfp_divwith no guard. - Also seen:
AssignDivisionhangs from the same edge asAssignModulus, since both go throughfp_div, which drops the carry offp_mul_2dwhen the normalised dividend does not fit. - Both need a dividend beyond the 4096 bits the class supports, which a product that
AssignMultiplicationaccepts can be.
To settle it: a raise-or-right case in OverflowTests.twin (as
Overflow_ModulusOfANumberThatFillsTheLibrary_RaisesErrorOrIsRight), a second agent with the
verifier brief, then the BigNumber page's overflow WARNING and expect.json.