Commit graph

45 commits

Author SHA1 Message Date
Walter Bright
4f28db6ffb not really pure 2011-06-25 19:58:09 -07:00
Don Clugston
9110377e42 5928 Bigint modulo problem
This problem was caused by an implicit conversion to ulong.
2011-05-06 07:30:07 +02:00
Don Clugston
9ecf947290 5568 A problem with BigInt modulus
This is quite subtle. The recursive division algorithm has a possibility of one
bit of overflow in the second recursive call, in cases where the top quarter of
the dividend is identical to the top half of the divisor.
The description of the recursive division algorithm in "Modern Computer
Arithmetic" 0.5.9 is rather vague about this (which is why I missed it
originally, though the test case does cause assert failure in biguint).
Unfortunately it requires fairly substantial changes to the function, which
makes the algorithm a lot less elegant. But I have managed to implement it
without any change to the basic division algorithm (which is very fast).
2011-02-23 21:20:48 +01:00
Don Clugston
572c4a9b6e Unit test for bug 5608 2011-02-18 22:20:57 +01:00
Don Clugston
80c64d92e4 Bigint toHex: Remove duplicate buffer 2011-02-18 09:35:51 +01:00
Walter Bright
046e1b36db add source links 2011-02-06 15:46:50 -08:00
Don Clugston
5ede508f0e Minor ddoc fixes for std.math and std.bigint 2010-11-17 20:42:28 +00:00
Don Clugston
9d7622586a Fix for BigInt assign for 64 bit compilers. Also a few steps towards const correctness, and some comment fixes. 2010-10-25 07:30:38 +00:00
Don Clugston
b929dcf0ec Fix bug 4742 int % BigInt should work.
Also improved code formatting.
2010-09-21 01:49:44 +00:00
Don Clugston
3c369fa19e 4872 std.bigint problem with negative numbers
This one made bigint unusable.
2010-09-15 22:06:34 +00:00
Walter Bright
b8ce58ccd1 detab sources 2010-08-23 02:14:45 +00:00
Andrei Alexandrescu
3f2b8c12ea 64-bit compatibility work 2010-08-22 20:55:22 +00:00
Don Clugston
2b6b4aff56 Fix bug 4470 Problems with std.bigint mod and divide 2010-07-17 06:26:24 +00:00
Don Clugston
504b60eef7 Bug 4300. BigInt * int doesn't work well. 2010-06-10 21:43:55 +00:00
Masahiro Nakagawa
cad7d9a0dc Fix old-style opOpAssign of std.bigint 2010-06-10 09:52:33 +00:00
Andrei Alexandrescu
bdc1516342 Fixed module name in bigint.d 2010-06-08 19:27:32 +00:00
Don Clugston
bb2168590a bigint->std.bigint 2010-06-08 19:26:41 +00:00
Don Clugston
0a8a8a39c5 High-performance BigInt, initial release. Posix makefile has not yet been updated. 2010-03-24 21:13:24 +00:00
Andrei Alexandrescu
2a9a6e336c string, wstring are now bidirectional (not random) ranges
std.algorithm: defined move with one argument; levenshtein distance generalized to with all forward ranges; take now has swapped arguments
std.array: empty for arrays is now a @property; front and back for a string and wstring automatically decodes the first/last character; popFront, popBack for string and wstring obey the UTF stride
std.conv: changed the default array formatting from "[a, b, c]" to "a b c"
std.range: swapped order of arguments in take
std.stdio: added readln template
std.variant: now works with statically-sized arrays and const data
std.traits: added isNarrowString
2010-02-22 15:52:31 +00:00
Sean Kelly
747f3cf1e4 Changed Phobos to use the Boost license. Currently, all public domain modules and all licensed modules by Walter, Andrei, Bartosz, and Don have been changed to use this license (excepting std.c, for the moment). Ideally, all Phobos modules will eventually be distributed under this license, which means obtaining permission from a few more authors, deleting, or rewriting some modules.
Removed std.openrj.
2009-09-16 18:19:51 +00:00
Don Clugston
a5564d6d72 Fixes 2987. 2009-08-28 12:45:41 +00:00
Walter Bright
49551541c3 more integer conversion fixes 2009-06-24 20:04:54 +00:00
Andrei Alexandrescu
75d047a923 unittest commented out in release mode, takes too long to compile 2009-04-06 20:46:22 +00:00
Don Clugston
99cf9b46a9 Removed my bigint asm code. It's out-of-date, and not used by bigint. It will return once the tango-phobos merger is more complete. 2008-11-25 12:25:50 +00:00
Walter Bright
3d1b760496 update to reflect this is now a reference type 2008-11-04 22:08:40 +00:00
Andrei Alexandrescu
738b977bbe bugfix 2289 (fix to the fix) 2008-08-17 23:29:39 +00:00
Andrei Alexandrescu
813696b21b bugfix 2289 2008-08-17 19:58:06 +00:00
Walter Bright
18e0aa5ae0 fixed warnings 2008-07-25 21:18:32 +00:00
Don Clugston
cde7bc6e6c Fixed subtle out-by-1 bug in asm add/sub. (Note that this function is still inaccessible to user code). 2008-07-14 07:14:11 +00:00
Don Clugston
950c0e3c82 After a trivial change (which I don't really understand), all the unit tests pass. 2008-07-01 06:55:31 +00:00
Don Clugston
0082bfa2f2 Fix to allow random to compile with -cov.
Commented out failing unit tests in bigint (seem to be opAssign with integer arguments).
2008-06-30 20:07:05 +00:00
Don Clugston
c09debbe32 Restored bigint (fixed so that it compiles). I've updated my asm code so that it uses dynamic arrays throughout, instead of a mix of pointers and arrays. It's possible that pointers-only would be better. None of the asm code is hooked up yet. 2008-06-30 14:47:37 +00:00
Walter Bright
0ee584c951 fix bugzilla 2145 2008-06-18 06:48:14 +00:00
Don Clugston
b1421d8176 Bugfix: return value was occasionally out-by-1 in mulAdd. 2008-06-17 07:50:25 +00:00
Don Clugston
dcbc4c8c6c And here's the last asm primitive -- division.
Thanks to Eric Bainville for kindly donating his code.
2008-06-10 07:51:08 +00:00
Don Clugston
6b7458155d Use D_PIC where appropriate. Minor changes to formatting. 2008-06-09 08:46:39 +00:00
Don Clugston
2876eb7051 Fix to comments. 2008-06-07 15:11:59 +00:00
Don Clugston
e61e8bc4ec And here is mulAdd. It would be trivial to do mulSub as well, if required. In any bignum implementation, this is most critical routine, and I'm delighted to have a 5.5 clock solution (the latency of MUL alone is 5 clocks) while only unrolling the loop by 2.
It was a huge effort to get it this fast, probably not justified -- but I had fun.
2008-06-06 13:00:41 +00:00
Don Clugston
822b2447d8 Made name of Mul consistent. Minor speedup. MulAdd still not included. BTW Janices code only compiles in debug mode. 2008-06-05 05:19:26 +00:00
Don Clugston
c0affe469d Added the first set of optimised asm bigint routines: shl, shr, mul, add, sub, and, or, xor. Optimised for CPUs from Intels' P6 family. 2008-05-30 07:44:42 +00:00
Janice Caron
6e2dfbd8ad Added opUShr overload 2008-05-19 16:07:57 +00:00
Janice Caron
abbe7ab789 Complete rewrite 2008-05-18 21:19:56 +00:00
Janice Caron
4974615a4e Content removed in entirety 2008-05-16 17:26:39 +00:00
Janice Caron
e5a3f474c3 Fixed declaration of opShl(), opShr() and opUShr(). 2008-05-13 19:57:58 +00:00
Janice Caron
d9b1f08980 First commit 2008-05-13 19:38:04 +00:00