phobos icon indicating copy to clipboard operation
phobos copied to clipboard

BigInt divMod loops infinitely when dividing by zero

Open vpanteleev-sym opened this issue 7 months ago • 1 comments

import std.bigint;

void main()
{
	BigInt quotient, remainder;
	divMod(
		dividend: BigInt("1234"),
		divisor: BigInt(0),
		quotient: quotient,
		remainder: remainder
	);
}

Hangs; should throw an exception or error instead.

vpanteleev-sym avatar May 20 '25 07:05 vpanteleev-sym

This affects not just divMod, any BigInt operation involving division by zero will loop infinitely:

import std;
void main()
{
    BigInt x = BigInt(100) / BigInt(0); // infinite loop
}

quickfur avatar Jul 30 '25 23:07 quickfur