Commit graph

72 commits

Author SHA1 Message Date
Andrej Mitrovic
7c616db71a Fixes Issue 8837 - BigInt needs better operator constraints. 2013-02-04 22:06:41 +01:00
H. S. Teoh
47c7ade97e Throw error upon division by zero.
Instead of trying to trigger an integer divide by zero, which seems to
get "optimized" out by the compiler.
2012-10-28 08:02:25 -07:00
Don Clugston
9881071c9d Fix example in BigInt docs
The example didn't compile.
2012-07-19 10:55:44 +02:00
Don Clugston
8af55597ac Fix typo 2012-07-12 09:21:32 +02:00
Don Clugston
5e7b33383a Fix issue 7973 BigInt %= long/ulong gives wrong value
Previous fix only worked for const; this fixes immutable too.
2012-07-11 18:14:17 +02:00
Andrei Alexandrescu
609aefacf6 Merge pull request #642 from donc/bigint7993div
Bigint7993div
2012-07-01 19:50:17 -07:00
Don Clugston
2ab19e80a9 8165 BigInt opAssign return value 2012-06-22 07:24:53 +02:00
Don Clugston
15c655f1b5 Fix issue 8164 BigInt from char[] too 2012-06-22 07:05:06 +02:00
Don Clugston
5da45b213e Fix issue 7973 BigInt %= long/ulong gives wrong value 2012-06-22 07:04:30 +02:00
Don Clugston
a79bb20ea7 Fix issue 7993 BigInt divide-by-1 error
Thanks to c.m.brandeburg for the fix.
2012-06-21 18:36:22 +02:00
Don Clugston
c5374753b2 Test case for 8022 2012-06-21 08:30:16 +02:00
Don Clugston
261889c656 Fix issue 8022 BigInt division bug (2) 2012-06-13 08:39:38 +02:00
Don Clugston
bd72ae7d36 Fix issue 8011 BigInt ++ and -- do wrong thing on negative numbers
Patch by Ary Borenszweig
2012-05-02 20:40:14 +02:00
k-hara
66e13b2c27 Revert "Revert "Merge pull request #120 from 9rnsr/rvalue-struct-literal""
This reverts commit 8a6bfd2529.
2012-02-21 21:03:01 +09:00
Walter Bright
8a6bfd2529 Revert "Merge pull request #120 from 9rnsr/rvalue-struct-literal"
This reverts commit d780d9df0f, reversing
changes made to c6ae86ca4f.
2012-02-20 19:43:12 -08:00
k-hara
d3e1992d86 Add overloads for struct literal and construction that now make rvalue. 2012-01-23 23:41:45 +09:00
Don Clugston
d619dd513f 7078 BigInt.toInt returns a long
Just a silly typo
2011-12-08 09:24:12 +01:00
Don Clugston
c0b25d0903 6819 BigInt ^^ fails for some big numbers (powers)
I've also greatly improved the comments for pow.
2011-10-18 15:00:24 +02:00
k-hara
8c72ce5723 Make FormatError an Exception instead of an Error 2011-09-05 12:54:38 +09:00
k-hara
1673bc594e fix sink to scope 2011-09-05 09:32:29 +09:00
k-hara
0e77b4c614 Change to selective import 2011-09-03 17:21:18 +09:00
k-hara
ac9b3d370c Reduce module dependencies 2011-09-02 23:46:04 +09:00
k-hara
5f64c4d4a1 Add test for 6448 2011-09-02 21:16:11 +09:00
k-hara
f98145fc4d Improve BigInt decimal and hexadecimal formatting 2011-09-02 20:56:40 +09:00
k-hara
11340b5a7b formatString should be right format spec 2011-09-02 20:56:40 +09:00
k-hara
c5c1c0dbbf detab/entab 2011-09-02 20:56:40 +09:00
jmdavis
302323559a Revert "not really pure"
This reverts commit 4f28db6ffb.

Since Walter put weakly pure back in, these changes need to be undone.

Conflicts:

	std/datetime.d
2011-07-07 01:40:07 -07:00
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