mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-14 20:34:06 +00:00
fixed the incorrect negative digits in bignum::randomized_div
This commit is contained in:
parent
3ee0956fd7
commit
572e3cb398
2
util.cpp
2
util.cpp
@ -429,7 +429,7 @@ bignum bignum::randomized_div(int x) const {
|
|||||||
// strange compiler buug:
|
// strange compiler buug:
|
||||||
// if I do / and %, function 'divmod' is called, and it complains on launch that divmod is unimplemented
|
// if I do / and %, function 'divmod' is called, and it complains on launch that divmod is unimplemented
|
||||||
res.digits[i] = carry / x;
|
res.digits[i] = carry / x;
|
||||||
carry -= res.digits[i] * x;
|
carry -= res.digits[i] * (long long)(x);
|
||||||
}
|
}
|
||||||
while(isize(res.digits) && res.digits.back() == 0) res.digits.pop_back();
|
while(isize(res.digits) && res.digits.back() == 0) res.digits.pop_back();
|
||||||
if(rand() % x < carry) res += 1;
|
if(rand() % x < carry) res += 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user