[Issue 13963] BigInt modulo ulong is rejected
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jan 25 00:36:29 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13963
mfx <markus at oberhumer.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #3 from mfx <markus at oberhumer.com> ---
Thanks for the fix, but we still have some problem here:
import std.bigint;
void main()
{
import std.typetuple : TypeTuple;
import std.stdio : writeln;
// assert that "y = x % b" has same value as "x %= b"
void checkMod(T)(T a, T b)
{
BigInt x = a;
auto y = x % b;
x %= b;
//assert(x == y);
if (x != y)
writeln("BitInt modulo ERROR: ", typeid(T), " ", a, " ", b, " ", x,
" ", y);
}
foreach(T; TypeTuple!(byte, ubyte, short, ushort, int, uint, long, ulong))
{
immutable T[] values = [T.min, T.min + 1, 0, T.max - 1, T.max];
foreach(a; values)
foreach(b; values)
if (b != 0)
checkMod!T(a, b);
}
}
--
More information about the Digitalmars-d-bugs
mailing list