Re: division by 7 without using division operator
- From: "*** T. Winter" <***.Winter@xxxxxx>
- Date: Tue, 6 Feb 2007 00:33:25 GMT
In article <1170710144.518843.62070@xxxxxxxxxxxxxxxxxxxxxxxxxxx> "Francois Grieu" <fgrieu@xxxxxxxxx> writes:
....
To suceed in these interviews, I fear that you must not be so smart as
to outsmart the person asking the questions. So I suspect the right
answer might have been
number *= 0.142857142857143; // divide by 7
which indeed, in quite a few contexts, is an approriate answer.
Indeed, it gives the correct answer for all integers from 0 to
2147483647.
--
*** t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131
home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~***/
.
- Follow-Ups:
- Re: division by 7 without using division operator
- From: CBFalconer
- Re: division by 7 without using division operator
- References:
- division by 7 without using division operator
- From: krypto . wizard
- Re: division by 7 without using division operator
- From: Francois Grieu
- division by 7 without using division operator
- Prev by Date: Re: sizeof pointers
- Next by Date: Re: Malloc
- Previous by thread: Re: division by 7 without using division operator
- Next by thread: Re: division by 7 without using division operator
- Index(es):