One effect of having a division by limit in the algorithm is that (at least on the usual kind of platform) you'll get SIGFPE or the local analogue if you pass limit==0.
Without a division, your code will presumably fail to notice the invalid input. Reading it over, it looks to me as if really_divisionless(0) will return 0, which of course is an illegal return value, because it's not true that 0 ≤ return value < limit.
Of course, all return values are illegal in this situation, for the same reason. So I'd almost (but not quite) feel happier if the function had contrived to loop forever if limit==0, because then it wouldn't return something out of range! :-)
no subject
Date: 2022-04-21 10:24 (UTC)limit
in the algorithm is that (at least on the usual kind of platform) you'll get SIGFPE or the local analogue if you passlimit==0
.Without a division, your code will presumably fail to notice the invalid input. Reading it over, it looks to me as if
really_divisionless(0)
will return 0, which of course is an illegal return value, because it's not true that 0 ≤ return value <limit
.Of course, all return values are illegal in this situation, for the same reason. So I'd almost (but not quite) feel happier if the function had contrived to loop forever if
limit==0
, because then it wouldn't return something out of range! :-)