Date: Tue, 13 Jan 2026 22:49:30 +0100
> On 13 Jan 2026, at 22:28, Thiago Macieira via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Tuesday, 13 January 2026 13:22:53 Pacific Standard Time Thiago Macieira via
> Std-Proposals wrote:
>> Why *must* it use a loop?
>>
>> I don't see one here https://clang.godbolt.org/z/5KcPbT559.
>
> Oops, I didn't scroll down far enough. There is a loop in that.
>
> But the question remains: why *must* it use a loop if Hans has an algorithm
> (presumed correct) that doesn't need a loop?
The traditional multiprecision division algorithm uses a loop in order to be able to handle all multiword sizes. For 2-by-1 word division, it can be removed by hand, and I suggest doing it for higher multiword sizes by recursive templates. So the loop can be removed, it is only very complicated to do so.
>
> On Tuesday, 13 January 2026 13:22:53 Pacific Standard Time Thiago Macieira via
> Std-Proposals wrote:
>> Why *must* it use a loop?
>>
>> I don't see one here https://clang.godbolt.org/z/5KcPbT559.
>
> Oops, I didn't scroll down far enough. There is a loop in that.
>
> But the question remains: why *must* it use a loop if Hans has an algorithm
> (presumed correct) that doesn't need a loop?
The traditional multiprecision division algorithm uses a loop in order to be able to handle all multiword sizes. For 2-by-1 word division, it can be removed by hand, and I suggest doing it for higher multiword sizes by recursive templates. So the loop can be removed, it is only very complicated to do so.
Received on 2026-01-13 21:49:51
