All the magic is happening in a "while != 0" loop, so we ended up with an empty string for zero-value BigIntegers. Now we just check that upfront and return early.
@@ -80,6 +80,9 @@ UnsignedBigInteger UnsignedBigInteger::from_base10(const String& str)
String UnsignedBigInteger::to_base10() const
{
+ if (*this == UnsignedBigInteger { 0 })
+ return "0";
+
StringBuilder builder;
UnsignedBigInteger temp(*this);
UnsignedBigInteger quotient;