Article View: comp.arch
Article #21515Re: Divide by three?
From: Bill Kinnersley
Date: Fri, 02 Jun 1989 02:01
Date: Fri, 02 Jun 1989 02:01
26 lines
990 bytes
990 bytes
[In "Divide by three?" shs@uts.amdahl.com (Steve Schoettler) said:]
:
: Here's a puzzle:
: What's the fastest way to divide an 11 bit number by three,
: on a processor that doesn't have any multiply or divide instructions?
:
How about using the identity
1/3 = 1/4 + (1/4)^2 + (1/4)^3 + ...
In other words,
term = number
ans = 0
for i=1 to 6
term = term/4
ans = ans + term
--
--Bill Kinnersley
Physics Department Montana State University Bozeman, MT 59717
INTERNET: iphwk@terra.oscs.montana.edu BITNET: IPHWK@MTSUNIX1
226 Transfer complete.
Technical Details
Message-ID:
<8906020201.AA10938@terra.oscs.montana.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ncis.tis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!terra.oscs.montana.edu!iphwkShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!ncis.tis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!terra.oscs.montana.edu!iphwk From: iphwk@terra.oscs.montana.edu (Bill Kinnersley) Newsgroups: comp.arch Subject: Re: Divide by three? Message-ID: <8906020201.AA10938@terra.oscs.montana.edu> Date: 2 Jun 89 02:01:39 GMT Organization: Digital Equipment Corporation Lines: 26