mirror of
https://github.com/dlang/phobos.git
synced 2025-05-10 05:41:56 +03:00
Merge pull request #685 from donc/bigint7993div
Fix issue 7973 BigInt %= long/ulong gives wrong value
This commit is contained in:
commit
52b5058d06
1 changed files with 4 additions and 1 deletions
|
@ -162,7 +162,7 @@ public:
|
|||
else static if (op=="%")
|
||||
{
|
||||
assert(y!=0, "Division by zero");
|
||||
static if (is(const(T) == const(long)) || is( const(T) == const(ulong) ))
|
||||
static if (is(immutable(T) == immutable(long)) || is( immutable(T) == immutable(ulong) ))
|
||||
{
|
||||
this %= BigInt(y);
|
||||
}
|
||||
|
@ -581,11 +581,14 @@ unittest // Recursive division, bug 5568
|
|||
// Bug 7973
|
||||
auto a7973 = 10_000_000_000_000_000;
|
||||
const c7973 = 10_000_000_000_000_000;
|
||||
immutable i7973 = 10_000_000_000_000_000;
|
||||
BigInt v7973 = 2551700137;
|
||||
v7973 %= a7973;
|
||||
assert(v7973 == 2551700137);
|
||||
v7973 %= c7973;
|
||||
assert(v7973 == 2551700137);
|
||||
v7973 %= i7973;
|
||||
assert(v7973 == 2551700137);
|
||||
// 8165
|
||||
BigInt[2] a8165;
|
||||
a8165[0] = a8165[1] = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue