Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

// request.cf · coarse context

A page that knows where it met you.

Only coarse request metadata is shown. This demo does not display or persist visitor IP addresses.

Country
US
Cloudflare location
CMH
Connection
HTTP/2
Language
Not provided

Ray ID: a22b5ba4ae28cf83

Jump to content

Talk:Barrett reduction

Page contents not supported in other languages.
Add topic
From Wikipedia, the free encyclopedia
Latest comment: 15 years ago by CountingPine in topic Possible article source

Circular reasoning??

[edit]

Im a bit confused by the explanation of the algorithm. There doesnt seem to be any explanation as to how the values for k and m are calculated. Say, by computer algorithm, for example. A human could reason it, probably. The value of m is defined as the floor of a power of 2 divided by n. But I thought the point of the algorithm was to avoid division by n. There seems to be no way to know 1/n or approximate s ahead of time. I thought this because I was referred to this algorithm by another source which stated that Barrett reduction was a fast way of finding a modulus that circumvents the need for division. They were talking about integer division, granted, but integer division is faster and easier than floating point division, which itself is based on integer operations. What am I missing here?

Possible article source

[edit]

This page looks like it might be a good source of information on this algorithm. CountingPine (talk) 21:36, 9 July 2011 (UTC)Reply

Think of n as representing the fixed-point number n 2^{-k}

[edit]

Why not introduce a new variable for n? This makes the algorithm less clear. Or should n be m?