xxxxxxxxxx
void main()
{
import std.bigint;
import std.stdio: writeln;
BigInt dividend = "-50";
BigInt divisor = "1";
BigInt quotient, remainder;
divMod(dividend, divisor, quotient, remainder);
writeln("Remainder: ", remainder); // "-0", this is incorrect!
if (remainder == 0) // This should have worked, but doesn't
{
writeln("Comparing to 0, remainder is 0");
}
if (remainder == BigInt("-0")) // This should have worked, but doesn't
{
writeln("Comparing to BigInt -0, remainder is -0");
}
if (remainder.toInt == 0) // This works but is unnecessary
{
writeln("Comparing to 0 after conversion to int, remainder is 0");
}
if (dividend % divisor == 0) // This works, was resolved in an earlier issue
{
// https://issues.dlang.org/show_bug.cgi?id=14124
writeln("dividend % divisor, remainder is 0");
}
}