acd82f974b
See the comments before tests for details.
The test cases are generated with this Rust program:
```
use num::*;
fn main() {
// 10111...., 65 bits
let lo: u64 = (1 << 63) - 1;
let mut err_pattern: BigUint = BigUint::from(lo);
err_pattern.set_bit(64, true);
// In the error case, the bit after the sign bit should be set (this bit will be lost), and
// sign bit should be unset (so that overflow won't make the result negative).
assert!(err_pattern.bit(64));
assert!(!err_pattern.bit(63));
// For each radix, find the number and digit where
// `<error> = (<old number> * <radix>) + <digit>`.
'radix_loop: for radix in 4..=36u32 {
for digit in 0..radix {
let i: BigUint = (err_pattern.clone() - BigUint::from(digit)) / BigUint::from(radix);
if !i.bit(64) && !i.bit(63) {
println!(
"{}: {} + {} ({} + {})",
radix,
i.to_str_radix(radix),
BigUint::from(digit).to_str_radix(radix),
i,
digit,
);
continue 'radix_loop;
}
}
}
}
```
Change-Id: I6fe92c46b31373f465702744ee069394db949b60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372422
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/tree/main/docs/Testing.md.